mirror of
https://github.com/alols/xcape.git
synced 2026-09-10 09:36:15 -04:00
Add comments to config files and trim leading whitespace
This commit is contained in:
parent
c5bae23f32
commit
06078c2c4d
19
xcape.c
19
xcape.c
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
|
|
@ -641,13 +642,19 @@ KeyMap_t *parse_confs (Display *ctrl_conn, char **files, size_t n_confs, Bool de
|
|||
char *line = NULL;
|
||||
while ((line = read_line (file)) != NULL)
|
||||
{
|
||||
*current = parse_token (ctrl_conn, line, debug);
|
||||
free (line);
|
||||
if (*current == NULL)
|
||||
{
|
||||
break;
|
||||
/* trim leading whitespace */
|
||||
char *trimmed = line;
|
||||
while(isspace(*trimmed)) ++trimmed;
|
||||
/* check for comments */
|
||||
if(*trimmed && *trimmed != '#'){
|
||||
*current = parse_token (ctrl_conn, trimmed, debug);
|
||||
if (*current == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
current = &(*current)->next;
|
||||
}
|
||||
current = &(*current)->next;
|
||||
free (line);
|
||||
}
|
||||
|
||||
if (close)
|
||||
|
|
|
|||
Loading…
Reference in a new issue