summaryrefslogtreecommitdiff
path: root/src/plugins/exec
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/exec')
-rw-r--r--src/plugins/exec/CMakeLists.txt2
-rw-r--r--src/plugins/exec/Makefile.am2
-rw-r--r--src/plugins/exec/exec-buffer.c2
-rw-r--r--src/plugins/exec/exec-buffer.h8
-rw-r--r--src/plugins/exec/exec-command.c19
-rw-r--r--src/plugins/exec/exec-command.h8
-rw-r--r--src/plugins/exec/exec-completion.c2
-rw-r--r--src/plugins/exec/exec-completion.h8
-rw-r--r--src/plugins/exec/exec-config.c4
-rw-r--r--src/plugins/exec/exec-config.h8
-rw-r--r--src/plugins/exec/exec.c8
-rw-r--r--src/plugins/exec/exec.h8
12 files changed, 42 insertions, 37 deletions
diff --git a/src/plugins/exec/CMakeLists.txt b/src/plugins/exec/CMakeLists.txt
index 470087194..54d04a38a 100644
--- a/src/plugins/exec/CMakeLists.txt
+++ b/src/plugins/exec/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
diff --git a/src/plugins/exec/Makefile.am b/src/plugins/exec/Makefile.am
index 552a79443..de3101972 100644
--- a/src/plugins/exec/Makefile.am
+++ b/src/plugins/exec/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c
index 936d7e52d..6ec89f408 100644
--- a/src/plugins/exec/exec-buffer.c
+++ b/src/plugins/exec/exec-buffer.c
@@ -1,7 +1,7 @@
/*
* exec-buffer.c - buffers with output of commands
*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
diff --git a/src/plugins/exec/exec-buffer.h b/src/plugins/exec/exec-buffer.h
index 1877ec04c..7cd2e1c62 100644
--- a/src/plugins/exec/exec-buffer.h
+++ b/src/plugins/exec/exec-buffer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,8 +17,8 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_EXEC_BUFFER_H
-#define WEECHAT_EXEC_BUFFER_H 1
+#ifndef WEECHAT_PLUGIN_EXEC_BUFFER_H
+#define WEECHAT_PLUGIN_EXEC_BUFFER_H
extern void exec_buffer_set_callbacks ();
extern struct t_gui_buffer *exec_buffer_new (const char *name,
@@ -26,4 +26,4 @@ extern struct t_gui_buffer *exec_buffer_new (const char *name,
int clear_buffer,
int switch_to_buffer);
-#endif /* WEECHAT_EXEC_BUFFER_H */
+#endif /* WEECHAT_PLUGIN_EXEC_BUFFER_H */
diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c
index bcb82e994..1ba3bf53c 100644
--- a/src/plugins/exec/exec-command.c
+++ b/src/plugins/exec/exec-command.c
@@ -1,7 +1,7 @@
/*
* exec-command.c - exec command
*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -108,11 +108,13 @@ exec_command_list ()
{
/* process has ended */
local_time = localtime (&ptr_exec_cmd->start_time);
- strftime (str_time1, sizeof (str_time1),
- "%Y-%m-%d %H:%M:%S", local_time);
+ if (strftime (str_time1, sizeof (str_time1),
+ "%Y-%m-%d %H:%M:%S", local_time) == 0)
+ str_time1[0] = '\0';
local_time = localtime (&ptr_exec_cmd->end_time);
- strftime (str_time2, sizeof (str_time2),
- "%Y-%m-%d %H:%M:%S", local_time);
+ if (strftime (str_time2, sizeof (str_time2),
+ "%Y-%m-%d %H:%M:%S", local_time) == 0)
+ str_time2[0] = '\0';
weechat_printf (NULL,
" %s%s%s %d%s%s%s: %s\"%s%s%s\"%s (%s -> %s, %s)",
weechat_color (weechat_config_string (exec_config_color_flag_finished)),
@@ -333,7 +335,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
if (argv[i][0] == '"')
{
/* search the ending double quote */
- length_total = 1;
+ length_total = 2;
end = i;
while (end < argc)
{
@@ -807,8 +809,9 @@ exec_command_init ()
" || -set <id> <property> <value>"
" || -del <id>|-all [<id>...]"),
N_(" -list: list commands\n"
- " -sh: use the shell to execute the command (WARNING: use this "
- "option ONLY if all arguments are safe, see option -nosh)\n"
+ " -sh: use the shell to execute the command, many commands can "
+ "be piped (WARNING: use this option ONLY if all arguments are "
+ "safe, see option -nosh)\n"
" -nosh: do not use the shell to execute the command (required if "
"the command has some unsafe data, for example the content of a "
"message from another user) (default)\n"
diff --git a/src/plugins/exec/exec-command.h b/src/plugins/exec/exec-command.h
index 06be3ae4a..a15708e8f 100644
--- a/src/plugins/exec/exec-command.h
+++ b/src/plugins/exec/exec-command.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,8 +17,8 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_EXEC_COMMAND_H
-#define WEECHAT_EXEC_COMMAND_H 1
+#ifndef WEECHAT_PLUGIN_EXEC_COMMAND_H
+#define WEECHAT_PLUGIN_EXEC_COMMAND_H
struct t_exec_cmd_options
{
@@ -48,4 +48,4 @@ extern int exec_command_run (struct t_gui_buffer *buffer,
int start_arg);
extern void exec_command_init ();
-#endif /* WEECHAT_EXEC_COMMAND_H */
+#endif /* WEECHAT_PLUGIN_EXEC_COMMAND_H */
diff --git a/src/plugins/exec/exec-completion.c b/src/plugins/exec/exec-completion.c
index 520915851..52f034c94 100644
--- a/src/plugins/exec/exec-completion.c
+++ b/src/plugins/exec/exec-completion.c
@@ -1,7 +1,7 @@
/*
* exec-completion.c - completion for exec commands
*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
diff --git a/src/plugins/exec/exec-completion.h b/src/plugins/exec/exec-completion.h
index c44fabad9..b9cdc0b62 100644
--- a/src/plugins/exec/exec-completion.h
+++ b/src/plugins/exec/exec-completion.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,9 +17,9 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_EXEC_COMPLETION_H
-#define WEECHAT_EXEC_COMPLETION_H 1
+#ifndef WEECHAT_PLUGIN_EXEC_COMPLETION_H
+#define WEECHAT_PLUGIN_EXEC_COMPLETION_H
extern void exec_completion_init ();
-#endif /* WEECHAT_EXEC_COMPLETION_H */
+#endif /* WEECHAT_PLUGIN_EXEC_COMPLETION_H */
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index e8accdcd8..43693aa47 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -1,7 +1,7 @@
/*
* exec-config.c - exec configuration options (file exec.conf)
*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -109,6 +109,7 @@ exec_config_init ()
if (!ptr_section)
{
weechat_config_free (exec_config_file);
+ exec_config_file = NULL;
return 0;
}
@@ -141,6 +142,7 @@ exec_config_init ()
if (!ptr_section)
{
weechat_config_free (exec_config_file);
+ exec_config_file = NULL;
return 0;
}
diff --git a/src/plugins/exec/exec-config.h b/src/plugins/exec/exec-config.h
index 667b6e48f..537597c11 100644
--- a/src/plugins/exec/exec-config.h
+++ b/src/plugins/exec/exec-config.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,8 +17,8 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_EXEC_CONFIG_H
-#define WEECHAT_EXEC_CONFIG_H 1
+#ifndef WEECHAT_PLUGIN_EXEC_CONFIG_H
+#define WEECHAT_PLUGIN_EXEC_CONFIG_H
#define EXEC_CONFIG_NAME "exec"
@@ -38,4 +38,4 @@ extern int exec_config_read ();
extern int exec_config_write ();
extern void exec_config_free ();
-#endif /* WEECHAT_EXEC_CONFIG_H */
+#endif /* WEECHAT_PLUGIN_EXEC_CONFIG_H */
diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c
index 10fbd6386..d40188396 100644
--- a/src/plugins/exec/exec.c
+++ b/src/plugins/exec/exec.c
@@ -1,7 +1,7 @@
/*
* exec.c - execution of external commands in WeeChat
*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -37,7 +37,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Execution of external commands in WeeChat"));
WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE);
-WEECHAT_PLUGIN_PRIORITY(12000);
+WEECHAT_PLUGIN_PRIORITY(13000);
struct t_weechat_plugin *weechat_exec_plugin = NULL;
@@ -691,8 +691,8 @@ exec_print_log ()
weechat_log_printf (" command . . . . . . . . . : '%s'", ptr_exec_cmd->command);
weechat_log_printf (" pid . . . . . . . . . . . : %d", ptr_exec_cmd->pid);
weechat_log_printf (" detached. . . . . . . . . : %d", ptr_exec_cmd->detached);
- weechat_log_printf (" start_time. . . . . . . . : %ld", ptr_exec_cmd->start_time);
- weechat_log_printf (" end_time. . . . . . . . . : %ld", ptr_exec_cmd->end_time);
+ weechat_log_printf (" start_time. . . . . . . . : %lld", (long long)ptr_exec_cmd->start_time);
+ weechat_log_printf (" end_time. . . . . . . . . : %lld", (long long)ptr_exec_cmd->end_time);
weechat_log_printf (" output_to_buffer. . . . . : %d", ptr_exec_cmd->output_to_buffer);
weechat_log_printf (" output_to_buffer_exec_cmd : %d", ptr_exec_cmd->output_to_buffer_exec_cmd);
weechat_log_printf (" buffer_full_name. . . . . : '%s'", ptr_exec_cmd->buffer_full_name);
diff --git a/src/plugins/exec/exec.h b/src/plugins/exec/exec.h
index 31003773c..c333a0dd9 100644
--- a/src/plugins/exec/exec.h
+++ b/src/plugins/exec/exec.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,8 +17,8 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_EXEC_H
-#define WEECHAT_EXEC_H 1
+#ifndef WEECHAT_PLUGIN_EXEC_H
+#define WEECHAT_PLUGIN_EXEC_H
#include <unistd.h>
#include <time.h>
@@ -88,4 +88,4 @@ extern int exec_process_cb (const void *pointer, void *data,
extern void exec_free (struct t_exec_cmd *exec_cmd);
extern void exec_free_all ();
-#endif /* WEECHAT_EXEC_H */
+#endif /* WEECHAT_PLUGIN_EXEC_H */