B 645 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/rc
  2. files=()
  3. dest=()
  4. if(~ $#* 0){
  5. echo usage: B file ... >[1=2]
  6. exit usage
  7. }
  8. for(i)
  9. switch($i){
  10. case /*
  11. files = ( $files $i )
  12. case *
  13. files = ( $files `{cleanname `{pwd}^/$i} )
  14. }
  15. if(test -f /mnt/plumb/edit || test -f /mnt/term/mnt/plumb/edit){
  16. plumb -s B -d edit $files
  17. exit
  18. }
  19. # using sam srv file
  20. if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user
  21. if not if(test -f /srv/sam.$user) dest = /srv/sam.$user
  22. if not {
  23. echo B: can''''t find sam server file >[1=2]
  24. exit open
  25. }
  26. switch($files){
  27. case *:*
  28. for(i in $files)
  29. echo $i | sed 's/^/B /;s/:([0-9]+)$/\n\1/g' >> $dest
  30. case *
  31. echo B $files >> $dest
  32. }