Make the pager work.
[4msysgit-hv.git] / cpio.sh
bloba0a5a372f285f590f823198def1ea967025962c1
1 #!/bin/sh
3 # Emulates some cpio behavior using GNU tar
5 die() {
6 echo >&2 "$@"
7 exit 1
10 tr0=cat
12 while test $# -gt 0; do
13 case "$1" in
14 -0) tr0="tr '\0' ' '";;
15 -o) mode=o;;
16 -iuv) ;;
17 -pumd|-pumdl)
18 mode=p
19 dir="$2"
20 shift
22 *) die "cpio emulation supports only -0, -o, -iuv, -pumdl";;
23 esac
24 shift
25 done
27 case $mode in
29 files=.cpiofiles$$
30 $tr0 > $files
31 tar --create --file=- --files-from=$files --exclude=$files
32 rc=$?
33 rm -f $files
34 exit $rc
37 files=.cpiofiles$$
38 $tr0 > $files
39 tar --create --file=- --files-from=$files --exclude=$files |
40 tar --extract --directory="$dir" --file=-
41 rm -f $files
44 tar xvf - || exit
45 esac