#!/bin/rc path = (/bin .) # speed hack rfork n # This is ugly like hell, but it's the only way I have found to make sure hung # junk in /srv doesn't fuck me over prog=`{basename $0} rm /srv/wiki.$prog srv 'net!plan9.bell-labs.com!wiki' wiki.$prog || exit mount -c /srv/wiki.$prog /mnt/wiki # plan9.bell-labs is EST cp /adm/timezone/US_Eastern /env/timezone page='what''s_new' lastupdate=`{sed '/^D/q' < /mnt/wiki/$page/current | sed -n 's,^D,,p'} { awk -v 'lastupdate='^$lastupdate ' BEGIN { print "What''s New" print "D" lastupdate print "Auriel" print "Cnew wiki update script" print "\nRecently changed wiki pages:\n" sort="/bin/sort -r -n +0 | /bin/sed 's/^[0-9]*//'" } FNR == 1 { title = $0; }; FNR != 1 && $0 ~ "^D" { datesec = substr($0,2) dcmd = "date "datesec dcmd | getline date close(dcmd) }; FNR != 1 && $0 ~ "^A" { author = "["substr($1,2)"] "$2; } FNR > 3 { print datesec" * "date" ["title"] -- By "author | sort nextfile title = "" date = "" datesec = "" author = "" } END { close(sort) print "\n"} ' `{ echo /mnt/wiki/*/current |sed 's%/mnt/wiki/(contrib_index|what''s_new)/current%%'g } echo -n } > /mnt/wiki/new