#! /bin/sh
case "$HTTP_USER_AGENT" in
*MIDP*)
TINY=1
NOCAL=1
;;
*Mobile*)
NOCAL=1
;;
esac
weather () {
curl -s 'http://rss.wunderground.com/auto/rss_full/NM/Los_Alamos.xml?units=metric' | \
awk -F ' [-:] ' '
(/Current Conditions/) {
print "
" $2 "
";
}
(c == 2) {
print "" $0 "
";
exit;
}
(/CDATA/) {
c++;
}'
}
section () {
echo ""
echo ""
[ "$TINY" ] && pfx="http://news.google.com/gwt/x?u="
curl -s "$3" | \
awk -F '>' -v RS='<' -v m=${4:-5} -v pfx="$pfx" '
(/^item[> ]/) {
a++;
}
(/^title/) {
title=$2;
}
(a && a" title "";
}'
echo "
"
}
cat <
Houyhnhnm
EOF
[ "$NOCAL" ] || \
echo ''
if [ "$TINY" ]; then
echo ''
fi
weather
section LA \
'http://ladailypost.com/' \
'http://ladailypost.com/feed/'
section "Ars Technica" \
'http://m.arstechnica.com/' \
'http://feeds.arstechnica.com/arstechnica/index?format=xml'
section CSM \
'http://www.csmonitor.com/textedition' \
'http://rss.csmonitor.com/feeds/csm'
section NPR \
'http://thin.npr.org/t.php?tid=1001' \
'http://www.npr.org/rss/rss.php?id=1001'
section AJE \
'http://m.aljazeera.net' \
'http://www.aljazeera.com/Services/Rss/?PostingId=2007731105943979989'
cat <
EOF