Remove all the BODY functionality. - gophercgis - Collection of gopher CGI/DCGI for geomyidae (HTM) hg clone https://bitbucket.org/iamleot/gophercgis (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) changeset 2533364e0ab90eb0378fa2c86c7991bdc9933fff (DIR) parent 24230ba94e36956f2afc0acfe297bb9d1de75c20 (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Mon, 13 Aug 2018 02:41:52 Remove all the BODY functionality. It is no longer needed and completely contained in nntp_body.cgi script. Diffstat: nntp/nntp.dcgi | 68 ++------------------------------------------------------- 1 files changed, 3 insertions(+), 65 deletions(-) --- diff -r 24230ba94e36 -r 2533364e0ab9 nntp/nntp.dcgi --- a/nntp/nntp.dcgi Mon Aug 13 02:40:52 2018 +0200 +++ b/nntp/nntp.dcgi Mon Aug 13 02:41:52 2018 +0200 @@ -1,6 +1,7 @@ #!/bin/sh CGI="/cgi/nntp/nntp.dcgi" +CGI_BODY="/cgi/nntp/nntp_body.cgi" NNTP_MESSAGES=100 # default number to over (+1) NNTP_SERVER="news.gmane.org" NNTP_PORT="119" @@ -13,11 +14,6 @@ group="${2%%/*}" nums="${2#*/}" ; num1="${nums%%/*}" ; num2="${nums##*/}" ;; -*/[0-9]*) - # BODY (show) of article `msg' - group="${2%%/*}" - msg="${2##*/}" - ;; *) # OVER (scan) of last NNTP_MESSAGES group="$2" @@ -73,9 +69,9 @@ # Ignore seconds and TZ sub(/:[0-9][0-9] [+-][0-9]+$/, "", date) - printf("[1| %d %-17s %-22s %s|%s/%d|server|port]\n", + printf("[0| %d %-17s %-22s %s|%s/%d|server|port]\n", id, substr(from, 1, 17), substr(date, 1, 22), subject, - "'"${CGI}"?"${g}"'", id) + "'"${CGI_BODY}"?"${g}"'", id) } ' | tail -r @@ -83,64 +79,6 @@ # -# BODY (and headers) of the selected `msg', properly gph-ized. -# -nntp_body() -{ - g="$1" - msg="$2" - - { echo "group ${g}"; echo "over ${msg}"; echo "body ${msg}"; echo "quit"; } | - ${NNTP_CMD} | - awk ' - BEGIN { - FS = "\t" - body = 1 - over = 1 - } - - /^\.\r$/ { - if (over && body) { - over = 0 - } else { - body = 0 - } - next - } - - NR > 3 && over { - id = $1 - subject = $2 - from = $3 - date = $4 - print "t" "Date: " date - print "t" "To: " "'"${g}"'" - print "t" "From: " from - print "t" "Subject: " subject - print "t" "" - } - - NR > 6 && body { - gsub("\t", " ") - print "t" $0 - } - ' -} - - -# -# <group>/<msg>: show the article -# -if [ "${msg}" ] && [ "${msg}" -gt 0 ]; then - echo "t" - nntp_body "${group}" "${msg}" - echo "[1|<< ${group}|${CGI}?${group}|server|port]" - echo "t" - exit 0 -fi - - -# # <group>: show ID, From:, Date: and Subject: of the most recent NNTP_MESSAGES # <group>/<num1>/<num2>: show ID, From:, Date: and Subject: from <num1> to # <num2>