summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorAbhinav <abhinav.prsai@gmail.com>2025-06-04 18:57:12 +0100
committerAbhinav <abhinav.prsai@gmail.com>2025-06-04 18:57:12 +0100
commit7af19e5c975c42e30c48041fc4fdd2450a5e01ea (patch)
tree5591e362e757b5432ac2e8bb9d7896c535a94c05 /src/parser.c
parent2e8038c357d0b87a3a1ed4202c4ba5b6417bc7b2 (diff)
clean up code, add contributions help, v1.6
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/parser.c b/src/parser.c
index 8e598d0..3803f10 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -135,7 +135,7 @@ int parser(Config *cfg)
return -1;
}
- // Determine config file path
+ /* determine config file path */
const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
if (xdg_config_home) {
snprintf(path, sizeof path, "%s/sxwmrc", xdg_config_home);
@@ -159,7 +159,7 @@ int parser(Config *cfg)
goto found;
}
- // Nothing found
+ /* Nothing found */
fprintf(stderr, "sxwmrc: no configuration file found\n");
return -1;
@@ -174,7 +174,7 @@ found:;
int lineno = 0;
int should_floatn = 0;
- // Initialize should_float matrix
+ /* Initialize should_float matrix */
for (int j = 0; j < 256; j++) {
cfg->should_float[j] = calloc(256, sizeof(char *));
if (!cfg->should_float[j]) {
@@ -278,11 +278,13 @@ found:;
/* store each comma separated value in a seperate row */
while (comma && should_floatn < 256) {
comma = strip(comma);
- if (*comma == '"')
+ if (*comma == '"') {
comma++;
+ }
char *end = comma + strlen(comma) - 1;
- if (*end == '"')
+ if (*end == '"') {
*end = '\0';
+ }
/* store each programs name in its own row at index 0 */
cfg->should_float[should_floatn][0] = strdup(comma);
@@ -446,4 +448,4 @@ const char **build_argv(const char *cmd)
wordfree(&p);
return argv;
-} \ No newline at end of file
+}