]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/patch/list
merge
[plan9front.git] / rc / bin / patch / list
1 #!/bin/rc
2
3 rfork e
4 if(! test -d /n/sources/patch){
5         rfork n
6         9fs sources
7 }
8
9 pref=''
10 builtin cd /n/sources/patch || {
11         echo 'can''t cd /n/sources/patch' >[2=1]
12         exit no-sources
13 }
14
15 if(~ $1 applied saved sorry maybe){
16         pref=$1^'/'
17         shift
18 }
19 if(~ $#* 0)
20         *=(`{
21                 if(~ $pref *?*)
22                         builtin cd $pref
23                 ls -t | grep -v '^(applied|saved|sorry|maybe)$'
24         })
25
26 trunc=(sed 5q)
27 if(~ $#* 1)
28         trunc=cat
29
30 {
31 for(i in $*){
32         i=$pref^$i
33         if(test -f $i/origls)
34                 cat $i/origls | awk '{$NF="'$i'"; print}'
35         if not
36                 ls -ld $i
37         if(patch/okay $i){
38                 if(test -r $i/email)
39                         echo from `{cat $i/email}
40                 cat $i/files | awk '{print "    " $1}'
41                 cat $i/readme | sed 's/^/       /' | $trunc
42                 if(test -f $i/notes){
43                         echo
44                         cat $i/notes
45                 }
46         }
47         if not
48                 echo '  'bad patch: $status >[2=1]
49         echo
50 }
51 } >/tmp/patchtmp.$pid
52
53 cat /tmp/patchtmp.$pid
54 rm -f /tmp/patchtmp.$pid