diff --git a/bin/atom b/bin/atom index 91609a8..70b6685 100755 --- a/bin/atom +++ b/bin/atom @@ -22,13 +22,15 @@ if [ "$run_user" -eq 0 ]; then printf "gopher://cosmic.voyage/\\n" } > "${gopher_atom}" + xml_escape_script='s/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' + # Loop through listings gophermap loop=0 while read -r line; do loop=$((loop+1)) if [ "$loop" -lt 20 ]; then log=$(printf "%s" "$line" | awk -F'\t' '{print $2}') - title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed 's|^.||') + title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed -e 's|^.||' -e "$xml_escape_script") owner=$(stat -c %U "/var/gopher${log}") # print item entry for each log @@ -42,7 +44,7 @@ if [ "$run_user" -eq 0 ]; then printf " gopher://cosmic.voyage/0%s\\n" "$(printf "%s" "$log" | sed 's|\ |%20|g')" printf " %s\\n" "$(date -d "$(stat -c %y "/var/gopher${log}")" +'%Y-%m-%dT%H:%M:%SZ')" printf " \\n" - sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' "/var/gopher${log}" + sed "$xml_escape_script" "/var/gopher${log}" printf "]]>\\n" printf "\\n" diff --git a/bin/rss b/bin/rss index 214885a..8945e3a 100755 --- a/bin/rss +++ b/bin/rss @@ -17,6 +17,7 @@ if [ "$run_user" -eq 0 ]; then printf "Messages from the human stellar diaspora\\n" } > "${gopher_rss}" + xml_escape_script='s/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' # Loop through listings gophermap loop=0 @@ -24,7 +25,7 @@ if [ "$run_user" -eq 0 ]; then loop=$((loop+1)) if [ "$loop" -lt 20 ]; then log=$(printf "%s" "$line" | awk -F'\t' '{print $2}') - title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed 's|^.||') + title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed -e 's|^.||' -e "$xml_escape_script") owner=$(stat -c %U "/var/gopher${log}") # print item entry for each log @@ -36,7 +37,7 @@ if [ "$run_user" -eq 0 ]; then printf " gopher://cosmic.voyage/0%s\\n" "$(printf "%s" "$log" | sed 's|\ |%20|g')" printf " %s GMT\\n" "$(date -d "$(stat -c %y "/var/gopher${log}")" +'%a, %d %b %Y %H:%M:%S')" printf " \\n" - sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' "/var/gopher${log}" + sed "$xml_escape_script" "/var/gopher${log}" printf "]]>\\n" printf "\\n" } >> "${gopher_rss}"