Add a common/feed.sh to avoid duplicate code in CGIs - 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 79f7a5a43f779011371b8bcaa3d0a5b484c4f1a1
 (DIR) parent 5dfb11e02c26615d045e0df1ec71656a949f43ae
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri,  7 Sep 2018 01:32:27 
       
       Add a common/feed.sh to avoid duplicate code in CGIs
       
       Diffstat:
        common/feed.sh |  28 ++++++++++++++++++++++++++++
        1 files changed, 28 insertions(+), 0 deletions(-)
       ---
       diff -r 5dfb11e02c26 -r 79f7a5a43f77 common/feed.sh
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/common/feed.sh    Fri Sep 07 01:32:27 2018 +0200
       @@ -0,0 +1,28 @@
       +#!/bin/sh
       +
       +
       +#
       +# Render RSS/Atom feed as a gph using sfeed
       +#
       +feed_to_gph()
       +{
       +
       +       /usr/pkg/bin/sfeed |
       +       awk -v cgi="${ARTICLE_CGI}" -F '\t' '
       +       {
       +               timestamp = $1
       +               title = $2
       +               link = $3
       +               content = $4
       +               content_type = $5
       +               id = $6
       +               author = $7
       +
       +               gsub("\\|", "\\|", title)
       +               gsub("\\|", "\\|", cgi)
       +               gsub("\\|", "\\|", link)
       +
       +               printf("[0|%s|%s?%s|server|port]\n", title, cgi, link)
       +       }
       +'
       +}