uar.in 811 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. # Written by Alex Kuchma <ask@bcs.zp.ua>
  4. # Alex Tkachenko <alex@bcs.zp.ua>
  5. # Updated by Vitezslav Samel <xsamel00@dcse.fee.vutbr.cz>
  6. #
  7. # (C) 1997, 1998 The Free Software Foundation.
  8. #
  9. #
  10. XAR=ar
  11. mcarfs_list ()
  12. {
  13. $XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,'
  14. }
  15. mcarfs_copyout ()
  16. {
  17. $XAR p "$1" "$2" > "$3"
  18. }
  19. mcarfs_copyin ()
  20. {
  21. TMPDIR=/tmp/mctmpdir-uar.$$
  22. mkdir $TMPDIR || exit 1
  23. name=`basename "$2"`
  24. (cd $TMPDIR && cp -fp "$3" $name && $XAR r "$1" $name)
  25. rm -rf $TMPDIR
  26. }
  27. mcarfs_rm ()
  28. {
  29. $XAR d "$1" "$2"
  30. }
  31. # override any locale for dates
  32. LC_ALL=C
  33. export LC_ALL
  34. umask 077
  35. case "$1" in
  36. list) mcarfs_list "$2" ;;
  37. copyout) shift; mcarfs_copyout "$@" ;;
  38. copyin) shift; mcarfs_copyin "$@" ;;
  39. rm) shift; mcarfs_rm "$@" ;;
  40. *) exit 1;
  41. esac
  42. exit 0