ucab 734 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/sh
  2. CAB=cabextract
  3. mccabfs_list ()
  4. {
  5. $CAB -l "$1" | gawk -v uid=`id -un` -v gid=`id -gn` '
  6. BEGIN { flag=0 }
  7. /^-------/ { flag++; if (flag > 1) exit 0; next }
  8. {
  9. if (flag == 0) next
  10. if (length($6) == 0) next
  11. pr="-rw-r--r--"
  12. split($3, a, ".")
  13. split($4, b, ":")
  14. printf "%s 1 %s %s %d %02d/%02d/%02d %02d:%02d %s\n", pr, uid, gid, $1, a[2], a[1], a[3], b[1], b[2], $6
  15. }'
  16. }
  17. mccabfs_copyout ()
  18. {
  19. $CAB -F "$2" -p "$1" > "$3"
  20. }
  21. LC_ALL=C
  22. export LC_ALL
  23. umask 077
  24. cmd="$1"
  25. case "$cmd" in
  26. # Workaround for a bug in mc - directories must precede files to
  27. # avoid duplicate entries, so we sort output by filenames
  28. list) mccabfs_list "$2" ;;
  29. copyout) mccabfs_copyout "$2" "$3" "$4" ;;
  30. *) exit 1 ;;
  31. esac
  32. exit 0