Merge branch 'fixes-cfg-wizard'
This commit is contained in:
commit
630a820ccd
@ -293,6 +293,7 @@ static void finish() {
|
|||||||
FILE *ks_config = fopen(config_path, "w");
|
FILE *ks_config = fopen(config_path, "w");
|
||||||
if (ks_config == NULL)
|
if (ks_config == NULL)
|
||||||
err(1, "Could not open output config file \"%s\"", config_path);
|
err(1, "Could not open output config file \"%s\"", config_path);
|
||||||
|
free(config_path);
|
||||||
|
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
@ -329,8 +330,11 @@ static void finish() {
|
|||||||
|
|
||||||
/* Skip leading whitespace */
|
/* Skip leading whitespace */
|
||||||
char *walk = line;
|
char *walk = line;
|
||||||
while (isspace(*walk) && walk < (line + len))
|
while (isspace(*walk) && walk < (line + len)) {
|
||||||
|
/* Pre-output the skipped whitespaces to keep proper indentation */
|
||||||
|
fputc(*walk, ks_config);
|
||||||
walk++;
|
walk++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the modifier the user chose */
|
/* Set the modifier the user chose */
|
||||||
if (strncmp(walk, "set $mod ", strlen("set $mod ")) == 0) {
|
if (strncmp(walk, "set $mod ", strlen("set $mod ")) == 0) {
|
||||||
@ -343,7 +347,7 @@ static void finish() {
|
|||||||
/* Check for 'bindcode'. If it’s not a bindcode line, we
|
/* Check for 'bindcode'. If it’s not a bindcode line, we
|
||||||
* just copy it to the output file */
|
* just copy it to the output file */
|
||||||
if (strncmp(walk, "bindcode", strlen("bindcode")) != 0) {
|
if (strncmp(walk, "bindcode", strlen("bindcode")) != 0) {
|
||||||
fputs(line, ks_config);
|
fputs(walk, ks_config);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
char *result = rewrite_binding(walk);
|
char *result = rewrite_binding(walk);
|
||||||
|
Loading…
Reference in New Issue
Block a user