feed.sh - sfeed_tests - sfeed tests and RSS and Atom files
 (HTM) git clone git://git.codemadness.org/sfeed_tests
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       feed.sh (2170B)
       ---
            1 #!/bin/sh
            2 
            3 link() {
            4         printf '<entry><title>%s</title><link>%s</link></entry>\n' "$1" "$1"
            5 }
            6 
            7 feed() {
            8 echo "<feed>"
            9 
           10 link '' # empty URL
           11 
           12 link "http://codemadness.org"
           13 link "http://codemadness.org/"
           14 link "http://codemadness.org/cgi?query#fragment"
           15 link "http://codemadness.org/cgi?query=hello+world"
           16 link "http://codemadness.org/cgi?query=hello%20world"
           17 
           18 link "https://codemadness.org"
           19 
           20 link "gopher://codemadness.org"
           21 link "gopher://codemadness.org/1"
           22 link "gopher://codemadness.org/9"
           23 link "gopher://codemadness.org/9"
           24 link "gopher://codemadness.org/1/cgi?query#fragment"
           25 link "gopher://codemadness.org/1/cgi?query=hello+world"
           26 link "gopher://codemadness.org/1/cgi?query=hello%20world"
           27 link "gopher://codemadness.org:7070/1/cgi?query=hello%20world"
           28 link "gophers://codemadness.org:7070/1/cgi?query=hello%20world"
           29 link "gophers://codemadness.org/1/cgi?query=hello%20world"
           30 
           31 # h type, but not an external link: HTML file.
           32 link "gopher://codemadness.org/h/index.html"
           33 # h type, external link (weird case that should never happen)
           34 link "gopher://codemadness.org/hURL:https://external.org"
           35 
           36 link "tel:0612345678"
           37 link "mailto:test@test.org"
           38 
           39 link "git://git.codemadness.org/sfeed"
           40 link "rel" # relative non-gopher links (note for gopher this would miss the type)
           41 link "/rel" # relative non-gopher links (note for gopher this would miss the type)
           42 link "1rel" # for relative gopher links
           43 link "1/rel" # for relative gopher links
           44 link "0rel" # for relative gopher links
           45 link "0/rel" # for relative gopher links
           46 link "//codemadness.org"
           47 
           48 echo "</feed>"
           49 }
           50 
           51 sfeed="sfeed"
           52 sfeed_gopher="sfeed_gopher"
           53 
           54 # dev
           55 #sfeed="$HOME/p/sfeed/sfeed"
           56 #sfeed_gopher="$HOME/p/sfeed/sfeed_gopher"
           57 
           58 #feed | $sfeed | ${sfeed_gopher}
           59 #feed | $sfeed "https://baseuri.org" | ${sfeed_gopher}
           60 #feed | $sfeed "https://baseuri.org" | SFEED_GOPHER_HOST="gopherhost.org" SFEED_GOPHER_PORT="6969" SFEED_GOPHER_PATH="" ${sfeed_gopher}
           61 #feed | $sfeed "https://baseuri.org" | SFEED_GOPHER_HOST="gopherhost.org" SFEED_GOPHER_PORT="6969" SFEED_GOPHER_PATH="/" ${sfeed_gopher}
           62 
           63 feed | $sfeed "gopher://baseuri.org" | SFEED_GOPHER_HOST="gopherhost.org" SFEED_GOPHER_PORT="6969" SFEED_GOPHER_PATH="/" ${sfeed_gopher}