Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/wikindex

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


#!/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='wiki index'
lastupdate=`{sed '/^D/q' < /mnt/wiki/$page/current | sed -n 's,^D,,p'}


{
echo	'Wiki Index'
echo	'D'^$lastupdate
echo	'Auriel'
echo	'Cwiki index script'
echo	'
Index of wiki pages:
'

@{ cd /mnt/wiki; ls -lqQ } | awk '
$4 ~ "^d" {
	id = substr($0, 8, 4)
	name = $NF

	nl =  toupper(substr(name,1,1))
	if(nl != ol)
		print " \n" nl

	ol = nl

	gsub("_", " ", name)
	printf " * [" name "] "
	system("echo ''ibase=16; print " toupper(id) "''|bc|sed ''s/^.*$/(&)/''" )
}'

echo -n # Needed to 'commit' update!

} > /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].