diff options
author | Jonas Wielicki <j.wielicki@sotecware.net> | 2018-04-26 20:30:35 +0200 |
---|---|---|
committer | Jonas Wielicki <j.wielicki@sotecware.net> | 2018-04-26 20:30:35 +0200 |
commit | 562390f364b61bcaedbc635dc524f3e90efe14a6 (patch) | |
tree | 8e049ce048a04679a4b67148707d5ce078084ca9 /echoz.sh | |
parent | 9ff5b783cff841bedb0ff28e1eea797598e4c817 (diff) |
Proper switch for debug mode
Diffstat (limited to 'echoz.sh')
-rwxr-xr-x | echoz.sh | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -12,6 +12,15 @@ port="$(echo "$srv" | cut -d' ' -f3)" authstr="$(echo -ne "\0$username\0$password" | base64)" rm -f "$pipename" mkfifo "$pipename" +DEBUG_PATH=${DEBUG_PATH:-} +if [[ "x$DEBUG_PATH" != "x" ]]; then + debug_recv="${DEBUG_PATH}recv.xml" + debug_sent="${DEBUG_PATH}sent.xml" + rm -f "$debug_sent" "$debug_recv" +else + debug_recv=/dev/null + debug_sent=/dev/null +fi stdbuf -i0 -o0 \ openssl s_client \ -starttls xmpp \ @@ -21,7 +30,9 @@ stdbuf -i0 -o0 \ < "$pipename" \ | (echo -ne "$jid $authstr\n"; \ stdbuf -o0 tr '>\n' '\n\001') \ + | stdbuf -o0 tee "$debug_recv" \ | stdbuf -o0 "$thisdir/echoz.sed" \ + | stdbuf -o0 tee "$debug_sent" \ | stdbuf -o0 tr -d '\n' \ | stdbuf -o0 tr '\001' '\n' \ > "$pipename" |