summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-02-26 11:36:41 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-02-26 11:36:41 +0100
commit873bcfc9f05c3bd6f15b6f1a16cdabe5d164c787 (patch)
treea135bede8ffdfe95b2e8faa8ad968434aa37e318 /src
parenteabf21098d88061799709b9ff3cf5eeb90029dd6 (diff)
downloadweechat-873bcfc9f05c3bd6f15b6f1a16cdabe5d164c787.zip
Add command line option "-s" (or "--no-script") to start WeeChat without loading any script
Diffstat (limited to 'src')
-rw-r--r--src/core/weechat.c1
-rw-r--r--src/plugins/plugin.c10
-rw-r--r--src/plugins/scripts/script.c25
3 files changed, 26 insertions, 10 deletions
diff --git a/src/core/weechat.c b/src/core/weechat.c
index 177b2fc42..a1f603be5 100644
--- a/src/core/weechat.c
+++ b/src/core/weechat.c
@@ -111,6 +111,7 @@ weechat_display_usage (char *exec_name)
" -k, --keys display WeeChat default keys\n"
" -l, --license display WeeChat license\n"
" -p, --no-plugin don't load any plugin at startup\n"
+ " -s, --no-script don't load any script at startup\n"
" -v, --version display WeeChat version\n"
" plugin:option option for plugin\n"
" for example, irc plugin can connect\n"
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 5cebfe8ea..38e72c022 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -586,10 +586,12 @@ plugin_load (const char *filename)
argc = 0;
for (i = 0; i < plugin_argc; i++)
{
- if ((string_strcasecmp (plugin_argv[i], "-a") == 0)
- || (string_strcasecmp (plugin_argv[i], "--no-connect") == 0)
- || (string_strcasecmp (plugin_argv[i], "--upgrade") == 0)
- || (string_strncasecmp (plugin_argv[i], name, strlen (name)) == 0))
+ if ((strcmp (plugin_argv[i], "-a") == 0)
+ || (strcmp (plugin_argv[i], "--no-connect") == 0)
+ || (strcmp (plugin_argv[i], "-s") == 0)
+ || (strcmp (plugin_argv[i], "--no-script") == 0)
+ || (strcmp (plugin_argv[i], "--upgrade") == 0)
+ || (strncmp (plugin_argv[i], name, strlen (name)) == 0))
{
argv[argc] = plugin_argv[i];
argc++;
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index b08f4df98..20b8712fe 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -209,7 +209,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
{
char *string, *completion;
char signal_name[128];
- int length, i, upgrading;
+ int length, i, upgrading, auto_load_scripts;
/* read script configuration */
script_config_read (weechat_plugin);
@@ -298,16 +298,29 @@ script_init (struct t_weechat_plugin *weechat_plugin,
weechat_plugin->name);
weechat_hook_signal (signal_name, callback_signal_script_action, NULL);
- /* autoload scripts */
- script_auto_load (weechat_plugin, callback_load_file);
-
- /* actions after upgrade */
+ /* parse arguments */
upgrading = 0;
+ auto_load_scripts = 1;
for (i = 0; i < argc; i++)
{
- if (weechat_strcasecmp (argv[i], "--upgrade") == 0)
+ if (strcmp (argv[i], "--upgrade") == 0)
+ {
upgrading = 1;
+ }
+ else if ((strcmp (argv[i], "-s") == 0)
+ || (strcmp (argv[i], "--no-script") == 0))
+ {
+ auto_load_scripts = 0;
+ }
}
+
+ /* autoload scripts */
+ if (auto_load_scripts)
+ {
+ script_auto_load (weechat_plugin, callback_load_file);
+ }
+
+ /* set buffer callbacks after upgrade */
if (upgrading)
{
script_upgrade_set_buffer_callbacks (weechat_plugin,