]> granicus.if.org Git - ejabberd/commitdiff
Allow to pass \n in argument to ejabberdctl
authorPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 12 Feb 2016 22:37:48 +0000 (23:37 +0100)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 12 Feb 2016 22:38:39 +0000 (23:38 +0100)
ejabberdctl.template
src/ejabberd_ctl.erl

index d585d66f76886d5889d55a5306f3ded58dc0b65a..0d1a642923abaa62ae53b4a1bcc24545662282fe 100755 (executable)
@@ -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
 }
 
index 2bf20c2e72d27a98de292a5cae5edb05f4d8cc93..9ff30d7ff2df8a5f787174f1190fb43219c206dc 100644 (file)
@@ -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) ->