mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 08:45:59 +01:00
'cherry-pick' changes from jumanji
This commit is contained in:
parent
3cf7505401
commit
5a2af2bc71
1 changed files with 14 additions and 2 deletions
16
zathura.c
16
zathura.c
|
@ -1581,13 +1581,25 @@ read_configuration_file(const char* rcfile)
|
|||
if(!strlen(lines[i]))
|
||||
continue;
|
||||
|
||||
gchar **tokens = g_strsplit_set(lines[i], "\t ", -1);
|
||||
int length = g_strv_length(tokens);
|
||||
gchar **pre_tokens = g_strsplit_set(lines[i], "\t ", -1);
|
||||
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"))
|
||||
cmd_set(length - 1, tokens + 1);
|
||||
else if(!strcmp(tokens[0], "map"))
|
||||
cmd_map(length - 1, tokens + 1);
|
||||
|
||||
g_free(tokens);
|
||||
}
|
||||
|
||||
g_strfreev(lines);
|
||||
|
|
Loading…
Reference in a new issue