move 643 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/rc
  2. rfork e
  3. if(~ $#* 0 1){
  4. echo 'usage: patch/move dst patch-name...' >[1=2]
  5. exit usage
  6. }
  7. if(! test -d /n/sources/patch){
  8. rfork n
  9. 9fs sources
  10. }
  11. dst=$1
  12. shift
  13. for(i){
  14. j=`{basename $i}
  15. if(! test -d /n/sources/patch/$i)
  16. echo 'no such patch' /n/sources/patch/$i >[1=2]
  17. if not if(test -d /n/sources/patch/$dst/$j)
  18. echo 'already have' /n/sources/patch/$dst/$j >[1=2]
  19. if not
  20. ls -ldp /n/sources/patch/$i >/n/sources/patch/$i/origls &&
  21. mkdir /n/sources/patch/$dst/$j &&
  22. dircp /n/sources/patch/$i /n/sources/patch/$dst/$j &&
  23. rm -rf /n/sources/patch/$i &&
  24. test -s /n/sources/patch/$dst/$j/email &&
  25. patch/notify $dst/$j
  26. }