mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-14 08:53:46 +01:00
'cherry-pick' changes from jumanji
This commit is contained in:
parent
3cf7505401
commit
5a2af2bc71
16
zathura.c
16
zathura.c
@ -1581,13 +1581,25 @@ read_configuration_file(const char* rcfile)
|
|||||||
if(!strlen(lines[i]))
|
if(!strlen(lines[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gchar **tokens = g_strsplit_set(lines[i], "\t ", -1);
|
gchar **pre_tokens = g_strsplit_set(lines[i], "\t ", -1);
|
||||||
int length = g_strv_length(tokens);
|
int pre_length = g_strv_length(pre_tokens);
|
||||||
|
|
||||||
|
gchar** tokens = g_malloc0(sizeof(gchar*) * (pre_length + 1));
|
||||||
|
gchar** tokp = tokens;
|
||||||
|
int length = 0;
|
||||||
|
for (int i = 0; i != pre_length; ++i) {
|
||||||
|
if (strlen(pre_tokens[i])) {
|
||||||
|
*tokp++ = pre_tokens[i];
|
||||||
|
++length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!strcmp(tokens[0], "set"))
|
if(!strcmp(tokens[0], "set"))
|
||||||
cmd_set(length - 1, tokens + 1);
|
cmd_set(length - 1, tokens + 1);
|
||||||
else if(!strcmp(tokens[0], "map"))
|
else if(!strcmp(tokens[0], "map"))
|
||||||
cmd_map(length - 1, tokens + 1);
|
cmd_map(length - 1, tokens + 1);
|
||||||
|
|
||||||
|
g_free(tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev(lines);
|
g_strfreev(lines);
|
||||||
|
Loading…
Reference in New Issue
Block a user