source: Daodan/MinGW/msys/1.0/bin/xzless@ 1134

Last change on this file since 1134 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 1.8 KB
Line 
1#!/bin/sh
2
3# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
4
5# The original version for gzip was written by Paul Eggert.
6# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
7
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.
12
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.
17
18#SET_PATH - This line is a placeholder to ease patching this script.
19
20# Instead of unsetting XZ_OPT, just make sure that xz will use file format
21# autodetection. This way memory usage limit and thread limit can be
22# specified via XZ_OPT.
23xz='xz --format=auto'
24
25version='xzless (XZ Utils) 5.0.3'
26
27usage="Usage: ${0##*/} [OPTION]... [FILE]...
28Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
29
30Options are the same as for 'less'.
31
32Report bugs to <lasse.collin@tukaani.org>."
33
34case $1 in
35 --help) echo "$usage" || exit 2; exit;;
36 --version) echo "$version" || exit 2; exit;;
37esac
38
39if test "${LESSMETACHARS+set}" != set; then
40 # Work around a bug in less 394 and earlier;
41 # it mishandles the metacharacters '$%=~'.
42 space=' '
43 tab=' '
44 nl='
45'
46 LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
47fi
48
49if test "$(less -V | { read ver && echo ${ver#less }; })" -ge 429; then
50 # less 429 or later: LESSOPEN pipe will be used on
51 # standard input if $LESSOPEN begins with |-.
52 LESSOPEN="|-$xz -cdfq -- %s"
53else
54 LESSOPEN="|$xz -cdfq -- %s"
55fi
56export LESSMETACHARS LESSOPEN
57
58exec less "$@"
Note: See TracBrowser for help on using the repository browser.