Plan 9 from Bell Labs’s /usr/web/sources/contrib/lyndon/idmirror

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


#!/bin/rc

rfork en
path = /bin		# lose '.'
t1 = /tmp/idmirror.t1.^$pid^.^$sysname
t2 = /tmp/idmirror.t2.$pid^.^$sysname

dest = /lib/doc/ietf/drafts

myname = $user
myhost = $sysname

if (~ $#user 0) {
	myname = unknown
}
if (~ $#sysname 0) {
	myhost = unknown
}
flagfmt='d,v'
if(! ifs=() eval `{aux/getflags $*}) {
	aux/usage
	exit usage
}
if (~ $flagv 1) {
	fn print { echo $* }
}
if not {
	fn print {}
}
if (~ $flagd 1) {
	opts = -d
}
if not {
	opts = -q
	fn sigexit {rm -f $t1 $t2; unmount /n/ftp; unmount /tmp}
	ramfs
}

test -d $dest || mkdir -p $dest || exit $status
ftpfs $opts -K -a $myname^@^$myhost ftp.ietf.org

cd /n/ftp/internet-drafts
ls draft-*.txt > $t1
cd $dest
ls draft-*.txt > $t2 >[2]/dev/null

for (i in `{ comm -13 $t1 $t2 }) {
	print '< ' $i
	rm -f $i
}
cd /n/ftp/internet-drafts
for (i in `{ comm -23 $t1 $t2 }) {
	print '> ' $i
	tr -d \015 < $i > $dest/$i || exit $status
}
chmod u+w $dest/_*
tr -d \015 < 1id-index.txt > $dest/_index
tr -d \015 < 1id-abstracts.txt > $dest/_abstracts

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.