OLD | NEW |
1 #!@POSIX_SHELL@ | 1 #!@POSIX_SHELL@ |
2 | 2 |
3 # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation | 3 # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation |
4 # Copyright (C) 1993 Jean-loup Gailly | 4 # Copyright (C) 1993 Jean-loup Gailly |
5 | 5 |
6 # Modified for XZ Utils by Andrew Dudman and Lasse Collin. | 6 # Modified for XZ Utils by Andrew Dudman and Lasse Collin. |
7 | 7 |
8 # This program is free software; you can redistribute it and/or modify | 8 # This program is free software; you can redistribute it and/or modify |
9 # it under the terms of the GNU General Public License as published by | 9 # it under the terms of the GNU General Public License as published by |
10 # the Free Software Foundation; either version 2 of the License, or | 10 # the Free Software Foundation; either version 2 of the License, or |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 xz1=$xz | 67 xz1=$xz |
68 xz2=$xz | 68 xz2=$xz |
69 xz_status=0 | 69 xz_status=0 |
70 exec 3>&1 | 70 exec 3>&1 |
71 | 71 |
72 if test $# -eq 1; then | 72 if test $# -eq 1; then |
73 case $1 in | 73 case $1 in |
74 *[-.]xz | *[-.]lzma | *.t[lx]z) | 74 *[-.]xz | *[-.]lzma | *.t[lx]z) |
75 ;; | 75 ;; |
76 *[-.]bz2 | *.tbz | *.tbz2) | 76 *[-.]bz2 | *.tbz | *.tbz2) |
77 xz1=$bzip2;; | 77 xz1=bzip2;; |
78 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) | 78 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) |
79 xz1=$gzip;; | 79 xz1=gzip;; |
80 *) | 80 *) |
81 echo >&2 "$0: $1: Unknown compressed file name suffix" | 81 echo >&2 "$0: $1: Unknown compressed file name suffix" |
82 exit 2;; | 82 exit 2;; |
83 esac | 83 esac |
84 case $1 in | 84 case $1 in |
85 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma) | 85 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma) |
86 FILE=`expr "X$1" : 'X\(.*\)[-.][abglmxzZ2]*$'`;; | 86 FILE=`expr "X$1" : 'X\(.*\)[-.][abglmxzZ2]*$'`;; |
87 *.t[abglx]z) | 87 *.t[abglx]z) |
88 FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; | 88 FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; |
89 *.tbz2) | 89 *.tbz2) |
90 FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; | 90 FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; |
91 esac | 91 esac |
92 xz_status=$( | 92 xz_status=$( |
93 exec 4>&1 | 93 exec 4>&1 |
94 ($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3 | 94 ($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3 |
95 ) | 95 ) |
96 elif test $# -eq 2; then | 96 elif test $# -eq 2; then |
97 case $1 in | 97 case $1 in |
98 *[-.]bz2 | *.tbz | *.tbz2) xz1=$bzip2;; | 98 *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; |
99 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=$gzip;; | 99 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; |
100 esac | 100 esac |
101 case $2 in | 101 case $2 in |
102 *[-.]bz2 | *.tbz | *.tbz2) xz2=$bzip2;; | 102 *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; |
103 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=$gzip;; | 103 *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; |
104 esac | 104 esac |
105 case $1 in | 105 case $1 in |
106 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 |
-) | 106 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 |
-) |
107 case "$2" in | 107 case "$2" in |
108 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tb
z2 | -) | 108 *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tb
z2 | -) |
109 if test "$1$2" = --; then | 109 if test "$1$2" = --; then |
110 xz_status=$( | 110 xz_status=$( |
111 exec 4>&1 | 111 exec 4>&1 |
112 ($xz1 -cdfq - 4>&-; echo $? >&4) 3>&- | | 112 ($xz1 -cdfq - 4>&-; echo $? >&4) 3>&- | |
113 eval "$cmp" - - >&3 | 113 eval "$cmp" - - >&3 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 esac;; | 163 esac;; |
164 esac | 164 esac |
165 else | 165 else |
166 echo >&2 "$0: Invalid number of operands; try \`${0##*/} --help' for help" | 166 echo >&2 "$0: Invalid number of operands; try \`${0##*/} --help' for help" |
167 exit 2 | 167 exit 2 |
168 fi | 168 fi |
169 | 169 |
170 cmp_status=$? | 170 cmp_status=$? |
171 test "$xz_status" -eq 0 || exit 2 | 171 test "$xz_status" -eq 0 || exit 2 |
172 exit $cmp_status | 172 exit $cmp_status |
OLD | NEW |