wok-next view lzma/stuff/lzma @ rev 8500
Up: xorg-inputproto to 2.0.1.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri Feb 11 02:24:06 2011 +0000 (2011-02-11) |
parents | de99cab8346f |
children | 885c330a75ba |
line source
1 #!/bin/sh
3 case "$1" in
4 d|e|b) exec /usr/bin/lzma-alone $@;;
5 --version|-V|--help|-h|-\?) exec /usr/bin/lzma-alone;;
6 esac
8 [ -x /usr/bin/lzmap ] && exec /usr/bin/lzmap $@
10 files=""
11 outfilter=''
12 suffix='lzma'
13 opts='-a1 -d23 -fb128 -mfbt4 -lc3 -lp0 -pb2'
14 command='e'
15 keep=''
17 case "$0" in
18 *unlzma) command='d';;
19 *lzcat) command='d'; outfilter='s/.*/-so/'; keep='y';;
20 esac
22 while [ -n "$1" ]; do
23 case "$1" in
24 -c|--stdout|--to-stdout) outfilter='s/.*/-so/'; keep='y';;
25 -S|--suffix) suffix="$2"; shift;;
26 -d|--decompress|--uncompress) command='d';;
27 -k|--keep) keep='y';;
28 -1|--fast) opts='-a0 -d16 -fb64 -mfhc4 -lc3 -lp0 -pb2';;
29 -2) opts='-a1 -d20 -fb64 -mfbt4 -lc3 -lp0 -pb2';;
30 -3) opts='-a1 -d19 -fb64 -mfbt4 -lc3 -lp0 -pb2';;
31 -4) opts='-a1 -d20 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
32 -5) opts='-a1 -d21 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
33 -6) opts='-a1 -d22 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
34 -7) opts='-a1 -d23 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
35 -8) opts='-a1 -d24 -fb255 -mfbt4 -lc3 -lp0 -pb2';;
36 -9|--best) opts='-a1 -d25 -fb255 -mfhc4 -lc3 -lp0 -pb2';;
37 -*);;
38 *) files="$files $1";;
39 esac
40 shift
41 done
42 [ -z "$outfilter" ] && if [ -n "$files" ]; then
43 if [ "$command" == "e" ]; then
44 outfilter="s/\$/.$suffix/"
45 else
46 outfilter="s/.$suffix\$//"
47 fi
48 else
49 files='-si'; outfilter='s/.*/-so/'; keep='y';
50 fi
51 for i in $files ; do
52 /usr/bin/lzma-alone $command $i $(echo $i | sed $outfilter) $opts || exit $?
53 [ -n "$keep" ] || rm -f $i
54 done