core: split startup command before evaluating it (issue #1643)

This commit is contained in:
Sébastien Helleu 2021-05-22 08:27:27 +02:00
parent e350437c81
commit b74af1d2da
4 changed files with 18 additions and 17 deletions

View File

@ -45,6 +45,7 @@ New features::
Bug fixes::
* core: split startup command before evaluating it (issue #1643)
* core: set server name when connecting to server with TLS (SNI extension) only if it's not an IPV4/IPv6 (issue #1635)
* core: use function mallinfo2 instead of mallinfo when available (issue #1636)
* core: display a warning when the file with certificate authorities is not found (option weechat.network.gnutls_ca_file)

View File

@ -8519,28 +8519,26 @@ command_init ()
void
command_exec_list (const char *command_list)
{
char *command_list2, **commands, **ptr_cmd;
struct t_gui_buffer *weechat_buffer;
char **commands, **ptr_command, *command_eval;
if (!command_list || !command_list[0])
return;
command_list2 = eval_expression (command_list, NULL, NULL, NULL);
if (command_list2 && command_list2[0])
commands = string_split_command (command_list, ';');
if (commands)
{
commands = string_split_command (command_list2, ';');
if (commands)
for (ptr_command = commands; *ptr_command; ptr_command++)
{
weechat_buffer = gui_buffer_search_main ();
for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++)
command_eval = eval_expression (*ptr_command, NULL, NULL, NULL);
if (command_eval)
{
(void) input_data (weechat_buffer, *ptr_cmd, NULL);
(void) input_data (gui_buffer_search_main (),
command_eval, NULL);
free (command_eval);
}
string_free_split_command (commands);
}
string_free_split_command (commands);
}
if (command_list2)
free (command_list2);
}
/*

View File

@ -2552,15 +2552,17 @@ config_weechat_init_options ()
config_startup_command_after_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"command_after_plugins", "string",
N_("command executed when WeeChat starts, after loading plugins "
"(note: content is evaluated, see /help eval)"),
N_("command executed when WeeChat starts, after loading plugins; "
"multiple commands can be separated by semicolons "
"(note: commands are evaluated, see /help eval)"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_command_before_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"command_before_plugins", "string",
N_("command executed when WeeChat starts, before loading plugins "
"(note: content is evaluated, see /help eval)"),
N_("command executed when WeeChat starts, before loading plugins; "
"multiple commands can be separated by semicolons "
"(note: commands are evaluated, see /help eval)"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_startup_display_logo = config_file_new_option (

View File

@ -183,7 +183,7 @@ weechat_display_usage ()
" (see /help weechat.plugin.autoload)\n"
" -r, --run-command <cmd> run command(s) after startup;\n"
" many commands can be separated by "
"semicolons,\n"
"semicolons and are evaluated,\n"
" this option can be given multiple "
"times\n"
" -s, --no-script don't load any script at startup\n"