diff options
author | tv <tv@krebsco.de> | 2020-09-15 20:57:00 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-09-15 20:57:21 +0200 |
commit | 2922721e2d3de6ff959d352e32ff8f4f9d8cbe7d (patch) | |
tree | bdb60d816e9d6c29a82d38e24af98c3ad5dc5f4b | |
parent | a20725518fead2694f62fa2a7ae5e08ece7915bf (diff) |
-rwxr-xr-x | htgen | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -6,9 +6,11 @@ Server=htgen ## parse arguments {{{ action=handle_request +verbose=${HTGEN_VERBOSE-false} while test $# -gt 0; do case $1 in) --serve) action=serve; shift; continue;; + --verbose) verbose=true; shift; continue;; *) echo "$0: error: bad argument: $1" >&2; exit 1;; esac done @@ -22,6 +24,7 @@ case $action in HTGEN_HOST=${HTGEN_HOST-0.0.0.0} HTGEN_PORT=${HTGEN_PORT-42380} HTGEN_SCRIPT=${HTGEN_SCRIPT-:} + HTGEN_VERBOSE=$verbose; export HTGEN_VERBOSE TCPSERVER_OPTS='-c 423 -t 2 -D' echo "#### $Server $HTGEN_HOST:$HTGEN_PORT" >&2 exec tcpserver $TCPSERVER_OPTS "$HTGEN_HOST" "$HTGEN_PORT" "$0" @@ -94,7 +97,9 @@ while read -r line; do k=req_$k v=${line#*:} v=${v## } - printf '[35m%s=[1m%s[m\n' "$k" "$v" >&2 + if test "$HTGEN_VERBOSE" = true; then + printf '[35m%s=[1m%s[m\n' "$k" "$v" >&2 + fi export "$k=$v" ;; esac |