Refactor the logic to check for valid section - 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 8a9fc8de4f7155ba774ae7af73ace7cb9fdc3985
 (DIR) parent 8b9983d749e8c100a72a9b51badcf960bf4fe3c5
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri,  7 Sep 2018 10:22:55 
       
       Refactor the logic to check for valid section
       
       Add a section_to_subtitle() function that print a subtitle for any valid
       section or an empty string for invalid one.
       
       Diffstat:
        theatlantic/feed.dcgi |  42 ++++++++++++++++++++++++++++++++----------
        1 files changed, 32 insertions(+), 10 deletions(-)
       ---
       diff -r 8b9983d749e8 -r 8a9fc8de4f71 theatlantic/feed.dcgi
       --- a/theatlantic/feed.dcgi     Fri Sep 07 09:18:59 2018 +0200
       +++ b/theatlantic/feed.dcgi     Fri Sep 07 10:22:55 2018 +0200
       @@ -6,20 +6,42 @@
        FEED_DATE=yes
        ARTICLE_CGI="/cgi/theatlantic/article.cgi"
        
       +section_to_subtitle()
       +{
       +       section="$1"
       +
       +       case "${section}" in
       +               politics)       subtitle="Politics"             ;;
       +               business)       subtitle="Business"             ;;
       +               entertainment)  subtitle="Culture"              ;;
       +               international)  subtitle="Global"               ;;
       +               technology)     subtitle="Technology"           ;;
       +               national)       subtitle="U.S."                 ;;
       +               health)         subtitle="Health"               ;;
       +               video)          subtitle="Video"                ;;
       +               education)      subtitle="Education"            ;;
       +               family)         subtitle="Family"               ;;
       +               science)        subtitle="Science"              ;;
       +               letters)        subtitle="Letters"              ;;
       +               news)           subtitle="News"                 ;;
       +               press-releases) subtitle="Press Releases"       ;;
       +               newsletters)    subtitle="Newsletters"          ;;
       +               membership)     subtitle="The Masthead"         ;;
       +               *)              subtitle=""                     ;;
       +       esac
       +
       +       echo "${subtitle}"
       +}
       +
        section="$2"
       -case "${section}" in
       -politics|business|entertainment|international|technology|national|health| \
       -video|education|family|science|letters|news|press-releases|newsletters| \
       -membership)
       -       ;;
       -*)
       -       # TODO: handle more sections
       +subtitle=$(section_to_subtitle "${section}")
       +if [ -z "${subtitle}" ]; then
       +       echo "[3|Invalid section|Err|server|port]"
               exit 1
       -       ;;
       -esac
       +fi
        
        echo ""
       -echo "The Atlantic"
       +echo "The Atlantic - ${subtitle}"
        echo ""
        
        url="https://www.theatlantic.com/feed/channel/${section}/"