xref: /plan9/lib/rfc/grabrfc (revision cc86b588a3dc6ec65fc78d578703c21c61b05942)
1#!/bin/rc
2# grabrfc - copy new rfcs and drafts into /lib/rfc
3rfork en
4path=(/bin)
5fn cd
6dom=`{ndb/query sys $sysname dom}
7
8ramfs
9ftpfs -q/ -a $user@$dom ftp.rfc-editor.org	# was ftp.isi.edu
10
11found=no
12LIB=/lib/rfc
13cd /n/ftp/in-notes
14for(i in rfc*){
15	target=`{
16		echo $i | sed '
17			s/.txt$//
18			s/rfc0*/rfc/'
19	}
20	if(test ! -e $LIB/$target && test -f $i){
21		cp $i $LIB/$target
22		chmod 664 $LIB/$target
23		found=yes
24		echo $target
25	}
26}
27if (~ $found yes)
28	tr A-Z a-z <rfc-index.txt | sed 's/^0*//' |
29		sed 's/^[0-9]/rfc&/' >$LIB/index
30unmount /n/ftp
31
32ftpfs -q/ -a $user@$dom ftp.ietf.org
33
34# copy in new ones
35found=no
36LIB=/lib/rfc/drafts
37cd /n/ftp/internet-drafts
38for(i in *){
39	target=$i
40	if (test ! -e $LIB/$target && test -f $i &&
41	    test `{ls -s $i | sed 's/ .*//'} -ge 2){
42		cp $i $LIB/$target
43		chmod 664 $LIB/$target
44		echo drafts/$i
45	}
46}
47