wok-stable view lzma/stuff/lzma @ rev 5141
linux: use utf8
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Mar 23 20:06:35 2010 +0100 (2010-03-23) |
parents | 1c6fa8e91b97 |
children | de99cab8346f |
line source
1 #!/bin/sh
3 case "$1" in
4 d|e|b) exec /usr/bin/lzma-alone $@;;
5 --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 while [ -n "$1" ]; do
18 case "$1" in
19 -c|--stdout|--to-stdout) outfilter='s/.*/-so/'; keep='y';;
20 -S|--suffix) suffix="$2"; shift;;
21 -d|--decompress|--uncompress) command='d';;
22 -k|--keep) keep='y';;
23 -1|--fast) opts='-a0 -d16 -fb64 -mfhc4 -lc3 -lp0 -pb2';;
24 -2) opts='-a1 -d20 -fb64 -mfbt4 -lc3 -lp0 -pb2';;
25 -3) opts='-a1 -d19 -fb64 -mfbt4 -lc3 -lp0 -pb2';;
26 -4) opts='-a1 -d20 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
27 -5) opts='-a1 -d21 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
28 -6) opts='-a1 -d22 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
29 -7) opts='-a1 -d23 -fb128 -mfbt4 -lc3 -lp0 -pb2';;
30 -8) opts='-a1 -d24 -fb255 -mfbt4 -lc3 -lp0 -pb2';;
31 -9|--best) opts='-a1 -d25 -fb255 -mfhc4 -lc3 -lp0 -pb2';;
32 -*);;
33 *) files="$files $1";;
34 esac
35 shift
36 done
37 [ -z "$outfilter" ] && if [ -n "$files" ]; then
38 if [ "$command" == "e" ]; then
39 outfilter="s/\$/.$suffix/"
40 else
41 outfilter="s/.$suffix\$//"
42 fi
43 else
44 files='-si'; outfilter='s/.*/-so/'; keep='y';
45 fi
46 for i in $files ; do
47 /usr/bin/lzma-alone $command $i $(echo $i | sed $outfilter) $opts || exit $?
48 [ -n "$keep" ] || rm -f $i
49 done