diff --git a/ChangeLog.adoc b/ChangeLog.adoc index d002ce669..b5dfeea5c 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] New features:: + * core: allow multiple options "-r" ("--run-command") in command line arguments (issue #1248) * core: add option "-P" (or "--plugins") to customize the plugins to load at startup * core: allow partial buffer name in command /buffer close (issue #1226) * api: add function hook_line diff --git a/doc/cs/cmdline_options.cs.adoc b/doc/cs/cmdline_options.cs.adoc index 95515205e..3331559cd 100644 --- a/doc/cs/cmdline_options.cs.adoc +++ b/doc/cs/cmdline_options.cs.adoc @@ -31,8 +31,10 @@ Load only these plugins at startup (see /help weechat.plugin.autoload). If this option is given, the option weechat.plugin.autoload is not used. +// TRANSLATION MISSING *-r*, *--run-command* __:: - Spustí příkaz(y) po startu (více přůkazů může být odděleno středníky). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Vypni automatické nahrání scriptů. diff --git a/doc/de/cmdline_options.de.adoc b/doc/de/cmdline_options.de.adoc index ebc16b995..213b9d8b6 100644 --- a/doc/de/cmdline_options.de.adoc +++ b/doc/de/cmdline_options.de.adoc @@ -28,9 +28,10 @@ lädt nur die angegebenen Erweiterungen, beim Start (siehe /help weechat.plugin.autoload). Wenn diese Option genutzt wird, dann wird die Option weechat.plugin.autoload ignoriert. +// TRANSLATION MISSING *-r*, *--run-command* __:: - führt einen oder mehrere Befehle aus, nachdem WeeChat gestartet wurde - (mehrere Befehle müssen durch Kommata voneinander getrennt werden). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Skripten werden beim Programmstart nicht geladen. diff --git a/doc/en/cmdline_options.en.adoc b/doc/en/cmdline_options.en.adoc index 0c7319d41..e09ff973c 100644 --- a/doc/en/cmdline_options.en.adoc +++ b/doc/en/cmdline_options.en.adoc @@ -29,7 +29,8 @@ If this option is given, the option weechat.plugin.autoload is not used. *-r*, *--run-command* __:: - Run command(s) after startup (many commands can be separated by semicolons). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Disable scripts auto-load. diff --git a/doc/fr/cmdline_options.fr.adoc b/doc/fr/cmdline_options.fr.adoc index 5f105e6b3..330709a06 100644 --- a/doc/fr/cmdline_options.fr.adoc +++ b/doc/fr/cmdline_options.fr.adoc @@ -30,8 +30,9 @@ Si cette option est donnée, l'option weechat.plugin.autoload n'est pas utilisée. *-r*, *--run-command* __:: - Lancer la/les commande(s) après le démarrage (plusieurs commandes peuvent - être séparées par des points-virgules). + Lancer la/les commande(s) après le démarrage ; plusieurs commandes peuvent + être séparées par des points-virgules, cette option peut être donnée + plusieurs fois. *-s*, *--no-script*:: Supprimer le chargement automatique des scripts au démarrage. diff --git a/doc/it/cmdline_options.it.adoc b/doc/it/cmdline_options.it.adoc index d16bdc2c2..294daf858 100644 --- a/doc/it/cmdline_options.it.adoc +++ b/doc/it/cmdline_options.it.adoc @@ -33,8 +33,8 @@ // TRANSLATION MISSING *-r*, *--run-command* __:: - Esegue un comando(i) dopo l'avvio (più comandi possono essere separati da - punto e virgola). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Disabilita il caricamento automatico dei script. diff --git a/doc/ja/cmdline_options.ja.adoc b/doc/ja/cmdline_options.ja.adoc index 05131cce4..20b2c3ef3 100644 --- a/doc/ja/cmdline_options.ja.adoc +++ b/doc/ja/cmdline_options.ja.adoc @@ -28,8 +28,10 @@ 起動時にロードするプラグインを指定 (/help weechat.plugin.autoload を参照してください)。 このオプションを使う場合、weechat.plugin.autoload オプションは無視されます。 +// TRANSLATION MISSING *-r*, *--run-command* __:: - 起動後にコマンドを実行 (複数のコマンドを指定するにはセミコロンで各コマンドを区切る) + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: スクリプトの自動ロードを止める diff --git a/doc/pl/cmdline_options.pl.adoc b/doc/pl/cmdline_options.pl.adoc index 2c1169e52..b85bf9b2b 100644 --- a/doc/pl/cmdline_options.pl.adoc +++ b/doc/pl/cmdline_options.pl.adoc @@ -28,8 +28,10 @@ Load only these plugins at startup (see /help weechat.plugin.autoload). If this option is given, the option weechat.plugin.autoload is not used. +// TRANSLATION MISSING *-r*, *--run-command* __:: - Wykonuje komendę(-y) po uruchomieniu (komendy należy oddzielać średnikiem). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Wyłącza automatyczne ładowanie skryptów. diff --git a/doc/ru/cmdline_options.ru.adoc b/doc/ru/cmdline_options.ru.adoc index 2aa4ed3d8..930b5a43c 100644 --- a/doc/ru/cmdline_options.ru.adoc +++ b/doc/ru/cmdline_options.ru.adoc @@ -31,9 +31,10 @@ Load only these plugins at startup (see /help weechat.plugin.autoload). If this option is given, the option weechat.plugin.autoload is not used. +// TRANSLATION MISSING *-r*, *--run-command* _<команда>_:: - Запустить команду (или команды) после загрузки WeeChat (несколько команд - можно записать через точку с запятой). + Run command(s) after startup; many commands can be separated by semicolons, + this option can be given multiple times. *-s*, *--no-script*:: Отключить автозагрузку скриптов. diff --git a/po/cs.po b/po/cs.po index 6a59712af..bc37cfce2 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:36+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -168,8 +168,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/de.po b/po/de.po index 315b34e4c..b08a80a29 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-08-20 20:39+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -163,6 +163,7 @@ msgstr "" msgid "Usage: %s [option...] [plugin:option...]\n" msgstr "Aufruf: %s [Option...] [Erweiterung:Option...]\n" +#, fuzzy msgid "" " -a, --no-connect disable auto-connect to servers at startup\n" " -c, --colors display default colors in terminal\n" @@ -174,8 +175,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/es.po b/po/es.po index 71ad5a34d..843521037 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:36+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -175,8 +175,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/fr.po b/po/fr.po index b9a7d3f18..5657d1d57 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" -"PO-Revision-Date: 2018-08-17 19:40+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" +"PO-Revision-Date: 2018-09-06 21:26+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -167,8 +167,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" @@ -187,9 +188,10 @@ msgstr "" " -p, --no-plugin ne charger aucune extension au démarrage\n" " -P, --plugins charger uniquement ces extensions au démarrage\n" " (voir /help weechat.plugin.autoload)\n" -" -r, --run-command lancer la/les commande(s) après le démarrage\n" -" (plusieurs commandes peuvent être séparées par " -"des points-virgules)\n" +" -r, --run-command lancer la/les commande(s) après le démarrage ;\n" +" plusieurs commandes peuvent être séparées par des " +"points-virgules,\n" +" cette option peut être donnée plusieurs fois\n" " -s, --no-script ne charger aucun script au démarrage\n" " --upgrade mettre à jour WeeChat en utilisant les fichiers " "de session (voir /help upgrade dans WeeChat)\n" diff --git a/po/hu.po b/po/hu.po index 4946da753..eb190c18a 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:36+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -174,8 +174,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/it.po b/po/it.po index fa4b50b99..df9585929 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:36+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -173,8 +173,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/ja.po b/po/ja.po index 347c14def..c7b811897 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-08-19 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/pl.po b/po/pl.po index a267fc8fa..fdf5846e6 100644 --- a/po/pl.po +++ b/po/pl.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-07-09 00:51+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: Polish \n" @@ -169,8 +169,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/pt.po b/po/pt.po index c65ad822e..5083421d2 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:36+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -168,8 +168,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 79e4f63d9..70416e8eb 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:37+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -201,8 +201,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/ru.po b/po/ru.po index d73bfca19..461f7d7f4 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2018-03-31 15:37+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -182,8 +182,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/tr.po b/po/tr.po index 45c9cae9c..c95a5e3f7 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2017-06-26 23:33+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -157,8 +157,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/po/weechat.pot b/po/weechat.pot index 7c261a953..06d456549 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2018-08-17 19:39+0200\n" +"POT-Creation-Date: 2018-09-06 13:44+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -155,8 +155,9 @@ msgid "" " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" -" -r, --run-command run command(s) after startup\n" -" (many commands can be separated by semicolons)\n" +" -r, --run-command run command(s) after startup;\n" +" many commands can be separated by semicolons,\n" +" this option can be given multiple times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files (see /help " "upgrade in WeeChat)\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 93ec84a56..938dd0bd9 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -8352,10 +8352,20 @@ command_exec_list (const char *command_list) void command_startup (int plugins_loaded) { + int i; + if (plugins_loaded) { command_exec_list (CONFIG_STRING(config_startup_command_after_plugins)); - command_exec_list (weechat_startup_commands); + if (weechat_startup_commands) + { + for (i = 0; i < weelist_size (weechat_startup_commands); i++) + { + command_exec_list ( + weelist_string ( + weelist_get (weechat_startup_commands, i))); + } + } } else command_exec_list (CONFIG_STRING(config_startup_command_before_plugins)); diff --git a/src/core/weechat.c b/src/core/weechat.c index 76a9b1849..35a08d98b 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -60,6 +60,7 @@ #include "wee-eval.h" #include "wee-hdata.h" #include "wee-hook.h" +#include "wee-list.h" #include "wee-log.h" #include "wee-network.h" #include "wee-proxy.h" @@ -102,7 +103,8 @@ int weechat_no_gnutls = 0; /* remove init/deinit of gnutls */ /* (useful with valgrind/electric-f.)*/ int weechat_no_gcrypt = 0; /* remove init/deinit of gcrypt */ /* (useful with valgrind) */ -char *weechat_startup_commands = NULL; /* startup commands (-r flag) */ +struct t_weelist *weechat_startup_commands = NULL; /* startup commands */ + /* (option -r) */ /* @@ -154,9 +156,11 @@ weechat_display_usage () " -p, --no-plugin don't load any plugin at startup\n" " -P, --plugins load only these plugins at startup\n" " (see /help weechat.plugin.autoload)\n" - " -r, --run-command run command(s) after startup\n" - " (many commands can be separated by " - "semicolons)\n" + " -r, --run-command run command(s) after startup;\n" + " many commands can be separated by " + "semicolons,\n" + " this option can be given multiple " + "times\n" " -s, --no-script don't load any script at startup\n" " --upgrade upgrade WeeChat using session files " "(see /help upgrade in WeeChat)\n" @@ -297,9 +301,10 @@ weechat_parse_args (int argc, char *argv[]) { if (i + 1 < argc) { - if (weechat_startup_commands) - free (weechat_startup_commands); - weechat_startup_commands = strdup (argv[++i]); + if (!weechat_startup_commands) + weechat_startup_commands = weelist_new (); + weelist_add (weechat_startup_commands, argv[++i], + WEECHAT_LIST_POS_END, NULL); } else { @@ -639,6 +644,8 @@ weechat_shutdown (int return_code, int crash) free (weechat_local_charset); if (weechat_force_plugin_autoload) free (weechat_force_plugin_autoload); + if (weechat_startup_commands) + weelist_free (weechat_startup_commands); if (crash) abort (); diff --git a/src/core/weechat.h b/src/core/weechat.h index 9420ff415..cbb565a03 100644 --- a/src/core/weechat.h +++ b/src/core/weechat.h @@ -96,6 +96,8 @@ /* name of environment variable with an extra lib dir */ #define WEECHAT_EXTRA_LIBDIR "WEECHAT_EXTRA_LIBDIR" +struct t_weelist; + /* global variables and functions */ extern int weechat_headless; extern int weechat_debug_core; @@ -112,7 +114,7 @@ extern char *weechat_local_charset; extern int weechat_plugin_no_dlclose; extern int weechat_no_gnutls; extern int weechat_no_gcrypt; -extern char *weechat_startup_commands; +extern struct t_weelist *weechat_startup_commands; extern void weechat_term_check (); extern void weechat_shutdown (int return_code, int crash);