#!/usr/bin/perl -- use CGI qw/:standard/; print "Content-Type: text/vnd.wap.wml\r\n\r\n"; $sid = param('sid'); if ($sid =~ /^\d+$/) { print "\r\n"; print "\r\n"; print "

\r\n"; open(CURL, "/usr/bin/curl -s 'http://www.gnuheter.com/jcexport.php?op=article&sid=$sid' |") or die; while () { s/<<[^>]*>>//g; s/<[^>]*>//g; if (not /^\s*$/) { print; } } print "

\r\n"; print "
\r\n"; print "
\r\n"; } else { print "\r\n"; print "\r\n"; print "

\r\n"; open(CURL, "/usr/bin/curl -s 'http://www.gnuheter.com/backend.php' |") or die; $initem = 0; while () { if (//) { $initem = 1; next; } if (/<\/item>/) { $initem = 0; next; } if ($initem and /(.*)<\/title>/) { $title = $1; } if ($initem and /<link>.*sid=(\d+)<\/link>/) { $link = $1; print "<a href=\"http://cgi.student.nada.kth.se/cgi-bin/d95-mah/gnuheter.pl?sid=$link\">$title</a><br/>\n"; } } print "</p>\r\n"; print "</card>\r\n"; print "</wml>\r\n"; }