diff options
author | Jonas Wielicki <j.wielicki@sotecware.net> | 2018-07-25 17:29:31 +0200 |
---|---|---|
committer | Jonas Wielicki <j.wielicki@sotecware.net> | 2018-07-25 17:29:31 +0200 |
commit | dcdc0a7ce4624c0123450f1d282a98d6ece3ad1f (patch) | |
tree | c0c1af36c4402faf2b2d0d292be604a83579dfb1 | |
parent | bcb6339dd1d59c08d38d0fff6df5b9617898b7ad (diff) | |
parent | 4cf1debf9e1e92a2a391eda44857d5939f16d5ff (diff) |
Merge commit 'refs/pull/4/head' of https://github.com/horazont/xmpp-echo-bot
-rwxr-xr-x | echoz.sh | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -euf thisdir="$(dirname "$0")" pipename="${XDG_RUNTIME_DIR:-/tmp}/echoz-$$.pipe" @@ -9,11 +9,11 @@ domain="$(echo "$jid" | sed 's/.*@//')" srv="$( ( dig +short SRV "_xmpp-client._tcp.$domain" || echo "0 0 5222 $domain" ) | sort -n | sed 's/[[:digit:]]\+[[:space:]][[:digit:]]\+[[:space:]]//')" host="$(echo "$srv" | sed 's/[[:digit:]]\+[[:space:]]//')" port="$(echo "$srv" | sed 's/[[:space:]].*//')" -authstr="$(echo -ne "\0$username\0$password" | base64)" +authstr="$(printf '\0%s\0%s' "$username" "$password" | base64)" rm -f "$pipename" mkfifo "$pipename" DEBUG_PATH=${DEBUG_PATH:-} -if [[ "x$DEBUG_PATH" != "x" ]]; then +if [ "x$DEBUG_PATH" != "x" ]; then debug_recv="${DEBUG_PATH}recv.xml" debug_sent="${DEBUG_PATH}sent.xml" rm -f "$debug_sent" "$debug_recv" @@ -28,7 +28,7 @@ stdbuf -i0 -o0 \ -connect "$host:$port" \ -quiet \ < "$pipename" \ - | (echo -ne "$jid $authstr\n"; \ + | (printf '%s %s\n' "$jid" "$authstr"; \ stdbuf -o0 tr '>\n' '\n\001') \ | stdbuf -o0 tee "$debug_recv" \ | stdbuf -o0 "$thisdir/echoz.sed" \ |