mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-01 19:24:15 -04:00
Merge pull request #1721 from MarcoPolo-PasTonMolo/fix/improve-parser
Improve cmd argument parser
This commit is contained in:
commit
476c73251c
@ -83,9 +83,18 @@ _parse_args_helper(const char* const inp, int min, int max, gboolean* result, gb
|
||||
i++;
|
||||
gchar* next_ch = g_utf8_next_char(curr_ch);
|
||||
gunichar next_uni = g_utf8_get_char(next_ch);
|
||||
|
||||
if (next_uni == '"') {
|
||||
tokens = g_slist_append(tokens, g_strndup(curr_ch,
|
||||
0));
|
||||
token_size = 0;
|
||||
in_token = FALSE;
|
||||
in_quotes = FALSE;
|
||||
} else {
|
||||
token_start = next_ch;
|
||||
token_size += g_unichar_to_utf8(next_uni, NULL);
|
||||
}
|
||||
}
|
||||
if (curr_uni == '"') {
|
||||
gchar* next_ch = g_utf8_next_char(curr_ch);
|
||||
token_start = next_ch;
|
||||
@ -115,7 +124,7 @@ _parse_args_helper(const char* const inp, int min, int max, gboolean* result, gb
|
||||
token_size));
|
||||
token_size = 0;
|
||||
in_token = FALSE;
|
||||
} else if (curr_uni != '"') {
|
||||
} else {
|
||||
token_size += g_unichar_to_utf8(curr_uni, NULL);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user