summaryrefslogtreecommitdiff
path: root/src/plugins/exec/exec.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-03-25 09:25:47 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-03-25 09:25:47 +0100
commit8deb0d3612327ba4ca2d0d4f8ae6dc2797915fe8 (patch)
tree6e2afcd9f0c6cb22af6f16e05b0ca760725c07c1 /src/plugins/exec/exec.c
parent966a2f4fb4cd3a3b1acb2e0fff1dc9f2ea455821 (diff)
downloadweechat-8deb0d3612327ba4ca2d0d4f8ae6dc2797915fe8.zip
exec: add options -nf and -cl/-nocl in command /exec
-nf: create a new buffer with free content -cl: clear new buffer -nocl: append in new buffer
Diffstat (limited to 'src/plugins/exec/exec.c')
-rw-r--r--src/plugins/exec/exec.c63
1 files changed, 49 insertions, 14 deletions
diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c
index 93fc18693..a91e52e62 100644
--- a/src/plugins/exec/exec.c
+++ b/src/plugins/exec/exec.c
@@ -352,11 +352,22 @@ exec_display_output (struct t_exec_cmd *exec_cmd,
"exec_%s,exec_cmd_%s",
(out) ? "stdout" : "stderr",
(exec_cmd->name) ? exec_cmd->name : str_number);
- snprintf (str_number, sizeof (str_number), "%d\t", line_nb);
- weechat_printf_tags (buffer, str_tags,
- "%s%s",
- (exec_cmd->line_numbers) ? str_number : " \t",
- line);
+ if (weechat_buffer_get_integer (buffer, "type") == 1)
+ {
+ snprintf (str_number, sizeof (str_number), "%d. ", line_nb);
+ weechat_printf_y (buffer, -1,
+ "%s%s",
+ (exec_cmd->line_numbers) ? str_number : " ",
+ line);
+ }
+ else
+ {
+ snprintf (str_number, sizeof (str_number), "%d\t", line_nb);
+ weechat_printf_tags (buffer, str_tags,
+ "%s%s",
+ (exec_cmd->line_numbers) ? str_number : " \t",
+ line);
+ }
}
free (line);
@@ -375,6 +386,7 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *hashtable;
char str_number[32], *output;
+ int buffer_type;
if (exec_cmd->hsignal)
{
@@ -418,21 +430,44 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
&& !exec_cmd->detached && !exec_cmd->output_to_buffer
&& !exec_cmd->pipe_command)
{
+ buffer_type = weechat_buffer_get_integer (ptr_buffer, "type");
if (return_code >= 0)
{
- weechat_printf_tags (ptr_buffer, "exec_rc",
- _("%s: end of command %d (\"%s\"), "
+ if (buffer_type == 1)
+ {
+ weechat_printf_y (ptr_buffer, -1,
+ ("%s: end of command %d (\"%s\"), "
"return code: %d"),
- EXEC_PLUGIN_NAME, exec_cmd->number,
- exec_cmd->command, return_code);
+ EXEC_PLUGIN_NAME, exec_cmd->number,
+ exec_cmd->command, return_code);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_buffer, "exec_rc",
+ _("%s: end of command %d (\"%s\"), "
+ "return code: %d"),
+ EXEC_PLUGIN_NAME, exec_cmd->number,
+ exec_cmd->command, return_code);
+ }
}
else
{
- weechat_printf_tags (ptr_buffer, "exec_rc",
- _("%s: unexpected end of command %d "
- "(\"%s\")"),
- EXEC_PLUGIN_NAME, exec_cmd->number,
- exec_cmd->command);
+ if (buffer_type == 1)
+ {
+ weechat_printf_y (ptr_buffer, -1,
+ _("%s: unexpected end of command %d "
+ "(\"%s\")"),
+ EXEC_PLUGIN_NAME, exec_cmd->number,
+ exec_cmd->command);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_buffer, "exec_rc",
+ _("%s: unexpected end of command %d "
+ "(\"%s\")"),
+ EXEC_PLUGIN_NAME, exec_cmd->number,
+ exec_cmd->command);
+ }
}
}
}