plan9/lib/rfc/grabrfc
2014-02-08 22:26:48 -08:00

47 lines
840 B
Bash
Executable File

#!/bin/rc
# grabrfc - copy new rfcs and drafts into /lib/rfc
rfork en
path=(/bin)
fn cd
dom=`{ndb/query sys $sysname dom}
ramfs
ftpfs -q/ -a $user@$dom ftp.rfc-editor.org # was ftp.isi.edu
found=no
LIB=/lib/rfc
cd /n/ftp/in-notes
for(i in rfc*){
target=`{
echo $i | sed '
s/.txt$//
s/rfc0*/rfc/'
}
if(test ! -e $LIB/$target && test -f $i){
cp $i $LIB/$target
chmod 664 $LIB/$target
found=yes
echo $target
}
}
if (~ $found yes)
tr A-Z a-z <rfc-index.txt | sed 's/^0*//' |
sed 's/^[0-9]/rfc&/' >$LIB/index
unmount /n/ftp
ftpfs -q/ -a $user@$dom ftp.ietf.org
# copy in new ones
found=no
LIB=/lib/rfc/drafts
cd /n/ftp/internet-drafts
for(i in *){
target=$i
if (test ! -e $LIB/$target && test -f $i &&
test `{ls -s $i | sed 's/ .*//'} -ge 2){
cp $i $LIB/$target
chmod 664 $LIB/$target
echo drafts/$i
}
}