uha.in 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. #
  3. # It is the uhafs Valery Kornienkov vlk@st.simbirsk.su 2:5051/30@fidonet
  4. # ver 0.1 Thu Apr 6 12:05:08 2000
  5. #
  6. # Tested with HA 0.999. Source of ha can be found at
  7. # ftp://ftp.ibiblio.org/pub/Linux/utils/compress/
  8. HA=ha
  9. mchafs_list ()
  10. {
  11. $HA lf "$1" 2>/dev/null | @AWK@ -v uid=$(id -ru) '
  12. /^===========/ {next}
  13. {
  14. if ($5="%" && $8~/DIR|ASC|HSC|CPY/) {
  15. split($6, a, "-")
  16. split($7, t, ":")
  17. filename=$1
  18. filesize=$2
  19. getline
  20. if ($2=="(none)") $2=""
  21. path=$2
  22. getline
  23. if ($1~/^d.*/) next
  24. printf "%s %s %-8d %-8d %8d %s-%s-%s %s:%s %s%s\n",\
  25. $1,1,0,0,filesize,a[3],a[2],a[1],t[1],t[2],path,filename
  26. }
  27. }'
  28. }
  29. mchafs_copyout ()
  30. {
  31. TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uha.XXXXXX"` || exit 1
  32. cd "$TMPDIR"
  33. $HA xyq "$1" "$2" >/dev/null
  34. cat "$2" > "$3"
  35. cd /
  36. rm -rf "$TMPDIR"
  37. }
  38. cmd="$1"
  39. shift
  40. case "$cmd" in
  41. list) mchafs_list "$@" ;;
  42. copyout) mchafs_copyout "$@" ;;
  43. *) exit 1 ;;
  44. esac
  45. exit 0