aboutsummaryrefslogtreecommitdiff
path: root/src/scripts (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-07-27xzless: Rename unused variables to silence static analysers.Lasse Collin1-1/+1
In this particular case I don't see this affecting readability of the code. Thanks to Pavel Raiskup.
2015-02-09xzdiff: Make the mktemp usage compatible with FreeBSD's mktemp.Lasse Collin1-1/+6
Thanks to Rui Paulo for the fix.
2014-11-10xzdiff: Use mkdir if mktemp isn't available.Lasse Collin1-1/+16
2014-11-10xzdiff: Create a temporary directory to hold a temporary file.Lasse Collin1-5/+5
This avoids the possibility of "File name too long" when creating a temp file when the input file name is very long. This also means that other users on the system can no longer see the input file names in /tmp (or whatever $TMPDIR is) since the temporary directory will have a generic name. This usually doesn't matter since on many systems one can see the arguments given to all processes anyway. The number X chars to mktemp where increased from 6 to 10. Note that with some shells temp files or dirs won't be used at all.
2014-10-09xzgrep: Avoid passing both -q and -l to grep.Lasse Collin1-2/+4
The behavior of grep -ql varies: - GNU grep behaves like grep -q. - OpenBSD grep behaves like grep -l. POSIX doesn't make it 100 % clear what behavior is expected. Anyway, using both -q and -l at the same time makes no sense so both options simply should never be used at the same time. Thanks to Christian Weisgerber.
2014-06-11xzgrep: exit 0 when at least one file matches.Lasse Collin1-2/+13
Mimic the original grep behavior and return exit_success when at least one xz compressed file matches given pattern. Original bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=1108085 Thanks to Pavel Raiskup for the patch.
2013-06-30Man pages: Use similar syntax for synopsis as in xz.Lasse Collin1-3/+3
The man pages of lzmainfo, xzmore, and xzdec had similar constructs as the man page of xz had before the commit eb6ca9854b8eb9fbf72497c1cf608d6b19d2d494. Eric S. Raymond didn't mention these man pages in his bug report, but it's nice to be consistent.
2013-04-05xzgrep: make the '-h' option to be --no-filename equivalentJeff Bastian1-1/+1
* src/scripts/xzgrep.in: Accept the '-h' option in argument parsing.
2013-03-05Avoid unneeded use of awk in xzless.Lasse Collin1-2/+1
Use "read" instead of "awk" in xzless to get the version number of "less". The need for awk was introduced in the commit db5c1817fabf7cbb9e4087b1576eb26f0747338e. Thanks to Ariel P for the patch.
2012-11-21xzless: Make "less -V" parsing more robustJonathan Nieder1-1/+2
In v4.999.9beta~30 (xzless: Support compressed standard input, 2009-08-09), xzless learned to parse ‘less -V’ output to figure out whether less is new enough to handle $LESSOPEN settings starting with “|-”. That worked well for a while, but the version string from ‘less’ versions 448 (June, 2012) is misparsed, producing a warning: $ xzless /tmp/test.xz; echo $? /usr/bin/xzless: line 49: test: 456 (GNU regular expressions): \ integer expression expected 0 More precisely, modern ‘less’ lists the regexp implementation along with its version number, and xzless passes the entire version number with attached parenthetical phrase as a number to "test $a -gt $b", producing the above confusing message. $ less-444 -V | head -1 less 444 $ less -V | head -1 less 456 (no regular expressions) So relax the pattern matched --- instead of expecting "less <number>", look for a line of the form "less <number>[ (extra parenthetical)]". While at it, improve the behavior when no matching line is found --- instead of producing a cryptic message, we can fall back on a LESSPIPE setting that is supported by all versions of ‘less’. The implementation uses "awk" for simplicity. Hopefully that’s portable enough. Reported-by: Jörg-Volker Peetz <jvpeetz@web.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2012-02-22Fix exit status of xzgrep when grepping binary files.Lasse Collin1-1/+2
When grepping binary files, grep may exit before it has read all the input. In this case, gzip -q returns 2 (eating SIGPIPE), but xz and bzip2 show SIGPIPE as the exit status (e.g. 141). This causes wrong exit status when grepping xz- or bzip2-compressed binary files. The fix checks for the special exit status that indicates SIGPIPE. It uses kill -l which should be supported everywhere since it is in both SUSv2 (1997) and POSIX.1-2008. Thanks to James Buren for the bug report.
2011-07-31Fix exit status of "xzdiff foo.xz bar.xz".Lasse Collin1-0/+2
xzdiff was clobbering the exit status from diff in a case statement used to analyze the exit statuses from "xz" when its operands were two compressed files. Save and restore diff's exit status to fix this. The bug is inherited from zdiff in GNU gzip and was fixed there on 2009-10-09. Thanks to Jonathan Nieder for the patch and to Peter Pallinger for reporting the bug.
2011-04-18xzgrep: fix typo in $0 parsingMartin Väth1-2/+2
Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org> Signed-off-by: Martin Väth <vaeth@mathematik.uni-wuerzburg.de> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-24Scripts: Better fix for xzgrep.Lasse Collin1-2/+6
Now it uses "grep -q". Thanks to Gregory Margo.
2011-03-24Scripts: Fix xzgrep -l.Lasse Collin1-2/+2
It didn't work at all. It tried to use the -q option for grep, but it appended it after "--". This works around it by redirecting to /dev/null. The downside is that this can be slower with big files compared to proper use of "grep -q". Thanks to Gregory Margo.
2011-03-19Scripts: Add lzop (.lzo) support to xzdiff and xzgrep.Lasse Collin4-16/+28
2010-12-13Scripts: Fix gzip and bzip2 support in xzdiff.Lasse Collin1-6/+6
2010-10-08Build: Add options to disable individual command line tools.Lasse Collin1-36/+26
2010-09-27Major man page updates.Lasse Collin4-21/+27
Lots of content was updated on the xz man page. Technical improvements: - Start a new sentence on a new line. - Use fairly short lines. - Use constant-width font for examples (where supported). - Some minor cleanups. Thanks to Jonathan Nieder for some language fixes.
2010-03-07Fix xzgrep to not break if filenames have spaces or quotes.Lasse Collin1-1/+1
Thanks to someone who reported the bug on IRC.
2010-02-12Collection of language fixes to comments and docs.Lasse Collin2-6/+6
Thanks to Jonathan Nieder.
2009-10-16Escape dashes in xzmore.1Jonathan Nieder1-2/+2
A minus sign is larger, easier to see in a printout, and more likely to use the same glyph as ASCII hyphen-minus in a terminal than a hyphen. Since broken manual pagers do not find hyphens when the user searches for a hyphen-minus, minus signs are also easier to search for. So use minus signs instead of hyphens to render sample terminal output.
2009-08-09“xzdiff a.xz b.xz” always failsJonathan Nieder1-1/+1
Attempts to compare two compressed files result in no output and exit status 2. Instead of going to standard output, ‘diff’ output is being captured in the xz_status variable along with the exit status from the decompression commands. Later, when this variable is examined for nonzero status codes, numerals from dates in the ‘diff’ output make it appear as though decompression failed. So let the ‘diff’ output leak to standard output with another file descriptor. (This trick is used in all similar contexts elsewhere in xzdiff and in the analogous context in gzip’s zdiff script.)
2009-08-09xzless: Support compressed standard inputJonathan Nieder1-1/+7
It can be somewhat confusing that less < some_file.txt works fine, whereas xzless < some_file.txt.xz does not. Since version 429, ‘less’ allows a filter specified in the LESSOPEN environment variable to preprocess its input even if it comes from standard input, if $LESSOPEN begins with ‘|-’. So set $LESSOPEN to take advantage of this feature. Check less’s version at runtime so xzless can continue to work with older versions.
2009-07-30xzdiff: add missing ;; to case statementJonathan Nieder1-3/+3
2009-07-19Added missing author notice to xzless.in.Lasse Collin1-0/+1
2009-07-06Use sed instead of $(SED) so that we don't need toLasse Collin1-14/+14
use AC_PROG_SED. We don't do anything fancy with sed, so this should work OK. libtool 2.2 sets SED but 1.5 doesn't, so $(SED) happened to work when using libtool 2.2.
2009-07-05Major update to the xzgrep and other scripts based onLasse Collin12-369/+689
the latest versions found from gzip CVS repository. configure will try to find a POSIX shell to be used by the scripts. This should ease portability on systems which have pre-POSIX /bin/sh. xzgrep and xzdiff support .xz, .lzma, .gz, and .bz2 files. xzmore and xzless support only .xz and .lzma files. The name of the xz executable used in these scripts is now correct even if --program-transform-name has been used.
2009-06-27Create correct symlinks even whenLasse Collin1-34/+46
--program-{prefix,suffix,transform} is passed to configure.
2009-05-21Install lzdiff, lzgrep, and lzmore as symlinksABCD1-2/+14
This adds lzdiff, lzgrep, and lzmore to the list of symlinks to install. It also installs symlinks for the manual pages and removes the new symlinks on uninstall.
2009-04-13Quick & dirty update to support xz in diff/grep/more scripts.Lasse Collin7-75/+119
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin1-0/+7
Some minor documentation cleanups were made at the same time.
2009-01-26remove trailing blanks from all but .xz filesJim Meyering2-5/+5
2007-12-09Imported to git.Lasse Collin7-0/+455