1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Merge branch 'master' into write

This commit is contained in:
Witold Filipczyk 2022-11-17 16:18:02 +01:00
commit 5c6cc6cbf9

View File

@ -112,19 +112,32 @@ exmode_exec(struct session *ses, char buffer[INPUT_LINE_BUFFER_SIZE])
void void
try_exmode_exec(struct session *ses, const char *val) try_exmode_exec(struct session *ses, const char *val)
{ {
char *buffer = stracpy(val); char *command;
char *args;
struct string res;
struct string inp;
struct string what = INIT_STRING("\\\"", 2);
struct string replace = INIT_STRING("\"", 1);
if (!buffer) { if (!val || !init_string(&res)) {
return; return;
} }
if (!init_string(&inp)) {
done_string(&res);
return;
}
add_to_string(&inp, val);
string_replace(&res, &inp, &what, &replace);
char *command = buffer; command = res.source;
char *args = command; args = command;
int i; int i;
while (*command == ':') command++; while (*command == ':') command++;
if (!*command) return; if (!*command) {
goto out;
}
skip_nonspace(args); skip_nonspace(args);
if (*args) *args++ = 0; if (*args) *args++ = 0;
@ -133,8 +146,9 @@ try_exmode_exec(struct session *ses, const char *val)
if (exmode_handlers[i](ses, command, args)) if (exmode_handlers[i](ses, command, args))
break; break;
} }
out:
mem_free(buffer); done_string(&inp);
done_string(&res);
} }
static enum input_line_code static enum input_line_code