From 47a67c7320089be64697232ccd218bc3c10ba508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Fri, 12 Feb 2016 23:37:48 +0100 Subject: [PATCH] Allow to pass \n in argument to ejabberdctl --- ejabberdctl.template | 6 +++++- src/ejabberd_ctl.erl | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ejabberdctl.template b/ejabberdctl.template index d585d66f7..0d1a64292 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -163,7 +163,11 @@ shell_escape() { local RES=() for i in "$@"; do - printf '%q ' "$i" + if test -z "$i"; then + printf '"" ' + else + printf '"%q" ' "$i" | sed 's/\\\\n/\n/g;s/\\\\t/\t/g;s/\\\\r/\r/g' + fi done } diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index 2bf20c2e7..9ff30d7ff 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -324,7 +324,7 @@ format_args(Args, ArgsFormat) -> format_arg(Arg, integer) -> format_arg2(Arg, "~d"); format_arg(Arg, binary) -> - list_to_binary(format_arg(Arg, string)); + unicode:characters_to_binary(Arg, utf8); format_arg("", string) -> ""; format_arg(Arg, string) ->