Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/whatsnewwiki

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

path = (/bin .) # speed hack

rfork n

# Avoid conflicts with other connections in /srv.
prog=`{basename $0}
rm /srv/wiki.$prog >[2] /dev/null
srv 'net!plan9.bell-labs.com!wiki' wiki.$prog >[2] /dev/null || 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 "Aanothy"
	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


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].