3 # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
5 # The original version for gzip was written by Paul Eggert.
6 # Modified for XZ Utils by Andrew Dudman and Lasse Collin.
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
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 @enable_path_for_scripts@
19 #SET_PATH - This line is a placeholder to ease patching this script.
21 # Instead of unsetting XZ_OPT, just make sure that xz will use file format
22 # autodetection. This way memory usage limit and thread limit can be
23 # specified via XZ_OPT.
24 xz='@xz@ --format=auto'
26 version='xzless (@PACKAGE_NAME@) @VERSION@'
28 usage="Usage: ${0##*/} [OPTION]... [FILE]...
29 Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
31 Options are the same as for 'less'.
33 Report bugs to <@PACKAGE_BUGREPORT@>."
36 --help) printf '%s\n' "$usage" || exit 2; exit;;
37 --version) printf '%s\n' "$version" || exit 2; exit;;
40 if test "${LESSMETACHARS+set}" != set; then
41 # Work around a bug in less 394 and earlier;
42 # it mishandles the metacharacters '$%=~'.
47 LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
50 if test "$(less -V | { read _ ver _ && echo ${ver%%.*}; })" -ge 429; then
51 # less 429 or later: LESSOPEN pipe will be used on
52 # standard input if $LESSOPEN begins with |-.
53 LESSOPEN="|-$xz -cdfqQ -- %s"
55 LESSOPEN="|$xz -cdfqQ -- %s"
57 export LESSMETACHARS LESSOPEN