summaryrefslogtreecommitdiff
path: root/rc/bin/ap
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 17:14:36 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 17:14:36 +0300
commit2959e1ede0ebc6fdffd7b8660f43c2ce14c9696f (patch)
treef6343b1ce11a8c87251dd27cf3d3e26b50693fa7 /rc/bin/ap
parente463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (diff)
Import sources from 2011-03-30 iso image - rc
Diffstat (limited to 'rc/bin/ap')
-rwxr-xr-xrc/bin/ap36
1 files changed, 36 insertions, 0 deletions
diff --git a/rc/bin/ap b/rc/bin/ap
new file mode 100755
index 000000000..93462e821
--- /dev/null
+++ b/rc/bin/ap
@@ -0,0 +1,36 @@
+#!/bin/rc
+#
+# get AP news headline list or the given story
+#
+
+wire='http://www.newsday.com/news/nationworld/wire'
+if ( ~ $#* 0 )
+ hget $wire | #tee /tmp/ap.$pid |
+ sed -n '/<h1>AP Top News/,/AP News Wire/p' |
+ htmlfmt -a -w 100 |
+ sed -n '
+ /^• / {
+ N
+ s/^• / /g
+ s/\n/ /g
+ s/\[\/news\/nationworld\/wire\//|/
+ s/sns-ap-//
+ s/\.story.*$//
+ p
+ }' |
+ awk -F '|' '
+ {
+ s = "";
+ for (i = 1; i < NF; i++)
+ s = s " " $i;
+ printf("ap %-40s # %s\n", $NF, s);
+ }'
+
+if not
+ hget $wire/sns-ap-^$1^.story |
+ htmlfmt |
+ sed '
+ 1,/^AP Top News$/d
+ /^\* __$/,$d
+ /^Subscribe to Newsday home delivery/,$d
+ '