From 3f6b64304a8a11f0505e91681384327696983928 Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Fri, 9 Jan 2015 19:25:02 -0600 Subject: XuntilY.awk is actually a shell script, but mostly written in awk to make XuntilY easier to use for people without Perl gopherd.sh... I don't remember the change. music.c is to practice reading music. sockip is to get the IP of the listening socket, like if ran from inetd --- nocompile/bin/XuntilY.awk | 16 ++++++++++++++++ nocompile/libexec/gopherd.sh | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 nocompile/bin/XuntilY.awk (limited to 'nocompile') diff --git a/nocompile/bin/XuntilY.awk b/nocompile/bin/XuntilY.awk new file mode 100755 index 0000000..6334d31 --- /dev/null +++ b/nocompile/bin/XuntilY.awk @@ -0,0 +1,16 @@ +#!/bin/sh +if [ "_$3" = "_" ];then + count=1 +else + count="$3" +fi +awk ' +BEGIN {counter='$count'} +/'$1'/, /'$2'/{ + print $0; + if($0 ~ /'$2'/) { + counter--; + } + if(counter == 0) {nextfile} +} +' diff --git a/nocompile/libexec/gopherd.sh b/nocompile/libexec/gopherd.sh index 3b44296..d710f80 100755 --- a/nocompile/libexec/gopherd.sh +++ b/nocompile/libexec/gopherd.sh @@ -22,7 +22,8 @@ if grep -v "^${base}" <<< "${realpath}" > /dev/null;then echo -e 'ierror!!! cant find base in realpath\tasdf\tasdf\tasdf\r' exit 1 fi -myIP=$(hop0 $(/usr/local/libexec/peerip | head -n1) | cut -d% -f1) +#myIP=$(hop0 $(/usr/local/libexec/peerip | head -n1) | cut -d% -f1) +myIP=$(/usr/local/libexec/sockip | head -n1 | cut -d% -f1) hostname=$(rdns ${myIP}) if [ ! "${hostname}" ]; then hostname=${myIP} -- cgit v1.2.3