mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:33:02 +01:00
Fixed segfault and added support for single quotes in toxic
This commit is contained in:
parent
43d0d7a1c0
commit
c31cdf53eb
12
prompt.c
12
prompt.c
@ -358,8 +358,16 @@ static void execute(ToxWindow *self, Messenger *m, char *u_cmd)
|
|||||||
int numargs = 0;
|
int numargs = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAX_STR_SIZE; i++) {
|
for (i = 0; i < MAX_STR_SIZE; i++) {
|
||||||
if (cmd[i] == '\"')
|
char quote_chr;
|
||||||
while (cmd[++i] != '\"'); /* skip over strings */
|
if (cmd[i] == '\"' || cmd[i] == '\'') {
|
||||||
|
quote_chr = cmd[i];
|
||||||
|
while (cmd[++i] != quote_chr && i < MAX_STR_SIZE); /* skip over strings */
|
||||||
|
/* Check if got qoute character */
|
||||||
|
if (cmd[i] != quote_chr) {
|
||||||
|
wprintw(self->window, "Missing terminating %c character\n", quote_chr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd[i] == ' ') {
|
if (cmd[i] == ' ') {
|
||||||
cmd[i] = '\0';
|
cmd[i] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user