list 831 B

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