]> icculus.org git repositories - icculus/xz.git/blob - src/scripts/xzless.in
Remove --force from xzdec.
[icculus/xz.git] / src / scripts / xzless.in
1 #!@POSIX_SHELL@
2
3 # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
4
5 # Modified for XZ Utils by Andrew Dudman and Lasse Collin.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 #SET_PATH - This line is a placeholder to ease patching this script.
18
19 # Instead of unsetting XZ_OPT, just make sure that xz will use file format
20 # autodetection. This way memory usage limit and thread limit can be
21 # specified via XZ_OPT.
22 xz='@xz@ --format=auto'
23
24 version='xzless (@PACKAGE_NAME@) @VERSION@'
25
26 usage="Usage: ${0##*/} [OPTION]... [FILE]...
27 Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
28
29 Options are the same as for 'less'.
30
31 Report bugs to <@PACKAGE_BUGREPORT@>."
32
33 case $1 in
34         --help)    echo "$usage" || exit 2; exit;;
35         --version) echo "$version" || exit 2; exit;;
36 esac
37
38 if test "${LESSMETACHARS+set}" != set; then
39         # Work around a bug in less 394 and earlier;
40         # it mishandles the metacharacters '$%=~'.
41         space=' '
42         tab='   '
43         nl='
44 '
45         LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
46 fi
47
48 LESSOPEN="|$xz -cdfq -- %s"
49 export LESSMETACHARS LESSOPEN
50
51 exec less "$@"