summaryrefslogtreecommitdiff
path: root/read_cfg.c
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2020-06-27 10:31:53 -0700
committerlouie <lshprung@yahoo.com>2020-06-27 10:31:53 -0700
commit7b9771701e55592d9aeffaa78fe827ff73ef65ac (patch)
tree8537b4e6cdcad60887337b54ee4ee46b8e640520 /read_cfg.c
parent0eb46442f5541f365ebb327375b9e5992194fbd8 (diff)
Added ability to set flags in config
Diffstat (limited to 'read_cfg.c')
-rw-r--r--read_cfg.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/read_cfg.c b/read_cfg.c
index 51572c1..d18685b 100644
--- a/read_cfg.c
+++ b/read_cfg.c
@@ -100,23 +100,29 @@ void check_line(char *buffer){
if(!(strcmp(args[0], "add"))) handle_fname(args[1], args[2]);
//create a new group
- if(!(strcmp(args[0], "addGroup"))) group_add(args[1], NULL);
+ else if(!(strcmp(args[0], "addGroup"))) group_add(args[1], NULL);
- //set a group's launcher (this requires pulling down the existing groups and finding the one that args[1] mentions)
- if(!(strcmp(args[0], "setLauncher"))){
+ else{
+ //remaining possibilities involve args[1] being a char* referring to a group
g = get_groups();
g_count = get_gcount();
//look for matching existing group
for(i = 0; i < g_count; i++){
- if(!(strcmp(get_gname(g[i]), args[1]))){
- set_gprog(g[i], args[2]);
- return;
- }
+ if(!(strcmp(get_gname(g[i]), args[1]))) break;
+ }
+
+ //assert that a matching group was found
+ if(i < g_count){
+ //set a group's launcher (this requires pulling down the existing groups and finding the one that args[1] mentions)
+ if(!(strcmp(args[0], "setLauncher"))) set_gprog(g[i], args[2]);
+
+ //set a group's launcher flags (like ./program -f file for fullscreen)
+ if(!(strcmp(args[0], "setFlags"))) set_gflags(g[i], args[2]);
}
//couldn't find a match
- printf("Error: Group \"%s\" does not exist\n", args[1]);
+ else printf("Error: Group \"%s\" does not exist\n", args[1]);
}
return;