summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-02-17 11:12:36 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-02-17 11:12:36 +0100
commit652ec2444996580bfcabcb9583f85d77aaad555a (patch)
tree71d52207a89f9c8be45cc060102abf59dabc461c /src
parent45db2e966879832b6e412bdff3a87e0c0708a51b (diff)
downloadweechat-652ec2444996580bfcabcb9583f85d77aaad555a.zip
core: allow empty arguments for command /print
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index c3e6ea0d5..fa9061eb8 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -4198,9 +4198,6 @@ COMMAND_CALLBACK(print)
/* make C compiler happy */
(void) data;
- if (argc < 2)
- return WEECHAT_RC_OK;
-
ptr_buffer = buffer;
date = 0;
tags = NULL;
@@ -4312,12 +4309,9 @@ COMMAND_CALLBACK(print)
break;
}
- if (i >= argc)
- return WEECHAT_RC_OK;
-
if (to_stdout || to_stderr)
{
- text = string_convert_escaped_chars (argv_eol[i]);
+ text = string_convert_escaped_chars ((i < argc) ? argv_eol[i] : "");
if (text)
{
fprintf ((to_stdout) ? stdout : stderr, "%s", text);
@@ -4326,7 +4320,7 @@ COMMAND_CALLBACK(print)
}
else
{
- text = strdup (argv_eol[i]);
+ text = strdup ((i < argc) ? argv_eol[i] : "");
if (text)
{
pos = NULL;
@@ -7110,8 +7104,8 @@ command_init ()
NULL, "print",
N_("display text on a buffer"),
N_("[-buffer <number>|<name>] [-core] [-escape] [-date <date>] "
- "[-tags <tags>] [-action|-error|-join|-network|-quit] <text>"
- " || -stdout|-stderr <text>"),
+ "[-tags <tags>] [-action|-error|-join|-network|-quit] [<text>]"
+ " || -stdout|-stderr [<text>]"),
N_("-buffer: the buffer where text is displayed (default: current "
"buffer)\n"
" -core: alias of \"-buffer core.weechat\"\n"