From 658a4ecfdf660274dbfa9eaaa80f2a97ee7917ab Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 15 Mar 2017 01:16:08 +0100 Subject: rename executable to htgen --- htgen | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ htgen-plain | 94 ------------------------------------------------------------- 2 files changed, 94 insertions(+), 94 deletions(-) create mode 100755 htgen delete mode 100755 htgen-plain diff --git a/htgen b/htgen new file mode 100755 index 0000000..659576f --- /dev/null +++ b/htgen @@ -0,0 +1,94 @@ +#! /bin/sh +# vim:set fdm=marker: +set -euf + +Server='htgen-plain/1.0' + +## htgen --serve {{{ +case $# in + (1) + case "$1" in + (--serve) + HTGEN_HOST="${HTGEN_HOST-0.0.0.0}" + HTGEN_PORT="${HTGEN_PORT-42380}" + TCPSERVER_OPTS='-c 423 -t 2 -D' + echo "#### $Server $HTGEN_HOST:$HTGEN_PORT" >&2 + exec tcpserver $TCPSERVER_OPTS "$HTGEN_HOST" "$HTGEN_PORT" "$0" + ## this should not happen... + exit 23 + esac +esac +## }}} + +## reply_404 {{{ +reply_404() { + cat<&2<&2 +# cat>&2<&2<&2 + +## Parse HTTP_Headers into Variables. +eval "$( +echo "$HTTP_Headers" | sed -r ' + ## TODO concatenate lines + /^[^:]+-[^:]+:/s/^([a-zA-Z-]+):[[:space:]]*([^'\'']*)*$/\ + x=`echo \1 | tr - _`; \ + echo $x=\\'\'''\''\2'\''\\'\''\\;;\ + echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}$x\\;;\ + /;t + s/^([a-zA-Z]+):[[:space:]]*([^'\'']*)*$/\ + echo \1=\\'\'''\''\2'\''\\'\''\\;;\ + echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}\1\\;;\ + /;t + s/^.*/# &/ + '| sh)" >&2 + +echo >&2 +## }}} + +reply_404 +exit diff --git a/htgen-plain b/htgen-plain deleted file mode 100755 index 659576f..0000000 --- a/htgen-plain +++ /dev/null @@ -1,94 +0,0 @@ -#! /bin/sh -# vim:set fdm=marker: -set -euf - -Server='htgen-plain/1.0' - -## htgen --serve {{{ -case $# in - (1) - case "$1" in - (--serve) - HTGEN_HOST="${HTGEN_HOST-0.0.0.0}" - HTGEN_PORT="${HTGEN_PORT-42380}" - TCPSERVER_OPTS='-c 423 -t 2 -D' - echo "#### $Server $HTGEN_HOST:$HTGEN_PORT" >&2 - exec tcpserver $TCPSERVER_OPTS "$HTGEN_HOST" "$HTGEN_PORT" "$0" - ## this should not happen... - exit 23 - esac -esac -## }}} - -## reply_404 {{{ -reply_404() { - cat<&2<&2 -# cat>&2<&2<&2 - -## Parse HTTP_Headers into Variables. -eval "$( -echo "$HTTP_Headers" | sed -r ' - ## TODO concatenate lines - /^[^:]+-[^:]+:/s/^([a-zA-Z-]+):[[:space:]]*([^'\'']*)*$/\ - x=`echo \1 | tr - _`; \ - echo $x=\\'\'''\''\2'\''\\'\''\\;;\ - echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}$x\\;;\ - /;t - s/^([a-zA-Z]+):[[:space:]]*([^'\'']*)*$/\ - echo \1=\\'\'''\''\2'\''\\'\''\\;;\ - echo HTTP_Header_Variables=\\\${HTTP_Header_Variables+\\\$HTTP_Header_Variables:}\1\\;;\ - /;t - s/^.*/# &/ - '| sh)" >&2 - -echo >&2 -## }}} - -reply_404 -exit -- cgit v1.2.3