Update XZ Utils to 5.0.4.

Information about this release from README.chromium:

--
Name: XZ Utils
URL: http://tukaani.org/xz/
Source URL: http://git.tukaani.org/xz.git
Version: 5.0.4 (git tag v5.0.4, f6999fefe47884922f3f62186ddcf849d54b1092,
         2012-06-22 07:54:56 +0300)
License: Public domain/license grant, LGPL 2.1, GPL 2, GPL 3

Description:
XZ Utils is general-purpose data compression software implementing the
modified Lempel-Ziv-Markov chain algorithm (LZMA2).

Local Modifications:
 - None.
--

From NEWS:

--
5.0.4 (2012-06-22)

    * liblzma:

        - Fix lzma_index_init(). It could crash if memory allocation
          failed.

        - Fix the possibility of an incorrect LZMA_BUF_ERROR when a BCJ
          filter is used and the application only provides exactly as
          much output space as is the uncompressed size of the file.

        - Fix a bug in doc/examples_old/xz_pipe_decompress.c. It didn't
          check if the last call to lzma_code() really returned
          LZMA_STREAM_END, which made the program think that truncated
          files are valid.

        - New example programs in doc/examples (old programs are now in
          doc/examples_old). These have more comments and more detailed
          error handling.

    * Fix "xz -lvv foo.xz". It could crash on some corrupted files.

    * Fix output of "xz --robot -lv" and "xz --robot -lvv" which
      incorrectly printed the filename also in the "foo (x/x)" format.

    * Fix exit status of "xzdiff foo.xz bar.xz".

    * Fix exit status of "xzgrep foo binary_file".

    * Fix portability to EBCDIC systems.

    * Fix a configure issue on AIX with the XL C compiler. See INSTALL
      for details.

    * Update French, German, Italian, and Polish translations.
--

BUG=222086

git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/xz@189101 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/AUTHORS b/AUTHORS
index 63a9815..bda8797 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,11 +16,11 @@
 
     Some scripts have been adapted from gzip. The original versions
     were written by Jean-loup Gailly, Charles Levert, and Paul Eggert.
-    Andrew Dudman helped adapting the script and their man pages for
+    Andrew Dudman helped adapting the scripts and their man pages for
     XZ Utils.
 
-    The GNU Autotools based build system contains files from many authors,
-    which I'm not trying list here.
+    The GNU Autotools-based build system contains files from many authors,
+    which I'm not trying to list here.
 
     Several people have contributed fixes or reported bugs. Most of them
     are mentioned in the file THANKS.
diff --git a/INSTALL b/INSTALL
index 992f907..8b39319 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,13 +6,14 @@
     1. Supported platforms
        1.1. Compilers
        1.2. Platform-specific notes
-            1.2.1. IRIX
-            1.2.2. MINIX 3
-            1.2.3. OpenVMS
-            1.2.4. Solaris, OpenSolaris, and derivatives
-            1.2.5. Tru64
-            1.2.6. Windows
-            1.2.7. DOS
+            1.2.1. AIX
+            1.2.2. IRIX
+            1.2.3. MINIX 3
+            1.2.4. OpenVMS
+            1.2.5. Solaris, OpenSolaris, and derivatives
+            1.2.6. Tru64
+            1.2.7. Windows
+            1.2.8. DOS
        1.3. Adding support for new platforms
     2. configure options
        2.1. Static vs. dynamic linking of liblzma
@@ -63,7 +64,14 @@
 
 1.2. Platform-specific notes
 
-1.2.1. IRIX
+1.2.1. AIX
+
+    If you use IBM XL C compiler, pass CC=xlc_r to configure. If
+    you use CC=xlc instead, you must disable threading support
+    with --disable-threads (usually not recommended).
+
+
+1.2.2. IRIX
 
     MIPSpro 7.4.4m has been reported to produce broken code if using
     the -O2 optimization flag ("make check" fails). Using -O1 should
@@ -74,16 +82,18 @@
     putting "-64" to CFLAGS to build a 64-bit version might help too.
 
 
-1.2.2. MINIX 3
+1.2.3. MINIX 3
 
     The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
     which doesn't support C99. Install GCC to compile XZ Utils.
 
-    MINIX 3.1.8 (and possibly some other versions too) has bugs in
-    /usr/include/stdint.h, which has to be patched before XZ Utils
-    can be compiled correctly. See
+    MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
+    to be patched before XZ Utils can be compiled correctly. See
     <http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
 
+    MINIX 3.2.0 and later use a different libc and aren't affected by
+    the above bug.
+
     XZ Utils doesn't have code to detect the amount of physical RAM and
     number of CPU cores on MINIX 3.
 
@@ -91,7 +101,7 @@
     may want to pass gl_cv_cc_visibility=no to configure).
 
 
-1.2.3. OpenVMS
+1.2.4. OpenVMS
 
     XZ Utils can be built for OpenVMS, but the build system files
     are not included in the XZ Utils source package. The required
@@ -101,7 +111,7 @@
         http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
 
 
-1.2.4. Solaris, OpenSolaris, and derivatives
+1.2.5. Solaris, OpenSolaris, and derivatives
 
     The following linker error has been reported on some x86 systems:
 
@@ -111,14 +121,14 @@
     as an argument to the configure script.
 
 
-1.2.5. Tru64
+1.2.6. Tru64
 
     If you try to use the native C compiler on Tru64 (passing CC=cc to
     configure), you may need the workaround mention in section 4.1 in
     this file (pass also ac_cv_prog_cc_c99= to configure).
 
 
-1.2.6. Windows
+1.2.7. Windows
 
     Building XZ Utils on Windows is supported under MinGW + MSYS,
     MinGW-w64 + MSYS, and Cygwin. There is windows/build.bash to
@@ -138,7 +148,7 @@
     windows/README-Windows.txt for details.
 
 
-1.2.7. DOS
+1.2.8. DOS
 
     There is an experimental Makefile in the "dos" directory to build
     XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
diff --git a/Makefile.am b/Makefile.am
index 2ce74aa..97553fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,9 @@
 ## You can do whatever you want with this file.
 ##
 
+# Use -n to prevent gzip from adding a timestamp to the .gz headers.
+GZIP_ENV = -9n
+
 DIST_SUBDIRS = lib src po tests debug
 SUBDIRS =
 
@@ -29,8 +32,16 @@
 
 examplesdir = $(docdir)/examples
 dist_examples_DATA = \
-	doc/examples/xz_pipe_comp.c \
-	doc/examples/xz_pipe_decomp.c
+	doc/examples/00_README.txt \
+	doc/examples/01_compress_easy.c \
+	doc/examples/02_decompress.c \
+	doc/examples/03_compress_custom.c \
+	doc/examples/Makefile
+
+examplesolddir = $(docdir)/examples_old
+dist_examplesold_DATA = \
+	doc/examples_old/xz_pipe_comp.c \
+	doc/examples_old/xz_pipe_decomp.c
 
 EXTRA_DIST = \
 	extra \
diff --git a/NEWS b/NEWS
index e3ea498..4420b6a 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,43 @@
 XZ Utils Release Notes
 ======================
 
+5.0.4 (2012-06-22)
+
+    * liblzma:
+
+        - Fix lzma_index_init(). It could crash if memory allocation
+          failed.
+
+        - Fix the possibility of an incorrect LZMA_BUF_ERROR when a BCJ
+          filter is used and the application only provides exactly as
+          much output space as is the uncompressed size of the file.
+
+        - Fix a bug in doc/examples_old/xz_pipe_decompress.c. It didn't
+          check if the last call to lzma_code() really returned
+          LZMA_STREAM_END, which made the program think that truncated
+          files are valid.
+
+        - New example programs in doc/examples (old programs are now in
+          doc/examples_old). These have more comments and more detailed
+          error handling.
+
+    * Fix "xz -lvv foo.xz". It could crash on some corrupted files.
+
+    * Fix output of "xz --robot -lv" and "xz --robot -lvv" which
+      incorrectly printed the filename also in the "foo (x/x)" format.
+
+    * Fix exit status of "xzdiff foo.xz bar.xz".
+
+    * Fix exit status of "xzgrep foo binary_file".
+
+    * Fix portability to EBCDIC systems.
+
+    * Fix a configure issue on AIX with the XL C compiler. See INSTALL
+      for details.
+
+    * Update French, German, Italian, and Polish translations.
+
+
 5.0.3 (2011-05-21)
 
     * liblzma fixes:
diff --git a/README b/README
index d6cfda7..1b02f05 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@
     0. Overview
     1. Documentation
        1.1. Overall documentation
-       1.2. Documentation for command line tools
+       1.2. Documentation for command-line tools
        1.3. Documentation for liblzma
     2. Version numbering
     3. Reporting bugs
@@ -17,21 +17,21 @@
 0. Overview
 -----------
 
-    XZ Utils provide a general-purpose data compression library and
-    command line tools. The native file format is the .xz format, but
+    XZ Utils provide a general-purpose data-compression library plus
+    command-line tools. The native file format is the .xz format, but
     also the legacy .lzma format is supported. The .xz format supports
-    multiple compression algorithms, which are called "filters" in
+    multiple compression algorithms, which are called "filters" in the
     context of XZ Utils. The primary filter is currently LZMA2. With
     typical files, XZ Utils create about 30 % smaller files than gzip.
 
     To ease adapting support for the .xz format into existing applications
     and scripts, the API of liblzma is somewhat similar to the API of the
-    popular zlib library. For the same reason, the command line tool xz
-    has similar command line syntax than that of gzip.
+    popular zlib library. For the same reason, the command-line tool xz
+    has a command-line syntax similar to that of gzip.
 
-    When aiming for the highest compression ratio, LZMA2 encoder uses
+    When aiming for the highest compression ratio, the LZMA2 encoder uses
     a lot of CPU time and may use, depending on the settings, even
-    hundreds of megabytes of RAM. However, in fast modes, LZMA2 encoder
+    hundreds of megabytes of RAM. However, in fast modes, the LZMA2 encoder
     competes with bzip2 in compression speed, RAM usage, and compression
     ratio.
 
@@ -44,8 +44,8 @@
     since that needs to be done only once to benefit many people.
 
     With some file types, combining (or "chaining") LZMA2 with an
-    additional filter can improve compression ratio. A filter chain may
-    contain up to four filters, although usually only one two is used.
+    additional filter can improve the compression ratio. A filter chain may
+    contain up to four filters, although usually only one or two are used.
     For example, putting a BCJ (Branch/Call/Jump) filter before LZMA2
     in the filter chain can improve compression ratio of executable files.
 
@@ -88,9 +88,9 @@
     packages.
 
 
-1.2. Documentation for command line tools
+1.2. Documentation for command-line tools
 
-    The command line tools are documented as man pages. In source code
+    The command-line tools are documented as man pages. In source code
     releases (and possibly also in some binary packages), the man pages
     are also provided in plain text (ASCII only) and PDF formats in the
     directory "doc/man" to make the man pages more accessible to those
@@ -109,8 +109,8 @@
     written yet.
 
     For now, if you have never used liblzma, libbzip2, or zlib, I
-    recommend learning *basics* of zlib API. Once you know that, it
-    should be easier to learn liblzma.
+    recommend learning the *basics* of the zlib API. Once you know that,
+    it should be easier to learn liblzma.
 
         http://zlib.net/manual.html
         http://zlib.net/zlib_how.html
@@ -124,23 +124,27 @@
       - X is the major version. When this is incremented, the library
         API and ABI break.
 
-      - Y is the minor version. It is incremented when new features are
-        added without breaking existing API or ABI. Even Y indicates
-        stable release and odd Y indicates unstable (alpha or beta
-        version).
+      - Y is the minor version. It is incremented when new features
+        are added without breaking the existing API or ABI. An even Y
+        indicates a stable release and an odd Y indicates unstable
+        (alpha or beta version).
 
-      - Z is the revision. This has different meaning for stable and
+      - Z is the revision. This has a different meaning for stable and
         unstable releases:
+
           * Stable: Z is incremented when bugs get fixed without adding
-            any new features.
+            any new features. This is intended to be convenient for
+            downstream distributors that want bug fixes but don't want
+            any new features to minimize the risk of introducing new bugs.
+
           * Unstable: Z is just a counter. API or ABI of features added
             in earlier unstable releases having the same X.Y may break.
 
       - S indicates stability of the release. It is missing from the
-        stable releases where Y is an even number. When Y is odd, S
+        stable releases, where Y is an even number. When Y is odd, S
         is either "alpha" or "beta" to make it very clear that such
         versions are not stable releases. The same X.Y.Z combination is
-        not used for more than one stability level i.e. after X.Y.Zalpha,
+        not used for more than one stability level, i.e. after X.Y.Zalpha,
         the next version can be X.Y.(Z+1)beta but not X.Y.Zbeta.
 
 
@@ -176,7 +180,7 @@
     Don't send core dump files or any executables. If you have a small
     example file(s) (total size less than 256 KiB), please include
     it/them as an attachment. If you have bigger test files, put them
-    online somewhere and include an URL to the file(s) in the bug report.
+    online somewhere and include a URL to the file(s) in the bug report.
 
     Always include the exact version number of XZ Utils in the bug report.
     If you are using a snapshot from the git repository, use "git describe"
@@ -193,7 +197,7 @@
 
     The messages from the xz tool have been translated into a few
     languages. Before starting to translate into a new language, ask
-    the author that someone else hasn't already started working on it.
+    the author whether someone else hasn't already started working on it.
 
     Test your translation. Testing includes comparing the translated
     output to the original English version by running the same commands
@@ -214,7 +218,7 @@
     Note especially the following:
 
       - The output of --help and --long-help must look nice on
-        a 80-column terminal. It's OK to add extra lines if needed.
+        an 80-column terminal. It's OK to add extra lines if needed.
 
       - In contrast, don't add extra lines to error messages and such.
         They are often preceded with e.g. a filename on the same line,
diff --git a/README.chromium b/README.chromium
deleted file mode 100644
index c2722ae..0000000
--- a/README.chromium
+++ /dev/null
@@ -1,5 +0,0 @@
-Name: XZ Utils

-Short Name: xz

-URL: http://tukaani.org/xz/

-Version: 4.999.9beta

-Revision: c15c42abb3c8c6e77c778ef06c97a4a10b8b5d00
\ No newline at end of file
diff --git a/THANKS b/THANKS
index 70303e0..b13503e 100644
--- a/THANKS
+++ b/THANKS
@@ -14,16 +14,19 @@
   - Jakub Bogusz
   - Maarten Bosmans
   - Trent W. Buck
+  - James Buren
   - David Burklund
   - Daniel Mealha Cabrita
   - Milo Casagrande
   - Marek Černocký
+  - Chris Donawa
   - Andrew Dudman
   - Markus Duft
   - İsmail Dönmez
   - Robert Elz
   - Gilles Espinasse
   - Denis Excoffier
+  - Michael Felt
   - Mike Frysinger
   - Jason Gorski
   - Juan Manuel Guerrero
@@ -38,8 +41,10 @@
   - Peter Lawler
   - Hin-Tak Leung
   - Andraž 'ruskie' Levstik
+  - Cary Lewis
   - Wim Lewis
   - Lorenzo De Liso
+  - Bela Lubkin
   - Gregory Margo
   - Jim Meyering
   - Rafał Mużyło
@@ -48,6 +53,7 @@
   - Jonathan Nieder
   - Andre Noll
   - Peter O'Gorman
+  - Peter Pallinger
   - Igor Pavlov
   - Diego Elio Pettenò
   - Elbert Pol
@@ -58,6 +64,7 @@
   - Christian von Roques
   - Jukka Salmi
   - Alexandre Sauvé
+  - Benno Schulenberg
   - Andreas Schwab
   - Dan Shechter
   - Stuart Shelton
diff --git a/configure.ac b/configure.ac
index 39fd0ef..f0ccef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -431,10 +431,14 @@
 if test "x$enable_threads" = xyes; then
 	echo
 	echo "Threading support:"
-	ACX_PTHREAD
+	AX_PTHREAD
 	LIBS="$LIBS $PTHREAD_LIBS"
 	AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
-	CC="$PTHREAD_CC"
+
+	dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX, but
+	dnl it's tricky to get it right together with AC_PROG_CC_C99.
+	dnl Thus, this is handled by telling the user in INSTALL to set
+	dnl the correct CC manually.
 fi
 
 echo
@@ -627,13 +631,13 @@
 	src/xzdec/Makefile
 	src/lzmainfo/Makefile
 	src/scripts/Makefile
-	src/scripts/xzdiff
-	src/scripts/xzgrep
-	src/scripts/xzmore
-	src/scripts/xzless
 	tests/Makefile
 	debug/Makefile
 ])
+AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
+AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
+AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
+AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
 
 AC_OUTPUT
 
diff --git a/doc/examples/00_README.txt b/doc/examples/00_README.txt
new file mode 100644
index 0000000..a3b9eaa
--- /dev/null
+++ b/doc/examples/00_README.txt
@@ -0,0 +1,27 @@
+
+liblzma example programs
+========================
+
+Introduction
+
+    The examples are written so that the same comments aren't
+    repeated (much) in later files.
+
+    On POSIX systems, the examples should build by just typing "make".
+
+    The examples that use stdin or stdout don't set stdin and stdout
+    to binary mode. On systems where it matters (e.g. Windows) it is
+    possible that the examples won't work without modification.
+
+
+List of examples
+
+    01_compress_easy.c                  Multi-call compression using
+                                        a compression preset
+
+    02_decompress.c                     Multi-call decompression
+
+    03_compress_custom.c                Like 01_compress_easy.c but using
+                                        a custom filter chain
+                                        (x86 BCJ + LZMA2)
+
diff --git a/doc/examples/01_compress_easy.c b/doc/examples/01_compress_easy.c
new file mode 100644
index 0000000..e6dd2b0
--- /dev/null
+++ b/doc/examples/01_compress_easy.c
@@ -0,0 +1,297 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file       01_compress_easy.c
+/// \brief      Compress from stdin to stdout in multi-call mode
+///
+/// Usage:      ./01_compress_easy PRESET < INFILE > OUTFILE
+///
+/// Example:    ./01_compress_easy 6 < foo > foo.xz
+//
+//  Author:     Lasse Collin
+//
+//  This file has been put into the public domain.
+//  You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <lzma.h>
+
+
+static void
+show_usage_and_exit(const char *argv0)
+{
+	fprintf(stderr, "Usage: %s PRESET < INFILE > OUTFILE\n"
+			"PRESET is a number 0-9 and can optionally be "
+			"followed by `e' to indicate extreme preset\n",
+			argv0);
+	exit(EXIT_FAILURE);
+}
+
+
+static uint32_t
+get_preset(int argc, char **argv)
+{
+	// One argument whose first char must be 0-9.
+	if (argc != 2 || argv[1][0] < '0' || argv[1][0] > '9')
+		show_usage_and_exit(argv[0]);
+
+	// Calculate the preste level 0-9.
+	uint32_t preset = argv[1][0] - '0';
+
+	// If there is a second char, it must be 'e'. It will set
+	// the LZMA_PRESET_EXTREME flag.
+	if (argv[1][1] != '\0') {
+		if (argv[1][1] != 'e' || argv[1][2] != '\0')
+			show_usage_and_exit(argv[0]);
+
+		preset |= LZMA_PRESET_EXTREME;
+	}
+
+	return preset;
+}
+
+
+static bool
+init_encoder(lzma_stream *strm, uint32_t preset)
+{
+	// Initialize the encoder using a preset. Set the integrity to check
+	// to CRC64, which is the default in the xz command line tool. If
+	// the .xz file needs to be decompressed with XZ Embedded, use
+	// LZMA_CHECK_CRC32 instead.
+	lzma_ret ret = lzma_easy_encoder(strm, preset, LZMA_CHECK_CRC64);
+
+	// Return successfully if the initialization went fine.
+	if (ret == LZMA_OK)
+		return true;
+
+	// Something went wrong. The possible errors are documented in
+	// lzma/container.h (src/liblzma/api/lzma/container.h in the source
+	// package or e.g. /usr/include/lzma/container.h depending on the
+	// install prefix).
+	const char *msg;
+	switch (ret) {
+	case LZMA_MEM_ERROR:
+		msg = "Memory allocation failed";
+		break;
+
+	case LZMA_OPTIONS_ERROR:
+		msg = "Specified preset is not supported";
+		break;
+
+	case LZMA_UNSUPPORTED_CHECK:
+		msg = "Specified integrity check is not supported";
+		break;
+
+	default:
+		// This is most likely LZMA_PROG_ERROR indicating a bug in
+		// this program or in liblzma. It is inconvenient to have a
+		// separate error message for errors that should be impossible
+		// to occur, but knowing the error code is important for
+		// debugging. That's why it is good to print the error code
+		// at least when there is no good error message to show.
+		msg = "Unknown error, possibly a bug";
+		break;
+	}
+
+	fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
+			msg, ret);
+	return false;
+}
+
+
+static bool
+compress(lzma_stream *strm, FILE *infile, FILE *outfile)
+{
+	// This will be LZMA_RUN until the end of the input file is reached.
+	// This tells lzma_code() when there will be no more input.
+	lzma_action action = LZMA_RUN;
+
+	// Buffers to temporarily hold uncompressed input
+	// and compressed output.
+	uint8_t inbuf[BUFSIZ];
+	uint8_t outbuf[BUFSIZ];
+
+	// Initialize the input and output pointers. Initializing next_in
+	// and avail_in isn't really necessary when we are going to encode
+	// just one file since LZMA_STREAM_INIT takes care of initializing
+	// those already. But it doesn't hurt much and it will be needed
+	// if encoding more than one file like we will in 02_decompress.c.
+	//
+	// While we don't care about strm->total_in or strm->total_out in this
+	// example, it is worth noting that initializing the encoder will
+	// always reset total_in and total_out to zero. But the encoder
+	// initialization doesn't touch next_in, avail_in, next_out, or
+	// avail_out.
+	strm->next_in = NULL;
+	strm->avail_in = 0;
+	strm->next_out = outbuf;
+	strm->avail_out = sizeof(outbuf);
+
+	// Loop until the file has been successfully compressed or until
+	// an error occurs.
+	while (true) {
+		// Fill the input buffer if it is empty.
+		if (strm->avail_in == 0 && !feof(infile)) {
+			strm->next_in = inbuf;
+			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
+					infile);
+
+			if (ferror(infile)) {
+				fprintf(stderr, "Read error: %s\n",
+						strerror(errno));
+				return false;
+			}
+
+			// Once the end of the input file has been reached,
+			// we need to tell lzma_code() that no more input
+			// will be coming and that it should finish the
+			// encoding.
+			if (feof(infile))
+				action = LZMA_FINISH;
+		}
+
+		// Tell liblzma do the actual encoding.
+		//
+		// This reads up to strm->avail_in bytes of input starting
+		// from strm->next_in. avail_in will be decremented and
+		// next_in incremented by an equal amount to match the
+		// number of input bytes consumed.
+		//
+		// Up to strm->avail_out bytes of compressed output will be
+		// written starting from strm->next_out. avail_out and next_out
+		// will be incremented by an equal amount to match the number
+		// of output bytes written.
+		//
+		// The encoder has to do internal buffering, which means that
+		// it may take quite a bit of input before the same data is
+		// available in compressed form in the output buffer.
+		lzma_ret ret = lzma_code(strm, action);
+
+		// If the output buffer is full or if the compression finished
+		// successfully, write the data from the output bufffer to
+		// the output file.
+		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
+			// When lzma_code() has returned LZMA_STREAM_END,
+			// the output buffer is likely to be only partially
+			// full. Calculate how much new data there is to
+			// be written to the output file.
+			size_t write_size = sizeof(outbuf) - strm->avail_out;
+
+			if (fwrite(outbuf, 1, write_size, outfile)
+					!= write_size) {
+				fprintf(stderr, "Write error: %s\n",
+						strerror(errno));
+				return false;
+			}
+
+			// Reset next_out and avail_out.
+			strm->next_out = outbuf;
+			strm->avail_out = sizeof(outbuf);
+		}
+
+		// Normally the return value of lzma_code() will be LZMA_OK
+		// until everything has been encoded.
+		if (ret != LZMA_OK) {
+			// Once everything has been encoded successfully, the
+			// return value of lzma_code() will be LZMA_STREAM_END.
+			//
+			// It is important to check for LZMA_STREAM_END. Do not
+			// assume that getting ret != LZMA_OK would mean that
+			// everything has gone well.
+			if (ret == LZMA_STREAM_END)
+				return true;
+
+			// It's not LZMA_OK nor LZMA_STREAM_END,
+			// so it must be an error code. See lzma/base.h
+			// (src/liblzma/api/lzma/base.h in the source package
+			// or e.g. /usr/include/lzma/base.h depending on the
+			// install prefix) for the list and documentation of
+			// possible values. Most values listen in lzma_ret
+			// enumeration aren't possible in this example.
+			const char *msg;
+			switch (ret) {
+			case LZMA_MEM_ERROR:
+				msg = "Memory allocation failed";
+				break;
+
+			case LZMA_DATA_ERROR:
+				// This error is returned if the compressed
+				// or uncompressed size get near 8 EiB
+				// (2^63 bytes) because that's where the .xz
+				// file format size limits currently are.
+				// That is, the possibility of this error
+				// is mostly theoretical unless you are doing
+				// something very unusual.
+				//
+				// Note that strm->total_in and strm->total_out
+				// have nothing to do with this error. Changing
+				// those variables won't increase or decrease
+				// the chance of getting this error.
+				msg = "File size limits exceeded";
+				break;
+
+			default:
+				// This is most likely LZMA_PROG_ERROR, but
+				// if this program is buggy (or liblzma has
+				// a bug), it may be e.g. LZMA_BUF_ERROR or
+				// LZMA_OPTIONS_ERROR too.
+				//
+				// It is inconvenient to have a separate
+				// error message for errors that should be
+				// impossible to occur, but knowing the error
+				// code is important for debugging. That's why
+				// it is good to print the error code at least
+				// when there is no good error message to show.
+				msg = "Unknown error, possibly a bug";
+				break;
+			}
+
+			fprintf(stderr, "Encoder error: %s (error code %u)\n",
+					msg, ret);
+			return false;
+		}
+	}
+}
+
+
+extern int
+main(int argc, char **argv)
+{
+	// Get the preset number from the command line.
+	uint32_t preset = get_preset(argc, argv);
+
+	// Initialize a lzma_stream structure. When it is allocated on stack,
+	// it is simplest to use LZMA_STREAM_INIT macro like below. When it
+	// is allocated on heap, using memset(strmptr, 0, sizeof(*strmptr))
+	// works (as long as NULL pointers are represented with zero bits
+	// as they are on practically all computers today).
+	lzma_stream strm = LZMA_STREAM_INIT;
+
+	// Initialize the encoder. If it succeeds, compress from
+	// stdin to stdout.
+	bool success = init_encoder(&strm, preset);
+	if (success)
+		success = compress(&strm, stdin, stdout);
+
+	// Free the memory allocated for the encoder. If we were encoding
+	// multiple files, this would only need to be done after the last
+	// file. See 02_decompress.c for handling of multiple files.
+	//
+	// It is OK to call lzma_end() multiple times or when it hasn't been
+	// actually used except initialized with LZMA_STREAM_INIT.
+	lzma_end(&strm);
+
+	// Close stdout to catch possible write errors that can occur
+	// when pending data is flushed from the stdio buffers.
+	if (fclose(stdout)) {
+		fprintf(stderr, "Write error: %s\n", strerror(errno));
+		success = false;
+	}
+
+	return success ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/doc/examples/02_decompress.c b/doc/examples/02_decompress.c
new file mode 100644
index 0000000..4c0f37c
--- /dev/null
+++ b/doc/examples/02_decompress.c
@@ -0,0 +1,287 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file       02_decompress.c
+/// \brief      Decompress .xz files to stdout
+///
+/// Usage:      ./02_decompress INPUT_FILES... > OUTFILE
+///
+/// Example:    ./02_decompress foo.xz bar.xz > foobar
+//
+//  Author:     Lasse Collin
+//
+//  This file has been put into the public domain.
+//  You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <lzma.h>
+
+
+static bool
+init_decoder(lzma_stream *strm)
+{
+	// Initialize a .xz decoder. The decoder supports a memory usage limit
+	// and a set of flags.
+	//
+	// The memory usage of the decompressor depends on the settings used
+	// to compress a .xz file. It can vary from less than a megabyte to
+	// a few gigabytes, but in practice (at least for now) it rarely
+	// exceeds 65 MiB because that's how much memory is required to
+	// decompress files created with "xz -9". Settings requiring more
+	// memory take extra effort to use and don't (at least for now)
+	// provide significantly better compression in most cases.
+	//
+	// Memory usage limit is useful if it is important that the
+	// decompressor won't consume gigabytes of memory. The need
+	// for limiting depends on the application. In this example,
+	// no memory usage limiting is used. This is done by setting
+	// the limit to UINT64_MAX.
+	//
+	// The .xz format allows concatenating compressed files as is:
+	//
+	//     echo foo | xz > foobar.xz
+	//     echo bar | xz >> foobar.xz
+	//
+	// When decompressing normal standalone .xz files, LZMA_CONCATENATED
+	// should always be used to support decompression of concatenated
+	// .xz files. If LZMA_CONCATENATED isn't used, the decoder will stop
+	// after the first .xz stream. This can be useful when .xz data has
+	// been embedded inside another file format.
+	//
+	// Flags other than LZMA_CONCATENATED are supported too, and can
+	// be combined with bitwise-or. See lzma/container.h
+	// (src/liblzma/api/lzma/container.h in the source package or e.g.
+	// /usr/include/lzma/container.h depending on the install prefix)
+	// for details.
+	lzma_ret ret = lzma_stream_decoder(
+			strm, UINT64_MAX, LZMA_CONCATENATED);
+
+	// Return successfully if the initialization went fine.
+	if (ret == LZMA_OK)
+		return true;
+
+	// Something went wrong. The possible errors are documented in
+	// lzma/container.h (src/liblzma/api/lzma/container.h in the source
+	// package or e.g. /usr/include/lzma/container.h depending on the
+	// install prefix).
+	//
+	// Note that LZMA_MEMLIMIT_ERROR is never possible here. If you
+	// specify a very tiny limit, the error will be delayed until
+	// the first headers have been parsed by a call to lzma_code().
+	const char *msg;
+	switch (ret) {
+	case LZMA_MEM_ERROR:
+		msg = "Memory allocation failed";
+		break;
+
+	case LZMA_OPTIONS_ERROR:
+		msg = "Unsupported decompressor flags";
+		break;
+
+	default:
+		// This is most likely LZMA_PROG_ERROR indicating a bug in
+		// this program or in liblzma. It is inconvenient to have a
+		// separate error message for errors that should be impossible
+		// to occur, but knowing the error code is important for
+		// debugging. That's why it is good to print the error code
+		// at least when there is no good error message to show.
+		msg = "Unknown error, possibly a bug";
+		break;
+	}
+
+	fprintf(stderr, "Error initializing the decoder: %s (error code %u)\n",
+			msg, ret);
+	return false;
+}
+
+
+static bool
+decompress(lzma_stream *strm, const char *inname, FILE *infile, FILE *outfile)
+{
+	// When LZMA_CONCATENATED flag was used when initializing the decoder,
+	// we need to tell lzma_code() when there will be no more input.
+	// This is done by setting action to LZMA_FINISH instead of LZMA_RUN
+	// in the same way as it is done when encoding.
+	//
+	// When LZMA_CONCATENATED isn't used, there is no need to use
+	// LZMA_FINISH to tell when all the input has been read, but it
+	// is still OK to use it if you want. When LZMA_CONCATENATED isn't
+	// used, the decoder will stop after the first .xz stream. In that
+	// case some unused data may be left in strm->next_in.
+	lzma_action action = LZMA_RUN;
+
+	uint8_t inbuf[BUFSIZ];
+	uint8_t outbuf[BUFSIZ];
+
+	strm->next_in = NULL;
+	strm->avail_in = 0;
+	strm->next_out = outbuf;
+	strm->avail_out = sizeof(outbuf);
+
+	while (true) {
+		if (strm->avail_in == 0 && !feof(infile)) {
+			strm->next_in = inbuf;
+			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
+					infile);
+
+			if (ferror(infile)) {
+				fprintf(stderr, "%s: Read error: %s\n",
+						inname, strerror(errno));
+				return false;
+			}
+
+			// Once the end of the input file has been reached,
+			// we need to tell lzma_code() that no more input
+			// will be coming. As said before, this isn't required
+			// if the LZMA_CONATENATED flag isn't used when
+			// initializing the decoder.
+			if (feof(infile))
+				action = LZMA_FINISH;
+		}
+
+		lzma_ret ret = lzma_code(strm, action);
+
+		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
+			size_t write_size = sizeof(outbuf) - strm->avail_out;
+
+			if (fwrite(outbuf, 1, write_size, outfile)
+					!= write_size) {
+				fprintf(stderr, "Write error: %s\n",
+						strerror(errno));
+				return false;
+			}
+
+			strm->next_out = outbuf;
+			strm->avail_out = sizeof(outbuf);
+		}
+
+		if (ret != LZMA_OK) {
+			// Once everything has been decoded successfully, the
+			// return value of lzma_code() will be LZMA_STREAM_END.
+			//
+			// It is important to check for LZMA_STREAM_END. Do not
+			// assume that getting ret != LZMA_OK would mean that
+			// everything has gone well or that when you aren't
+			// getting more output it must have successfully
+			// decoded everything.
+			if (ret == LZMA_STREAM_END)
+				return true;
+
+			// It's not LZMA_OK nor LZMA_STREAM_END,
+			// so it must be an error code. See lzma/base.h
+			// (src/liblzma/api/lzma/base.h in the source package
+			// or e.g. /usr/include/lzma/base.h depending on the
+			// install prefix) for the list and documentation of
+			// possible values. Many values listen in lzma_ret
+			// enumeration aren't possible in this example, but
+			// can be made possible by enabling memory usage limit
+			// or adding flags to the decoder initialization.
+			const char *msg;
+			switch (ret) {
+			case LZMA_MEM_ERROR:
+				msg = "Memory allocation failed";
+				break;
+
+			case LZMA_FORMAT_ERROR:
+				// .xz magic bytes weren't found.
+				msg = "The input is not in the .xz format";
+				break;
+
+			case LZMA_OPTIONS_ERROR:
+				// For example, the headers specify a filter
+				// that isn't supported by this liblzma
+				// version (or it hasn't been enabled when
+				// building liblzma, but no-one sane does
+				// that unless building liblzma for an
+				// embedded system). Upgrading to a newer
+				// liblzma might help.
+				//
+				// Note that it is unlikely that the file has
+				// accidentally became corrupt if you get this
+				// error. The integrity of the .xz headers is
+				// always verified with a CRC32, so
+				// unintentionally corrupt files can be
+				// distinguished from unsupported files.
+				msg = "Unsupported compression options";
+				break;
+
+			case LZMA_DATA_ERROR:
+				msg = "Compressed file is corrupt";
+				break;
+
+			case LZMA_BUF_ERROR:
+				// Typically this error means that a valid
+				// file has got truncated, but it might also
+				// be a damaged part in the file that makes
+				// the decoder think the file is truncated.
+				// If you prefer, you can use the same error
+				// message for this as for LZMA_DATA_ERROR.
+				msg = "Compressed file is truncated or "
+						"otherwise corrupt";
+				break;
+
+			default:
+				// This is most likely LZMA_PROG_ERROR.
+				msg = "Unknown error, possibly a bug";
+				break;
+			}
+
+			fprintf(stderr, "%s: Decoder error: "
+					"%s (error code %u)\n",
+					inname, msg, ret);
+			return false;
+		}
+	}
+}
+
+
+extern int
+main(int argc, char **argv)
+{
+	if (argc <= 1) {
+		fprintf(stderr, "Usage: %s FILES...\n", argv[0]);
+		return EXIT_FAILURE;
+	}
+
+	lzma_stream strm = LZMA_STREAM_INIT;
+
+	bool success = true;
+
+	// Try to decompress all files.
+	for (int i = 1; i < argc; ++i) {
+		if (!init_decoder(&strm)) {
+			// Decoder initialization failed. There's no point
+			// to retry it so we need to exit.
+			success = false;
+			break;
+		}
+
+		FILE *infile = fopen(argv[i], "rb");
+
+		if (infile == NULL) {
+			fprintf(stderr, "%s: Error opening the "
+					"input file: %s\n",
+					argv[i], strerror(errno));
+			success = false;
+		} else {
+			success &= decompress(&strm, argv[i], infile, stdout);
+			fclose(infile);
+		}
+	}
+
+	// Free the memory allocated for the decoder. This only needs to be
+	// done after the last file.
+	lzma_end(&strm);
+
+	if (fclose(stdout)) {
+		fprintf(stderr, "Write error: %s\n", strerror(errno));
+		success = false;
+	}
+
+	return success ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/doc/examples/03_compress_custom.c b/doc/examples/03_compress_custom.c
new file mode 100644
index 0000000..51abbb1
--- /dev/null
+++ b/doc/examples/03_compress_custom.c
@@ -0,0 +1,193 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file       03_compress_custom.c
+/// \brief      Compress in multi-call mode using x86 BCJ and LZMA2
+///
+/// Usage:      ./03_compress_custom < INFILE > OUTFILE
+///
+/// Example:    ./03_compress_custom < foo > foo.xz
+//
+//  Author:     Lasse Collin
+//
+//  This file has been put into the public domain.
+//  You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <lzma.h>
+
+
+static bool
+init_encoder(lzma_stream *strm)
+{
+	// Use the default preset (6) for LZMA2.
+	//
+	// The lzma_options_lzma structure and the lzma_lzma_preset() function
+	// are declared in lzma/lzma.h (src/liblzma/api/lzma/lzma.h in the
+	// source package or e.g. /usr/include/lzma/lzma.h depending on
+	// the install prefix).
+	lzma_options_lzma opt_lzma2;
+	if (lzma_lzma_preset(&opt_lzma2, LZMA_PRESET_DEFAULT)) {
+		// It should never fail because the default preset
+		// (and presets 0-9 optionally with LZMA_PRESET_EXTREME)
+		// are supported by all stable liblzma versions.
+		//
+		// (The encoder initialization later in this function may
+		// still fail due to unsupported preset *if* the features
+		// required by the preset have been disabled at build time,
+		// but no-one does such things except on embedded systems.)
+		fprintf(stderr, "Unsupported preset, possibly a bug\n");
+		return false;
+	}
+
+	// Now we could customize the LZMA2 options if we wanted. For example,
+	// we could set the the dictionary size (opt_lzma2.dict_size) to
+	// something else than the default (8 MiB) of the default preset.
+	// See lzma/lzma.h for details of all LZMA2 options.
+	//
+	// The x86 BCJ filter will try to modify the x86 instruction stream so
+	// that LZMA2 can compress it better. The x86 BCJ filter doesn't need
+	// any options so it will be set to NULL below.
+	//
+	// Construct the filter chain. The uncompressed data goes first to
+	// the first filter in the array, in this case the x86 BCJ filter.
+	// The array is always terminated by setting .id = LZMA_VLI_UNKNOWN.
+	//
+	// See lzma/filter.h for more information about the lzma_filter
+	// structure.
+	lzma_filter filters[] = {
+		{ .id = LZMA_FILTER_X86, .options = NULL },
+		{ .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
+		{ .id = LZMA_VLI_UNKNOWN, .options = NULL },
+	};
+
+	// Initialize the encoder using the custom filter chain.
+	lzma_ret ret = lzma_stream_encoder(strm, filters, LZMA_CHECK_CRC64);
+
+	if (ret == LZMA_OK)
+		return true;
+
+	const char *msg;
+	switch (ret) {
+	case LZMA_MEM_ERROR:
+		msg = "Memory allocation failed";
+		break;
+
+	case LZMA_OPTIONS_ERROR:
+		// We are no longer using a plain preset so this error
+		// message has been edited accordingly compared to
+		// 01_compress_easy.c.
+		msg = "Specified filter chain is not supported";
+		break;
+
+	case LZMA_UNSUPPORTED_CHECK:
+		msg = "Specified integrity check is not supported";
+		break;
+
+	default:
+		msg = "Unknown error, possibly a bug";
+		break;
+	}
+
+	fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
+			msg, ret);
+	return false;
+}
+
+
+// This function is identical to the one in 01_compress_easy.c.
+static bool
+compress(lzma_stream *strm, FILE *infile, FILE *outfile)
+{
+	lzma_action action = LZMA_RUN;
+
+	uint8_t inbuf[BUFSIZ];
+	uint8_t outbuf[BUFSIZ];
+
+	strm->next_in = NULL;
+	strm->avail_in = 0;
+	strm->next_out = outbuf;
+	strm->avail_out = sizeof(outbuf);
+
+	while (true) {
+		if (strm->avail_in == 0 && !feof(infile)) {
+			strm->next_in = inbuf;
+			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
+					infile);
+
+			if (ferror(infile)) {
+				fprintf(stderr, "Read error: %s\n",
+						strerror(errno));
+				return false;
+			}
+
+			if (feof(infile))
+				action = LZMA_FINISH;
+		}
+
+		lzma_ret ret = lzma_code(strm, action);
+
+		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
+			size_t write_size = sizeof(outbuf) - strm->avail_out;
+
+			if (fwrite(outbuf, 1, write_size, outfile)
+					!= write_size) {
+				fprintf(stderr, "Write error: %s\n",
+						strerror(errno));
+				return false;
+			}
+
+			strm->next_out = outbuf;
+			strm->avail_out = sizeof(outbuf);
+		}
+
+		if (ret != LZMA_OK) {
+			if (ret == LZMA_STREAM_END)
+				return true;
+
+			const char *msg;
+			switch (ret) {
+			case LZMA_MEM_ERROR:
+				msg = "Memory allocation failed";
+				break;
+
+			case LZMA_DATA_ERROR:
+				msg = "File size limits exceeded";
+				break;
+
+			default:
+				msg = "Unknown error, possibly a bug";
+				break;
+			}
+
+			fprintf(stderr, "Encoder error: %s (error code %u)\n",
+					msg, ret);
+			return false;
+		}
+	}
+}
+
+
+extern int
+main(void)
+{
+	lzma_stream strm = LZMA_STREAM_INIT;
+
+	bool success = init_encoder(&strm);
+	if (success)
+		success = compress(&strm, stdin, stdout);
+
+	lzma_end(&strm);
+
+	if (fclose(stdout)) {
+		fprintf(stderr, "Write error: %s\n", strerror(errno));
+		success = false;
+	}
+
+	return success ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
new file mode 100644
index 0000000..644dc32
--- /dev/null
+++ b/doc/examples/Makefile
@@ -0,0 +1,23 @@
+#
+# Author: Lasse Collin
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+
+CC = c99
+CFLAGS = -g
+LDFLAGS = -llzma
+
+PROGS = \
+	01_compress_easy \
+	02_decompress \
+	03_compress_custom
+
+all: $(PROGS)
+
+.c:
+	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+clean:
+	-rm -f $(PROGS)
diff --git a/doc/examples/xz_pipe_comp.c b/doc/examples_old/xz_pipe_comp.c
similarity index 100%
rename from doc/examples/xz_pipe_comp.c
rename to doc/examples_old/xz_pipe_comp.c
diff --git a/doc/examples/xz_pipe_decomp.c b/doc/examples_old/xz_pipe_decomp.c
similarity index 88%
rename from doc/examples/xz_pipe_decomp.c
rename to doc/examples_old/xz_pipe_decomp.c
index d4b204d..fb5ad89 100644
--- a/doc/examples/xz_pipe_decomp.c
+++ b/doc/examples_old/xz_pipe_decomp.c
@@ -1,7 +1,7 @@
 /*
  * xz_pipe_decomp.c
  * A simple example of pipe-only xz decompressor implementation.
- * version: 2010-07-12 - by Daniel Mealha Cabrita
+ * version: 2012-06-14 - by Daniel Mealha Cabrita
  * Not copyrighted -- provided to the public domain.
  *
  * Compiling:
@@ -101,6 +101,14 @@
 		} while (strm.avail_out == 0);
 	}
 
+	/* Bug fix (2012-06-14): If no errors were detected, check
+	   that the last lzma_code() call returned LZMA_STREAM_END.
+	   If not, the file is probably truncated. */
+	if ((ret == RET_OK) && (ret_xz != LZMA_STREAM_END)) {
+		fprintf (stderr, "Input truncated or corrupt\n");
+		ret = RET_ERROR_DECOMPRESSION;
+	}
+
 	lzma_end (&strm);
 	return ret;
 }
diff --git a/doc/faq.txt b/doc/faq.txt
index 36182c2..333bee0 100644
--- a/doc/faq.txt
+++ b/doc/faq.txt
@@ -26,7 +26,7 @@
 A:  7-Zip and LZMA SDK are the original projects. LZMA SDK is roughly
     a subset of the 7-Zip source tree.
 
-    p7zip is 7-Zip's command line tools ported to POSIX-like systems.
+    p7zip is 7-Zip's command-line tools ported to POSIX-like systems.
 
     LZMA Utils provide a gzip-like lzma tool for POSIX-like systems.
     LZMA Utils are based on LZMA SDK. XZ Utils are the successor to
@@ -42,7 +42,7 @@
 A:  When the designing of the .xz format began, the idea was to replace
     the .lzma format and use the same .lzma suffix. It would have been
     quite OK to reuse the suffix when there were very few .lzma files
-    around. However, the old .lzma format become popular before the
+    around. However, the old .lzma format became popular before the
     new format was finished. The new format was renamed to .xz but the
     name of liblzma wasn't changed.
 
@@ -73,7 +73,7 @@
 
     Technically, there is a way to make the conversion relatively fast
     (roughly twice the time that normal decompression takes). Writing
-    such a tool would take quite a bit time though, and would probably
+    such a tool would take quite a bit of time though, and would probably
     be useful to only a few people. If you really want such a conversion
     tool, contact Lasse Collin and offer some money.
 
@@ -84,7 +84,7 @@
 A:  xz -dc foo.tar.xz | tar xf -
 
 
-Q:  Can I recover parts of a broken .xz file (e.g. corrupted CD-R)?
+Q:  Can I recover parts of a broken .xz file (e.g. a corrupted CD-R)?
 
 A:  It may be possible if the file consists of multiple blocks, which
     typically is not the case if the file was created in single-threaded
@@ -94,7 +94,7 @@
 Q:  Is (some part of) XZ Utils patented?
 
 A:  Lasse Collin is not aware of any patents that could affect XZ Utils.
-    However, due to nature of software patents, it's not possible to
+    However, due to the nature of software patents, it's not possible to
     guarantee that XZ Utils isn't affected by any third party patent(s).
 
 
@@ -105,8 +105,8 @@
     filters.
 
     Documenting LZMA and LZMA2 is planned, but for now, there is no other
-    documentation that the source code. Before you begin, you should know
-    the basics of LZ77 and range coding algorithms. LZMA is based on LZ77,
+    documentation than the source code. Before you begin, you should know
+    the basics of LZ77 and range-coding algorithms. LZMA is based on LZ77,
     but LZMA is a lot more complex. Range coding is used to compress
     the final bitstream like Huffman coding is used in Deflate.
 
@@ -148,7 +148,7 @@
 
         xz --check=crc32 --powerpc --lzma2=preset=6e,dict=64KiB
 
-    Adjust dictionary size to get a good compromise between
+    Adjust the dictionary size to get a good compromise between
     compression ratio and decompressor memory usage. Note that
     in single-call decompression mode of XZ Embedded, a big
     dictionary doesn't increase memory usage.
@@ -184,10 +184,10 @@
     The third method is pigz-style threading (I use that name, because
     pigz <http://www.zlib.net/pigz/> uses that method). It doesn't
     affect compression ratio significantly and scales to many cores.
-    The memory usage scales linearly when threads are added. It isn't
-    significant with pigz, because Deflate uses only 32 KiB dictionary,
+    The memory usage scales linearly when threads are added. This isn't
+    significant with pigz, because Deflate uses only a 32 KiB dictionary,
     but with LZMA2 the memory usage will increase dramatically just like
-    with the independent blocks method. There is also a constant
+    with the independent-blocks method. There is also a constant
     computational overhead, which may make pigz-method a bit dull on
     dual-core compared to the parallel match finder method, but with more
     cores the overhead is not a big deal anymore.
@@ -197,7 +197,7 @@
     can cut the memory usage by 50 %.
 
     It is possible that the single-threaded method will be modified to
-    create files indentical to the pigz-style method. We'll see once
+    create files identical to the pigz-style method. We'll see once
     pigz-style threading has been implemented in liblzma.
 
 
diff --git a/doc/history.txt b/doc/history.txt
index c97492e..8545e23 100644
--- a/doc/history.txt
+++ b/doc/history.txt
@@ -4,12 +4,12 @@
 
 Tukaani distribution
 
-    In 2005, there was a small group working on Tukaani distribution, which
-    was a Slackware fork. One of the project goals was to fit the distro on
-    a single 700 MiB ISO-9660 image. Using LZMA instead of gzip helped a
-    lot. Roughly speaking, one could fit data that took 1000 MiB in gzipped
-    form into 700 MiB with LZMA. Naturally compression ratio varied across
-    packages, but this was what we got on average.
+    In 2005, there was a small group working on the Tukaani distribution,
+    which was a Slackware fork. One of the project's goals was to fit the
+    distro on a single 700 MiB ISO-9660 image. Using LZMA instead of gzip
+    helped a lot. Roughly speaking, one could fit data that took 1000 MiB
+    in gzipped form into 700 MiB with LZMA. Naturally, the compression
+    ratio varied across packages, but this was what we got on average.
 
     Slackware packages have traditionally had .tgz as the filename suffix,
     which is an abbreviation of .tar.gz. A logical naming for LZMA
@@ -30,13 +30,13 @@
 First steps of LZMA Utils
 
     The first version of LZMA Utils (4.22.0) included a shell script called
-    lzmash. It was wrapper that had gzip-like command line interface. It
+    lzmash. It was a wrapper that had a gzip-like command-line interface. It
     used the LZMA_Alone tool from LZMA SDK to do all the real work. zgrep,
-    zdiff, and related scripts from gzip were adapted work with LZMA and
+    zdiff, and related scripts from gzip were adapted to work with LZMA and
     were part of the first LZMA Utils release too.
 
     LZMA Utils 4.22.0 included also lzmadec, which was a small (less than
-    10 KiB) decoder-only command line tool. It was written on top of the
+    10 KiB) decoder-only command-line tool. It was written on top of the
     decoder-only C code found from the LZMA SDK. lzmadec was convenient in
     situations where LZMA_Alone (a few hundred KiB) would be too big.
 
@@ -48,33 +48,34 @@
     The lzmash script was an ugly and not very secure hack. The last
     version of LZMA Utils to use lzmash was 4.27.1.
 
-    LZMA Utils 4.32.0beta1 introduced a new lzma command line tool written
+    LZMA Utils 4.32.0beta1 introduced a new lzma command-line tool written
     by Ville Koskinen. It was written in C++, and used the encoder and
-    decoder from C++ LZMA SDK with little modifications. This tool replaced
-    both the lzmash script and the LZMA_Alone command line tool in LZMA
-    Utils.
+    decoder from C++ LZMA SDK with some little modifications. This tool
+    replaced both the lzmash script and the LZMA_Alone command-line tool
+    in LZMA Utils.
 
     Introducing this new tool caused some temporary incompatibilities,
-    because LZMA_Alone executable was simply named lzma like the new
-    command line tool, but they had completely different command line
+    because the LZMA_Alone executable was simply named lzma like the new
+    command-line tool, but they had a completely different command-line
     interface. The file format was still the same.
 
     Lasse wrote liblzmadec, which was a small decoder-only library based
-    on the C code found from LZMA SDK. liblzmadec had API similar to zlib,
-    although there were some significant differences, which made it
+    on the C code found from LZMA SDK. liblzmadec had an API similar to
+    zlib, although there were some significant differences, which made it
     non-trivial to use it in some applications designed for zlib and
     libbzip2.
 
-    The lzmadec command line tool was converted to use liblzmadec.
+    The lzmadec command-line tool was converted to use liblzmadec.
 
-    Alexandre Sauvé helped converting build system to use GNU Autotools.
-    This made is easier to test for certain less portable features needed
-    by the new command line tool.
+    Alexandre Sauvé helped converting the build system to use GNU
+    Autotools. This made it easier to test for certain less portable
+    features needed by the new command-line tool.
 
-    Since the new command line tool never got completely finished (for
-    example, it didn't support LZMA_OPT environment variable), the intent
-    was to not call 4.32.x stable. Similarly, liblzmadec wasn't polished,
-    but appeared to work well enough, so some people started using it too.
+    Since the new command-line tool never got completely finished (for
+    example, it didn't support the LZMA_OPT environment variable), the
+    intent was to not call 4.32.x stable. Similarly, liblzmadec wasn't
+    polished, but appeared to work well enough, so some people started
+    using it too.
 
     Because the development of the third generation of LZMA Utils was
     delayed considerably (3-4 years), the 4.32.x branch had to be kept
@@ -85,16 +86,16 @@
 
 File format problems
 
-    The file format used by LZMA_Alone was primitive. It was designed for
-    embedded systems in mind, and thus provided only minimal set of
-    features. The two biggest problems for non-embedded use were lack of
-    magic bytes and integrity check.
+    The file format used by LZMA_Alone was primitive. It was designed with
+    embedded systems in mind, and thus provided only a minimal set of
+    features. The two biggest problems for non-embedded use were the lack
+    of magic bytes and an integrity check.
 
     Igor and Lasse started developing a new file format with some help
     from Ville Koskinen. Also Mark Adler, Mikko Pouru, H. Peter Anvin,
     and Lars Wirzenius helped with some minor things at some point of the
     development. Designing the new format took quite a long time (actually,
-    too long time would be more appropriate expression). It was mostly
+    too long a time would be a more appropriate expression). It was mostly
     because Lasse was quite slow at getting things done due to personal
     reasons.
 
@@ -102,7 +103,7 @@
     that was already used by the old file format. Switching to the new
     format wouldn't have caused much trouble when the old format wasn't
     used by many people. But since the development of the new format took
-    so long time, the old format got quite popular, and it was decided
+    such a long time, the old format got quite popular, and it was decided
     that the new file format must use a different suffix.
 
     It was decided to use .xz as the suffix of the new file format. The
@@ -125,13 +126,13 @@
     The early versions of XZ Utils were called LZMA Utils. The first
     releases were 4.42.0alphas. They dropped the rest of the C++ LZMA SDK.
     The code was still directly based on LZMA SDK but ported to C and
-    converted from callback API to stateful API. Later, Igor Pavlov made
-    C version of the LZMA encoder too; these ports from C++ to C were
-    independent in LZMA SDK and LZMA Utils.
+    converted from a callback API to a stateful API. Later, Igor Pavlov
+    made a C version of the LZMA encoder too; these ports from C++ to C
+    were independent in LZMA SDK and LZMA Utils.
 
     The core of the new LZMA Utils was liblzma, a compression library with
-    zlib-like API. liblzma supported both the old and new file format. The
-    gzip-like lzma command line tool was rewritten to use liblzma.
+    a zlib-like API. liblzma supported both the old and new file format.
+    The gzip-like lzma command-line tool was rewritten to use liblzma.
 
     The new LZMA Utils code base was renamed to XZ Utils when the name
     of the new file format had been decided. The liblzma compression
@@ -139,7 +140,7 @@
     caused unnecessary breakage in applications already using the early
     liblzma snapshots.
 
-    The xz command line tool can emulate the gzip-like lzma tool by
+    The xz command-line tool can emulate the gzip-like lzma tool by
     creating appropriate symlinks (e.g. lzma -> xz). Thus, practically
     all scripts using the lzma tool from LZMA Utils will work as is with
     XZ Utils (and will keep using the old .lzma format). Still, the .lzma
diff --git a/dos/Makefile b/dos/Makefile
index d67451a..3a02899 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -16,7 +16,7 @@
 STRIP = strip
 CPPFLAGS =
 CFLAGS = -g -Wall -Wextra -Wfatal-errors -march=i386 -mtune=i686 -O2
-LDFLAGS =
+LDFLAGS = -lemu
 
 # NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC >= 4.3.0
 # because time.h uses GNU-style "extern inline".
diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
deleted file mode 100644
index d2b1169..0000000
--- a/m4/acx_pthread.m4
+++ /dev/null
@@ -1,279 +0,0 @@
-##### http://autoconf-archive.cryp.to/acx_pthread.html
-#
-# SYNOPSIS
-#
-#   ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-#
-# DESCRIPTION
-#
-#   This macro figures out how to build C programs using POSIX threads.
-#   It sets the PTHREAD_LIBS output variable to the threads library and
-#   linker flags, and the PTHREAD_CFLAGS output variable to any special
-#   C compiler flags that are needed. (The user can also force certain
-#   compiler flags/libs to be tested by setting these environment
-#   variables.)
-#
-#   Also sets PTHREAD_CC to any special C compiler that is needed for
-#   multi-threaded programs (defaults to the value of CC otherwise).
-#   (This is necessary on AIX to use the special cc_r compiler alias.)
-#
-#   NOTE: You are assumed to not only compile your program with these
-#   flags, but also link it with them as well. e.g. you should link
-#   with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
-#   $LIBS
-#
-#   If you are only building threads programs, you may wish to use
-#   these variables in your default LIBS, CFLAGS, and CC:
-#
-#          LIBS="$PTHREAD_LIBS $LIBS"
-#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-#          CC="$PTHREAD_CC"
-#
-#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-#   constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
-#   that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-#
-#   ACTION-IF-FOUND is a list of shell commands to run if a threads
-#   library is found, and ACTION-IF-NOT-FOUND is a list of commands to
-#   run it if it is not found. If ACTION-IF-FOUND is not specified, the
-#   default action will define HAVE_PTHREAD.
-#
-#   Please let the authors know if this macro fails on any platform, or
-#   if you have any other suggestions or comments. This macro was based
-#   on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
-#   (with help from M. Frigo), as well as ac_pthread and hb_pthread
-#   macros posted by Alejandro Forero Cuervo to the autoconf macro
-#   repository. We are also grateful for the helpful feedback of
-#   numerous users.
-#
-# LAST MODIFICATION
-#
-#   2007-07-29
-#
-# COPYLEFT
-#
-#   Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
-#
-#   This program is free software: you can redistribute it and/or
-#   modify it under the terms of the GNU General Public License as
-#   published by the Free Software Foundation, either version 3 of the
-#   License, or (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#   General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program. If not, see
-#   <http://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright
-#   owner gives unlimited permission to copy, distribute and modify the
-#   configure scripts that are the output of Autoconf when processing
-#   the Macro. You need not follow the terms of the GNU General Public
-#   License when using or distributing such scripts, even though
-#   portions of the text of the Macro appear in them. The GNU General
-#   Public License (GPL) does govern all other use of the material that
-#   constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the
-#   Autoconf Macro released by the Autoconf Macro Archive. When you
-#   make and distribute a modified version of the Autoconf Macro, you
-#   may extend this special exception to the GPL to apply to your
-#   modified version as well.
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
-        save_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-        save_LIBS="$LIBS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
-        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
-        AC_MSG_RESULT($acx_pthread_ok)
-        if test x"$acx_pthread_ok" = xno; then
-                PTHREAD_LIBS=""
-                PTHREAD_CFLAGS=""
-        fi
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try.  Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important.  Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-#       other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-#      doesn't hurt to check since this sometimes defines pthreads too;
-#      also defines -D_REENTRANT)
-#      ... -mt is also the pthreads flag for HP/aCC
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case "${host_cpu}-${host_os}" in
-        *solaris*)
-
-        # On Solaris (at least, for some versions), libc contains stubbed
-        # (non-functional) versions of the pthreads routines, so link-based
-        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
-        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
-        # a function called by this macro, so we could check for that, but
-        # who knows whether they'll stub that too in a future libc.)  So,
-        # we'll just look for -pthreads and -lpthread first:
-
-        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
-        ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
-        case $flag in
-                none)
-                AC_MSG_CHECKING([whether pthreads work without any flags])
-                ;;
-
-                -*)
-                AC_MSG_CHECKING([whether pthreads work with $flag])
-                PTHREAD_CFLAGS="$flag"
-                ;;
-
-		pthread-config)
-		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
-		if test x"$acx_pthread_config" = xno; then continue; fi
-		PTHREAD_CFLAGS="`pthread-config --cflags`"
-		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
-		;;
-
-                *)
-                AC_MSG_CHECKING([for the pthreads library -l$flag])
-                PTHREAD_LIBS="-l$flag"
-                ;;
-        esac
-
-        save_LIBS="$LIBS"
-        save_CFLAGS="$CFLAGS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
-        # Check for various functions.  We must include pthread.h,
-        # since some functions may be macros.  (On the Sequent, we
-        # need a special flag -Kthread to make this header compile.)
-        # We check for pthread_join because it is in -lpthread on IRIX
-        # while pthread_create is in libc.  We check for pthread_attr_init
-        # due to DEC craziness with -lpthreads.  We check for
-        # pthread_cleanup_push because it is one of the few pthread
-        # functions on Solaris that doesn't have a non-functional libc stub.
-        # We try pthread_create on general principles.
-        AC_TRY_LINK([#include <pthread.h>],
-                    [pthread_t th; pthread_join(th, 0);
-                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
-                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
-                    [acx_pthread_ok=yes])
-
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
-
-        AC_MSG_RESULT($acx_pthread_ok)
-        if test "x$acx_pthread_ok" = xyes; then
-                break;
-        fi
-
-        PTHREAD_LIBS=""
-        PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
-        save_LIBS="$LIBS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        save_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
-        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-	AC_MSG_CHECKING([for joinable pthread attribute])
-	attr_name=unknown
-	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
-	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
-                        [attr_name=$attr; break])
-	done
-        AC_MSG_RESULT($attr_name)
-        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
-            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
-                               [Define to necessary symbol if this constant
-                                uses a non-standard name on your system.])
-        fi
-
-        AC_MSG_CHECKING([if more special flags are required for pthreads])
-        flag=no
-        case "${host_cpu}-${host_os}" in
-            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
-            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-        esac
-        AC_MSG_RESULT(${flag})
-        if test "x$flag" != xno; then
-            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
-        fi
-
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
-
-        # More AIX lossage: must compile with xlc_r or cc_r
-	if test x"$GCC" != xyes; then
-          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
-        else
-          PTHREAD_CC=$CC
-	fi
-else
-        PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
-        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
-        :
-else
-        acx_pthread_ok=no
-        $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
new file mode 100644
index 0000000..d90de34
--- /dev/null
+++ b/m4/ax_pthread.m4
@@ -0,0 +1,309 @@
+# ===========================================================================
+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   This macro figures out how to build C programs using POSIX threads. It
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+#   flags that are needed. (The user can also force certain compiler
+#   flags/libs to be tested by setting these environment variables.)
+#
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
+#   is necessary on AIX to use the special cc_r compiler alias.)
+#
+#   NOTE: You are assumed to not only compile your program with these flags,
+#   but also link it with them as well. e.g. you should link with
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+#   If you are only building threads programs, you may wish to use these
+#   variables in your default LIBS, CFLAGS, and CC:
+#
+#     LIBS="$PTHREAD_LIBS $LIBS"
+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#     CC="$PTHREAD_CC"
+#
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+#   Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+#   PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+#   PTHREAD_CFLAGS.
+#
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
+#   will define HAVE_PTHREAD.
+#
+#   Please let the authors know if this macro fails on any platform, or if
+#   you have any other suggestions or comments. This macro was based on work
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
+#   grateful for the helpful feedback of numerous users.
+#
+#   Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#   Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 18
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+        solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+
+        darwin*)
+        ax_pthread_flags="-pthread $ax_pthread_flags"
+        ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+                if test x"$ax_pthread_config" = xno; then continue; fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }],
+                       [pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */])],
+                [ax_pthread_ok=yes],
+                [])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        attr_name=unknown
+        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+                           [int attr = $attr; return attr /* ; */])],
+                [attr_name=$attr; break],
+                [])
+        done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case ${host_os} in
+            aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+            osf* | hpux*) flag="-D_REENTRANT";;
+            solaris*)
+            if test "$GCC" = "yes"; then
+                flag="-D_REENTRANT"
+            else
+                flag="-mt -D_REENTRANT"
+            fi
+            ;;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+            ax_cv_PTHREAD_PRIO_INHERIT, [
+                AC_LINK_IFELSE([
+                    AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=no])
+            ])
+        AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+            AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with xlc_r or cc_r
+        if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+        fi
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        ax_pthread_ok=no
+        $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/macosx/build.sh b/macosx/build.sh
new file mode 100755
index 0000000..d48ee61
--- /dev/null
+++ b/macosx/build.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+###############################################################################
+# Author: Anders F Björklund <afb@users.sourceforge.net>
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+###############################################################################
+
+mkdir -p Root
+mkdir -p Resources
+
+# Abort immediately if something goes wrong.
+set -e
+
+# Clean up if it was already configured.
+[ -f Makefile ] && make distclean
+
+# Build the regular fat program
+
+CC="gcc-4.0" \
+CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
+../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
+
+make
+
+make check
+
+make DESTDIR=`pwd`/Root install
+
+make distclean
+
+# Build the size-optimized program
+
+CC="gcc-4.0" \
+CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
+../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
+
+make -C src/liblzma
+make -C src/xzdec
+make -C src/xzdec DESTDIR=`pwd`/Root install
+
+cp -a ../extra Root/usr/local/share/doc/xz
+
+make distclean
+
+# Strip debugging symbols and make relocatable
+
+for bin in xz lzmainfo xzdec lzmadec; do
+    strip -S Root/usr/local/bin/$bin
+    install_name_tool -change /usr/local/lib/liblzma.5.dylib @executable_path/../lib/liblzma.5.dylib Root/usr/local/bin/$bin
+done
+
+for lib in liblzma.5.dylib; do
+    strip -S Root/usr/local/lib/$lib
+    install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
+done
+
+strip -S  Root/usr/local/lib/liblzma.a
+rm -f Root/usr/local/lib/liblzma.la
+
+# Include pkg-config while making relocatable
+
+sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
+mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
+
+# Create tarball, but without the HFS+ attrib
+
+rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
+
+( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
+
+# Include documentation files for package
+
+cp -p ../README Resources/ReadMe.txt
+cp -p ../COPYING Resources/License.txt
+
+# Make an Installer.app package
+
+ID="org.tukaani.xz"
+VERSION=`cd ..; sh build-aux/version.sh`
+PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
+$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
+
+# Put the package in a disk image
+
+hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
+hdiutil internet-enable -yes -quiet XZ.dmg
+
+echo
+echo "Build completed successfully."
+echo
diff --git a/po/de.po b/po/de.po
index d88b8cd..2427814 100644
--- a/po/de.po
+++ b/po/de.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: XZ Utils 4.999.9beta\n"
 "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
-"POT-Creation-Date: 2010-09-11 17:07+0200\n"
+"POT-Creation-Date: 2012-05-29 17:20+0200\n"
 "PO-Revision-Date: 2010-09-07 20:27+0200\n"
 "Last-Translator:  <maan@systemlinux.org>\n"
 "Language-Team: German\n"
@@ -96,7 +96,7 @@
 msgstr ""
 "%s: Datei scheint umbenannt worden zu sein, daher wird sie nicht gelöscht"
 
-#: src/xz/file_io.c:144 src/xz/file_io.c:590
+#: src/xz/file_io.c:144 src/xz/file_io.c:589
 #, c-format
 msgid "%s: Cannot remove: %s"
 msgstr "%s: Kann nicht löschen: %s"
@@ -126,59 +126,59 @@
 msgid "%s: Is a directory, skipping"
 msgstr "%s: Überspringe Verzeichnis"
 
-#: src/xz/file_io.c:462
+#: src/xz/file_io.c:461
 #, c-format
 msgid "%s: Not a regular file, skipping"
 msgstr "%s: Keine reguläre Datei, überspringe"
 
-#: src/xz/file_io.c:479
+#: src/xz/file_io.c:478
 #, c-format
 msgid "%s: File has setuid or setgid bit set, skipping"
 msgstr "%s: Datei hat das setuid oder setgid Bit gesetzt, überspringe"
 
-#: src/xz/file_io.c:486
+#: src/xz/file_io.c:485
 #, c-format
 msgid "%s: File has sticky bit set, skipping"
 msgstr "%s: Datei hat sticky Bit gesetzt, überspringe"
 
-#: src/xz/file_io.c:493
+#: src/xz/file_io.c:492
 #, c-format
 msgid "%s: Input file has more than one hard link, skipping"
 msgstr "%s: Eingabedatei hat mehr als einen hard link, überspringe"
 
-#: src/xz/file_io.c:714
+#: src/xz/file_io.c:713
 #, c-format
 msgid "Error restoring the O_APPEND flag to standard output: %s"
 msgstr ""
 "Fehler beim Wiederherstellen des O_APPEND flags bei Standard Output: %s"
 
-#: src/xz/file_io.c:726
+#: src/xz/file_io.c:725
 #, c-format
 msgid "%s: Closing the file failed: %s"
 msgstr "%s: Fehler beim Schießen der Datei: %s"
 
-#: src/xz/file_io.c:762 src/xz/file_io.c:946
+#: src/xz/file_io.c:761 src/xz/file_io.c:945
 #, c-format
 msgid "%s: Seeking failed when trying to create a sparse file: %s"
 msgstr ""
 "%s: Positionierungsfehler beim Versuch eine sparse Datei zu erzeugen: %s"
 
-#: src/xz/file_io.c:821
+#: src/xz/file_io.c:820
 #, c-format
 msgid "%s: Read error: %s"
 msgstr "%s: Lesefehler: %s"
 
-#: src/xz/file_io.c:844
+#: src/xz/file_io.c:843
 #, c-format
 msgid "%s: Error seeking the file: %s"
 msgstr "%s: Fehler beim Lesen der Dateinamen: %s"
 
-#: src/xz/file_io.c:854
+#: src/xz/file_io.c:853
 #, c-format
 msgid "%s: Unexpected end of file"
 msgstr "%s: Unerwartetes Ende der Datei"
 
-#: src/xz/file_io.c:904
+#: src/xz/file_io.c:903
 #, c-format
 msgid "%s: Write error: %s"
 msgstr "%s: Schreibfehler: %s"
@@ -212,7 +212,7 @@
 #. but the Check ID is known (here 2). This and other "Unknown-N"
 #. strings are used in tables, so the width must not exceed ten
 #. columns with a fixed-width font. It's OK to omit the dash if
-#. you need space for one extra letter.
+#. you need space for one extra letter, but don't use spaces.
 #: src/xz/list.c:69
 msgid "Unknown-2"
 msgstr "Unbek.2"
@@ -275,41 +275,41 @@
 #. to Ratio, the columns are right aligned. Check and Filename
 #. are left aligned. If you need longer words, it's OK to
 #. use two lines here. Test with "xz -l foo.xz".
-#: src/xz/list.c:612
+#: src/xz/list.c:603
 msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
 msgstr " Str.  Blöcke       Kompr.     Unkompr.  Verh.  Check   Dateiname"
 
-#: src/xz/list.c:652
+#: src/xz/list.c:643
 #, c-format
 msgid "  Streams:            %s\n"
 msgstr "  Ströme:              %s\n"
 
-#: src/xz/list.c:654
+#: src/xz/list.c:645
 #, c-format
 msgid "  Blocks:             %s\n"
 msgstr "  Blöcke:              %s\n"
 
-#: src/xz/list.c:656
+#: src/xz/list.c:647
 #, c-format
 msgid "  Compressed size:    %s\n"
 msgstr "  Größe komprimiert:   %s\n"
 
-#: src/xz/list.c:659
+#: src/xz/list.c:650
 #, c-format
 msgid "  Uncompressed size:  %s\n"
 msgstr "  Größe unkomprimiert: %s\n"
 
-#: src/xz/list.c:662
+#: src/xz/list.c:653
 #, c-format
 msgid "  Ratio:              %s\n"
 msgstr "  Verhältnis:          %s\n"
 
-#: src/xz/list.c:664
+#: src/xz/list.c:655
 #, c-format
 msgid "  Check:              %s\n"
 msgstr "  Check:               %s\n"
 
-#: src/xz/list.c:665
+#: src/xz/list.c:656
 #, c-format
 msgid "  Stream padding:     %s\n"
 msgstr "  Strom Auffüllung:    %s\n"
@@ -317,7 +317,7 @@
 #. TRANSLATORS: The second line is column headings. All except
 #. Check are right aligned; Check is left aligned. Test with
 #. "xz -lv foo.xz".
-#: src/xz/list.c:693
+#: src/xz/list.c:684
 msgid ""
 "  Streams:\n"
 "    Stream    Blocks      CompOffset    UncompOffset        CompSize      "
@@ -329,7 +329,7 @@
 
 #. TRANSLATORS: The second line is column headings. All
 #. except Check are right aligned; Check is left aligned.
-#: src/xz/list.c:748
+#: src/xz/list.c:739
 #, c-format
 msgid ""
 "  Blocks:\n"
@@ -347,53 +347,53 @@
 #. are right aligned. %*s is replaced with 0-120
 #. spaces to make the CheckVal column wide enough.
 #. Test with "xz -lvv foo.xz".
-#: src/xz/list.c:760
+#: src/xz/list.c:751
 #, c-format
 msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
 msgstr "      CheckWert %*s  Kopf  Schalter    KompGröße    Speicher  Filter"
 
-#: src/xz/list.c:838 src/xz/list.c:1007
+#: src/xz/list.c:829 src/xz/list.c:998
 #, c-format
 msgid "  Memory needed:      %s MiB\n"
 msgstr "  Benötigter Speicher: %s MiB\n"
 
-#: src/xz/list.c:840 src/xz/list.c:1009
+#: src/xz/list.c:831 src/xz/list.c:1000
 #, c-format
 msgid "  Sizes in headers:   %s\n"
 msgstr "  Größe in Köpfen:     %s\n"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "Yes"
 msgstr "Ja"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "No"
 msgstr "Nein"
 
 #. TRANSLATORS: %s is an integer. Only the plural form of this
 #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
-#: src/xz/list.c:986
+#: src/xz/list.c:977
 #, c-format
 msgid "%s file\n"
 msgid_plural "%s files\n"
 msgstr[0] "%s Datei\n"
 msgstr[1] "%s Dateien\n"
 
-#: src/xz/list.c:999
+#: src/xz/list.c:990
 msgid "Totals:"
 msgstr "Gesamt:"
 
-#: src/xz/list.c:1000
+#: src/xz/list.c:991
 #, c-format
 msgid "  Number of files:    %s\n"
 msgstr "   Anzahl Dateien:     %s\n"
 
-#: src/xz/list.c:1072
+#: src/xz/list.c:1063
 msgid "--list works only on .xz files (--format=xz or --format=auto)"
 msgstr ""
 "--list funktioniert nur mit .xz Dateien (--format=xz oder --format=auto)"
 
-#: src/xz/list.c:1078
+#: src/xz/list.c:1069
 msgid "--list does not support reading from standard input"
 msgstr "--list unterstützt kein Lesen der Standardeingabe"
 
@@ -428,60 +428,73 @@
 "Lesen der Standardeingabe ist nicht möglich, wenn die Dateinamen auch von "
 "der Standardeingabe gelesen werden"
 
-#: src/xz/message.c:800 src/xz/message.c:844
+#. TRANSLATORS: This is the program name in the beginning
+#. of the line in messages. Usually it becomes "xz: ".
+#. This is a translatable string because French needs
+#. a space before a colon.
+#: src/xz/message.c:733
+#, c-format
+msgid "%s: "
+msgstr ""
+
+#: src/xz/message.c:796 src/xz/message.c:846
 msgid "Internal error (bug)"
 msgstr "Interner Fehler (Bug)"
 
-#: src/xz/message.c:807
+#: src/xz/message.c:803
 msgid "Cannot establish signal handlers"
 msgstr "Kann Signal Routine nicht setzen"
 
-#: src/xz/message.c:816
+#: src/xz/message.c:812
 msgid "No integrity check; not verifying file integrity"
 msgstr "Kein Integritäts-Check; werde Datei-Integrität nicht überprüfen"
 
-#: src/xz/message.c:819
+#: src/xz/message.c:815
 msgid "Unsupported type of integrity check; not verifying file integrity"
 msgstr ""
 "Typ des Integritäts-Checks nicht unterstützt; werde Datei-Integrität nicht "
 "überprüfen"
 
-#: src/xz/message.c:826
+#: src/xz/message.c:822
 msgid "Memory usage limit reached"
 msgstr "Speicher-Limit erreicht"
 
-#: src/xz/message.c:829
+#: src/xz/message.c:825
 msgid "File format not recognized"
 msgstr "Datei Format nicht erkannt"
 
-#: src/xz/message.c:832
+#: src/xz/message.c:828
 msgid "Unsupported options"
 msgstr "Optionen nicht unterstützt"
 
-#: src/xz/message.c:835
+#: src/xz/message.c:831
 msgid "Compressed data is corrupt"
 msgstr "Komprimierte Daten sind korrupt"
 
-#: src/xz/message.c:838
+#: src/xz/message.c:834
 msgid "Unexpected end of input"
 msgstr "Unerwartetes Eingabe Ende"
 
-#: src/xz/message.c:886
+#: src/xz/message.c:867
+msgid "%s MiB of memory is required. The limiter is disabled."
+msgstr "%s MiB Speicher wird benötigt. Der Begrenzer ist deaktiviert."
+
+#: src/xz/message.c:895
 #, c-format
 msgid "%s MiB of memory is required. The limit is %s."
 msgstr "%s MiB Speicher wird benötigt. Limit ist %s."
 
-#: src/xz/message.c:1053
+#: src/xz/message.c:1062
 #, c-format
 msgid "%s: Filter chain: %s\n"
 msgstr "%s: Filter Kette: %s\n"
 
-#: src/xz/message.c:1063
+#: src/xz/message.c:1072
 #, c-format
 msgid "Try `%s --help' for more information."
 msgstr "Versuchen Sie `%s --help' für mehr Informationen."
 
-#: src/xz/message.c:1089
+#: src/xz/message.c:1098
 #, c-format
 msgid ""
 "Usage: %s [OPTION]... [FILE]...\n"
@@ -492,18 +505,18 @@
 "Komprimiert oder dekomprimiert .xz DATEI(EN).\n"
 "\n"
 
-#: src/xz/message.c:1096
+#: src/xz/message.c:1105
 msgid ""
 "Mandatory arguments to long options are mandatory for short options too.\n"
 msgstr ""
 "Obligatorische Argumente für lange Optionen sind auch für kurze Optionen\n"
 "zwingend.\n"
 
-#: src/xz/message.c:1100
+#: src/xz/message.c:1109
 msgid " Operation mode:\n"
 msgstr " Operationsmodus:\n"
 
-#: src/xz/message.c:1103
+#: src/xz/message.c:1112
 msgid ""
 "  -z, --compress      force compression\n"
 "  -d, --decompress    force decompression\n"
@@ -515,7 +528,7 @@
 "  -t, --test            überprüfe Datei Integrität\n"
 "  -l, --list            liste Datei Informationen"
 
-#: src/xz/message.c:1109
+#: src/xz/message.c:1118
 msgid ""
 "\n"
 " Operation modifiers:\n"
@@ -523,7 +536,7 @@
 "\n"
 " Operationsmodifikatoren:\n"
 
-#: src/xz/message.c:1112
+#: src/xz/message.c:1121
 msgid ""
 "  -k, --keep          keep (don't delete) input files\n"
 "  -f, --force         force overwrite of output file and (de)compress links\n"
@@ -535,7 +548,7 @@
 "  -c, --stdout          schreibe nach Standard Output und lösche nicht die\n"
 "                        Eingabedateien"
 
-#: src/xz/message.c:1118
+#: src/xz/message.c:1127
 msgid ""
 "      --no-sparse     do not create sparse files when decompressing\n"
 "  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
@@ -554,7 +567,7 @@
 "      --files0=[DATEI]  wie --files, aber benutze den Null Charakter als "
 "Trenner"
 
-#: src/xz/message.c:1126
+#: src/xz/message.c:1135
 msgid ""
 "\n"
 " Basic file format and compression options:\n"
@@ -562,7 +575,7 @@
 "\n"
 " Grundlegende Optionen für Dateiformat und Kompression:\n"
 
-#: src/xz/message.c:1128
+#: src/xz/message.c:1137
 msgid ""
 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
 "                      `auto' (default), `xz', `lzma', and `raw'\n"
@@ -578,7 +591,7 @@
 "`crc32',\n"
 "                        `crc64' (Voreinstellung), oder `sha256'"
 
-#: src/xz/message.c:1135
+#: src/xz/message.c:1144
 msgid ""
 "  -0 ... -9           compression preset; default is 6; take compressor "
 "*and*\n"
@@ -591,7 +604,7 @@
 "des\n"
 "                        Dekomprimierers, wenn Sie 7-9 benutzen!"
 
-#: src/xz/message.c:1139
+#: src/xz/message.c:1148
 msgid ""
 "  -e, --extreme       try to improve compression ratio by using more CPU "
 "time;\n"
@@ -602,7 +615,7 @@
 "                        verhältnis zu verbessern. Das beeinflusst nicht den\n"
 "                        Speicherbedarf des Dekomprimierers."
 
-#: src/xz/message.c:1144
+#: src/xz/message.c:1153
 #, no-c-format
 msgid ""
 "      --memlimit-compress=LIMIT\n"
@@ -619,7 +632,7 @@
 "RAM,\n"
 "                        oder 0 für Grundeinstellungen."
 
-#: src/xz/message.c:1151
+#: src/xz/message.c:1160
 msgid ""
 "      --no-adjust     if compression settings exceed the memory usage "
 "limit,\n"
@@ -631,7 +644,7 @@
 "statt\n"
 "                        die Einstellungen nach unten anzupassen."
 
-#: src/xz/message.c:1157
+#: src/xz/message.c:1166
 msgid ""
 "\n"
 " Custom filter chain for compression (alternative for using presets):"
@@ -639,7 +652,7 @@
 "\n"
 " User-definierte Filter Kette für Kompression (alternativ zu Voreinstellung):"
 
-#: src/xz/message.c:1166
+#: src/xz/message.c:1175
 msgid ""
 "\n"
 "  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero "
@@ -683,7 +696,7 @@
 "                          depth=NUM  Maximale Suchtiefe; 0=automatisch\n"
 "                                     (Voreinstellung)"
 
-#: src/xz/message.c:1181
+#: src/xz/message.c:1190
 msgid ""
 "\n"
 "  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
@@ -706,7 +719,7 @@
 "                          start=NUM  Start-Offset für Konversion\n"
 "                          (Voreinstellung=0)"
 
-#: src/xz/message.c:1193
+#: src/xz/message.c:1202
 msgid ""
 "\n"
 "  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
@@ -720,7 +733,7 @@
 "voneinander\n"
 "                                    subtrahiert werden (1-256; 1)"
 
-#: src/xz/message.c:1201
+#: src/xz/message.c:1210
 msgid ""
 "\n"
 " Other options:\n"
@@ -728,7 +741,7 @@
 "\n"
 " Andere Optionen:\n"
 
-#: src/xz/message.c:1204
+#: src/xz/message.c:1213
 msgid ""
 "  -q, --quiet         suppress warnings; specify twice to suppress errors "
 "too\n"
@@ -740,25 +753,25 @@
 "noch\n"
 "                        gesprächiger zu sein"
 
-#: src/xz/message.c:1209
+#: src/xz/message.c:1218
 msgid "  -Q, --no-warn       make warnings not affect the exit status"
 msgstr "  -Q, --no-warn         Warnungen verändern nicht den exit status"
 
-#: src/xz/message.c:1211
+#: src/xz/message.c:1220
 msgid ""
 "      --robot         use machine-parsable messages (useful for scripts)"
 msgstr ""
 "      --robot           benutze Maschinen-lesbare Meldungen (nützlich für\n"
 "                        Skripte)"
 
-#: src/xz/message.c:1214
+#: src/xz/message.c:1223
 msgid ""
 "      --info-memory   display the total amount of RAM and the currently "
 "active\n"
 "                      memory usage limits, and exit"
 msgstr "      --info-memory     zeige Speicherlimit an und terminiere"
 
-#: src/xz/message.c:1217
+#: src/xz/message.c:1226
 msgid ""
 "  -h, --help          display the short help (lists only the basic options)\n"
 "  -H, --long-help     display this long help and exit"
@@ -767,7 +780,7 @@
 "                        Optionen)\n"
 "  -H, --long-help       zeige diese lange Hilfe an und terminiere"
 
-#: src/xz/message.c:1221
+#: src/xz/message.c:1230
 msgid ""
 "  -h, --help          display this short help and exit\n"
 "  -H, --long-help     display the long help (lists also the advanced options)"
@@ -777,11 +790,11 @@
 "fortgeschrittene\n"
 "                        Optionen an)"
 
-#: src/xz/message.c:1226
+#: src/xz/message.c:1235
 msgid "  -V, --version       display the version number and exit"
 msgstr "  -V, --version         zeige Versionsnummer an und terminiere"
 
-#: src/xz/message.c:1228
+#: src/xz/message.c:1237
 msgid ""
 "\n"
 "With no FILE, or when FILE is -, read standard input.\n"
@@ -794,7 +807,7 @@
 #. for this package. Please add _another line_ saying
 #. "Report translation bugs to <...>\n" with the email or WWW
 #. address for translation bugs. Thanks.
-#: src/xz/message.c:1234
+#: src/xz/message.c:1243
 #, c-format
 msgid "Report bugs to <%s> (in English or Finnish).\n"
 msgstr ""
@@ -802,7 +815,7 @@
 "Melde Übersetzungsfehler an <maan@systemlinux.org> (in englisch oder "
 "deutsch).\n"
 
-#: src/xz/message.c:1236
+#: src/xz/message.c:1245
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr "%s Homepage: <%s>\n"
@@ -840,7 +853,7 @@
 "Der ausgewählte Algorithmus zum Auffinden von Übereinstimmungen braucht "
 "mindestens nice=%<PRIu32>"
 
-#: src/xz/suffix.c:79 src/xz/suffix.c:164
+#: src/xz/suffix.c:101 src/xz/suffix.c:194
 #, c-format
 msgid ""
 "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
@@ -848,17 +861,17 @@
 "%s: Mit --format=raw ist --sufix=.SUF notwendig, falls nicht nach stdout "
 "geschrieben wird"
 
-#: src/xz/suffix.c:99
+#: src/xz/suffix.c:121
 #, c-format
 msgid "%s: Filename has an unknown suffix, skipping"
 msgstr "%s: Dateiname hat unbekannte Endung, überspringe"
 
-#: src/xz/suffix.c:154
+#: src/xz/suffix.c:175 src/xz/suffix.c:184
 #, c-format
 msgid "%s: File already has `%s' suffix, skipping"
 msgstr "%s: Datei hat bereits `%s' Endung, überspringe"
 
-#: src/xz/suffix.c:205
+#: src/xz/suffix.c:235
 #, c-format
 msgid "%s: Invalid filename suffix"
 msgstr "%s: Ungültige Datei Endung"
diff --git a/po/fr.po b/po/fr.po
index 2d95411..d066576 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: xz-utils\n"
 "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
-"POT-Creation-Date: 2011-05-21 14:35+0200\n"
+"POT-Creation-Date: 2012-05-30 22:10+0200\n"
 "PO-Revision-Date: 2010-09-24 21;12+0200\n"
 "Last-Translator: Adrien Nader <camaradetux@gmail.com>\n"
 "Language-Team: None\n"
@@ -16,69 +16,59 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n==1) ? 0 : 1;\n"
 
-#: src/xz/args.c:338
+#: src/xz/args.c:333
 #, c-format
 msgid "%s: Unknown file format type"
 msgstr "%s : Format de fichier inconnu"
 
-#: src/xz/args.c:361 src/xz/args.c:369
+#: src/xz/args.c:356 src/xz/args.c:364
 #, c-format
 msgid "%s: Unsupported integrity check type"
 msgstr "%s : Type de vérification d'intégrité inconnu"
 
-#: src/xz/args.c:396
+#: src/xz/args.c:382
 msgid "Only one file can be specified with `--files' or `--files0'."
 msgstr "Un seul fichier peut être spécifié avec `--files' ou `--files0'."
 
-#: src/xz/args.c:459
+#: src/xz/args.c:445
 #, c-format
 msgid "The environment variable %s contains too many arguments"
 msgstr "La variable d'environnement %s contient trop d'arguments"
 
-#: src/xz/coder.c:105
+#: src/xz/coder.c:95
 msgid "Maximum number of filters is four"
 msgstr "Le nombre maximal de filtres est quatre"
 
-#: src/xz/coder.c:118
+#: src/xz/coder.c:108
 msgid "Memory usage limit is too low for the given filter setup."
 msgstr "La limite d'utilisation mémoire est trop basse pour la configuration de filtres donnée."
 
-#: src/xz/coder.c:148
+#: src/xz/coder.c:129
 msgid "Using a preset in raw mode is discouraged."
 msgstr "Utiliser un préréglage en mode `raw' est déconseillé."
 
-#: src/xz/coder.c:150
+#: src/xz/coder.c:131
 msgid "The exact options of the presets may vary between software versions."
 msgstr "Le détail des préréglages peut varier entre différentes versions du logiciel."
 
-#: src/xz/coder.c:176
+#: src/xz/coder.c:157
 msgid "The .lzma format supports only the LZMA1 filter"
 msgstr "Le format .lzma ne prend en charge que le filtre LZMA1"
 
-#: src/xz/coder.c:184
+#: src/xz/coder.c:165
 msgid "LZMA1 cannot be used with the .xz format"
 msgstr "Le filtre LZMA1 ne peut être utilisé avec le format .xz"
 
-#: src/xz/coder.c:203
-#, c-format
-msgid "Using up to %<PRIu32> threads."
-msgstr "Jusqu'à %<PRIu32> threads seront utilisés."
-
-#: src/xz/coder.c:216
+#: src/xz/coder.c:182
 msgid "Unsupported filter chain or filter options"
 msgstr "Enchaînement ou options de filtres non pris en charge"
 
-#: src/xz/coder.c:224
+#: src/xz/coder.c:190
 #, c-format
 msgid "Decompression will need %s MiB of memory."
 msgstr "La décompression nécessitera %s MiB de mémoire."
 
-#: src/xz/coder.c:259
-#, c-format
-msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
-msgstr "Nombre de threads réduit de %s à %s pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
-
-#: src/xz/coder.c:313
+#: src/xz/coder.c:247
 #, c-format
 msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
 msgstr "Taille du dictionnaire LZMA%c réduite de %s MiB à %s MiB pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
@@ -93,111 +83,111 @@
 #. it is possible that the user has put a new file in place
 #. of the original file, and in that case it obviously
 #. shouldn't be removed.
-#: src/xz/file_io.c:136
+#: src/xz/file_io.c:137
 #, c-format
 msgid "%s: File seems to have been moved, not removing"
 msgstr "%s : Le fichier a apparemment été déplacé, suppression annulée"
 
-#: src/xz/file_io.c:143 src/xz/file_io.c:635
+#: src/xz/file_io.c:144 src/xz/file_io.c:589
 #, c-format
 msgid "%s: Cannot remove: %s"
 msgstr "%s : Impossible de supprimer : %s"
 
-#: src/xz/file_io.c:168
+#: src/xz/file_io.c:169
 #, c-format
 msgid "%s: Cannot set the file owner: %s"
 msgstr "%s : Impossible de modifier le propriétaire du fichier : %s"
 
-#: src/xz/file_io.c:174
+#: src/xz/file_io.c:175
 #, c-format
 msgid "%s: Cannot set the file group: %s"
 msgstr "%s : Impossible de modifier le groupe propriétaire du fichier : %s"
 
-#: src/xz/file_io.c:193
+#: src/xz/file_io.c:194
 #, c-format
 msgid "%s: Cannot set the file permissions: %s"
 msgstr "%s : Impossible de modifier les permissions du fichier : %s"
 
-#: src/xz/file_io.c:340 src/xz/file_io.c:423
+#: src/xz/file_io.c:337 src/xz/file_io.c:420
 #, c-format
 msgid "%s: Is a symbolic link, skipping"
 msgstr "%s est un lien symbolique : ignoré"
 
-#: src/xz/file_io.c:468
+#: src/xz/file_io.c:455
 #, c-format
 msgid "%s: Is a directory, skipping"
 msgstr "%s est un répertoire : ignoré"
 
-#: src/xz/file_io.c:474
+#: src/xz/file_io.c:461
 #, c-format
 msgid "%s: Not a regular file, skipping"
 msgstr "%s n'est pas un fichier régulier : ignoré"
 
-#: src/xz/file_io.c:491
+#: src/xz/file_io.c:478
 #, c-format
 msgid "%s: File has setuid or setgid bit set, skipping"
 msgstr "%s : Le fichier possède les bits `setuid' ou `setgid' : ignoré"
 
-#: src/xz/file_io.c:498
+#: src/xz/file_io.c:485
 #, c-format
 msgid "%s: File has sticky bit set, skipping"
 msgstr "%s : Le fichier possède le bit `sticky' : ignoré"
 
-#: src/xz/file_io.c:505
+#: src/xz/file_io.c:492
 #, c-format
 msgid "%s: Input file has more than one hard link, skipping"
 msgstr "%s : Le fichier d'entrée a plus d'un lien matériel : ignoré"
 
-#: src/xz/file_io.c:761
+#: src/xz/file_io.c:713
 #, c-format
 msgid "Error restoring the O_APPEND flag to standard output: %s"
 msgstr "Impossible de rétablir le drapeau O_APPEND sur la sortie standard : %s"
 
-#: src/xz/file_io.c:773
+#: src/xz/file_io.c:725
 #, c-format
 msgid "%s: Closing the file failed: %s"
 msgstr "%s : Impossible de fermer le fichier : %s"
 
-#: src/xz/file_io.c:809 src/xz/file_io.c:1008
+#: src/xz/file_io.c:761 src/xz/file_io.c:945
 #, c-format
 msgid "%s: Seeking failed when trying to create a sparse file: %s"
 msgstr "%s : Impossible de se déplacer dans le fichier pour créer un 'sparse file' : %s"
 
-#: src/xz/file_io.c:883
+#: src/xz/file_io.c:820
 #, c-format
 msgid "%s: Read error: %s"
 msgstr "%s : Erreur d'écriture : %s"
 
-#: src/xz/file_io.c:906
+#: src/xz/file_io.c:843
 #, c-format
 msgid "%s: Error seeking the file: %s"
 msgstr "%s : Impossible de se déplacer dans le fichier : %s"
 
-#: src/xz/file_io.c:916
+#: src/xz/file_io.c:853
 #, c-format
 msgid "%s: Unexpected end of file"
 msgstr "%s : Fin de fichier inattendue"
 
-#: src/xz/file_io.c:966
+#: src/xz/file_io.c:903
 #, c-format
 msgid "%s: Write error: %s"
 msgstr "%s : Erreur d'écriture : %s"
 
-#: src/xz/hardware.c:101
+#: src/xz/hardware.c:100
 msgid "Disabled"
 msgstr "Désactivé"
 
 #. TRANSLATORS: Test with "xz --info-memory" to see if
 #. the alignment looks nice.
-#: src/xz/hardware.c:120
+#: src/xz/hardware.c:119
 msgid "Total amount of physical memory (RAM): "
 msgstr "Quantité totale de mémoire physique (RAM) :  "
 
-#: src/xz/hardware.c:122
+#: src/xz/hardware.c:121
 msgid "Memory usage limit for compression:    "
 msgstr "Limite d'utilisation pour la compression :   "
 
-#: src/xz/hardware.c:124
+#: src/xz/hardware.c:123
 msgid "Memory usage limit for decompression:  "
 msgstr "Limite d'utilisation pour la décompression : "
 
@@ -275,41 +265,41 @@
 #. to Ratio, the columns are right aligned. Check and Filename
 #. are left aligned. If you need longer words, it's OK to
 #. use two lines here. Test with "xz -l foo.xz".
-#: src/xz/list.c:612
+#: src/xz/list.c:603
 msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
 msgstr "Flux    Blocs    Compressé  Décompressé  Ratio  Vérif   Nom de fichier"
 
-#: src/xz/list.c:652
+#: src/xz/list.c:643
 #, c-format
 msgid "  Streams:            %s\n"
 msgstr "  Flux :                            %s\n"
 
-#: src/xz/list.c:654
+#: src/xz/list.c:645
 #, c-format
 msgid "  Blocks:             %s\n"
 msgstr "  Blocs :                           %s\n"
 
-#: src/xz/list.c:656
+#: src/xz/list.c:647
 #, c-format
 msgid "  Compressed size:    %s\n"
 msgstr "  Taille compressé :                %s\n"
 
-#: src/xz/list.c:659
+#: src/xz/list.c:650
 #, c-format
 msgid "  Uncompressed size:  %s\n"
 msgstr "  Taille décompressé :              %s\n"
 
-#: src/xz/list.c:662
+#: src/xz/list.c:653
 #, c-format
 msgid "  Ratio:              %s\n"
 msgstr "  Ratio :                           %s\n"
 
-#: src/xz/list.c:664
+#: src/xz/list.c:655
 #, c-format
 msgid "  Check:              %s\n"
 msgstr "  Vérification :                    %s\n"
 
-#: src/xz/list.c:665
+#: src/xz/list.c:656
 #, c-format
 msgid "  Stream padding:     %s\n"
 msgstr "  Octets de rembourrage du flux :   %s\n"
@@ -317,7 +307,7 @@
 #. TRANSLATORS: The second line is column headings. All except
 #. Check are right aligned; Check is left aligned. Test with
 #. "xz -lv foo.xz".
-#: src/xz/list.c:693
+#: src/xz/list.c:684
 msgid ""
 "  Streams:\n"
 "    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
@@ -327,7 +317,7 @@
 
 #. TRANSLATORS: The second line is column headings. All
 #. except Check are right aligned; Check is left aligned.
-#: src/xz/list.c:748
+#: src/xz/list.c:739
 #, c-format
 msgid ""
 "  Blocks:\n"
@@ -343,52 +333,52 @@
 #. are right aligned. %*s is replaced with 0-120
 #. spaces to make the CheckVal column wide enough.
 #. Test with "xz -lvv foo.xz".
-#: src/xz/list.c:760
+#: src/xz/list.c:751
 #, c-format
 msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
 msgstr "     ValVérif %*sEn-tête  Drapeaux   TailleComp     UtilMém  Filtres"
 
-#: src/xz/list.c:838 src/xz/list.c:1007
+#: src/xz/list.c:829 src/xz/list.c:998
 #, c-format
 msgid "  Memory needed:      %s MiB\n"
 msgstr "  Mémoire nécessaire :              %s MiB\n"
 
-#: src/xz/list.c:840 src/xz/list.c:1009
+#: src/xz/list.c:831 src/xz/list.c:1000
 #, c-format
 msgid "  Sizes in headers:   %s\n"
 msgstr "  Tailles stockées dans l'en-tête : %s\n"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "Yes"
 msgstr "Oui"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "No"
 msgstr "Non"
 
 #. TRANSLATORS: %s is an integer. Only the plural form of this
 #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
-#: src/xz/list.c:986
+#: src/xz/list.c:977
 #, c-format
 msgid "%s file\n"
 msgid_plural "%s files\n"
 msgstr[0] "%s fichier\n"
 msgstr[1] "%s fichiers\n"
 
-#: src/xz/list.c:999
+#: src/xz/list.c:990
 msgid "Totals:"
 msgstr "Totaux :"
 
-#: src/xz/list.c:1000
+#: src/xz/list.c:991
 #, c-format
 msgid "  Number of files:    %s\n"
 msgstr "  Nombre de fichiers : %s\n"
 
-#: src/xz/list.c:1072
+#: src/xz/list.c:1063
 msgid "--list works only on .xz files (--format=xz or --format=auto)"
 msgstr "--list ne marche que sur les fichiers .xz (--format=xz ou --format=auto)"
 
-#: src/xz/list.c:1078
+#: src/xz/list.c:1069
 msgid "--list does not support reading from standard input"
 msgstr "--list est incompatible avec la lecture sur l'entrée standard"
 
@@ -460,22 +450,27 @@
 msgid "Unexpected end of input"
 msgstr "Fin des données inattendue "
 
-#: src/xz/message.c:885
+#: src/xz/message.c:867
+#, c-format
+msgid "%s MiB of memory is required. The limiter is disabled."
+msgstr "%s MiB de mémoire sont nécessaires. La limite est désactivée."
+
+#: src/xz/message.c:895
 #, c-format
 msgid "%s MiB of memory is required. The limit is %s."
 msgstr "%s MiB de mémoire sont nécessaires, la limite étant %s."
 
-#: src/xz/message.c:1052
+#: src/xz/message.c:1062
 #, c-format
 msgid "%s: Filter chain: %s\n"
 msgstr "%s : Enchaînement de filtres : %s\n"
 
-#: src/xz/message.c:1062
+#: src/xz/message.c:1072
 #, c-format
 msgid "Try `%s --help' for more information."
 msgstr "Utilisez `%s --help' pour plus d'informations."
 
-#: src/xz/message.c:1088
+#: src/xz/message.c:1098
 #, c-format
 msgid ""
 "Usage: %s [OPTION]... [FILE]...\n"
@@ -486,17 +481,17 @@
 "Compresse ou decompresse FICHIER(s) au format .xz.\n"
 "\n"
 
-#: src/xz/message.c:1095
+#: src/xz/message.c:1105
 msgid "Mandatory arguments to long options are mandatory for short options too.\n"
 msgstr ""
 "Les arguments obligatoires pour les options longues le sont aussi pour les\n"
 "options courtes.\n"
 
-#: src/xz/message.c:1099
+#: src/xz/message.c:1109
 msgid " Operation mode:\n"
 msgstr " Mode d'opération :\n"
 
-#: src/xz/message.c:1102
+#: src/xz/message.c:1112
 msgid ""
 "  -z, --compress      force compression\n"
 "  -d, --decompress    force decompression\n"
@@ -508,7 +503,7 @@
 "  -t, --test          tester l'intégrité du fichier compressé\n"
 "  -l, --list          lister les informations à propos des fichiers .xz"
 
-#: src/xz/message.c:1108
+#: src/xz/message.c:1118
 msgid ""
 "\n"
 " Operation modifiers:\n"
@@ -516,7 +511,7 @@
 "\n"
 " Modifictauers :\n"
 
-#: src/xz/message.c:1111
+#: src/xz/message.c:1121
 msgid ""
 "  -k, --keep          keep (don't delete) input files\n"
 "  -f, --force         force overwrite of output file and (de)compress links\n"
@@ -528,15 +523,7 @@
 "  -c, --stdout        écrire sur la sortie standard et ne pas supprimer les\n"
 "                      fichiers d'entrée"
 
-#: src/xz/message.c:1117
-msgid ""
-"      --single-stream decompress only the first stream, and silently\n"
-"                      ignore possible remaining input data"
-msgstr ""
-"      --single-stream décompresser uniquement le premier flux et ignorer\n"
-"                      silenciseusement les données éventuellement restantes"
-
-#: src/xz/message.c:1120
+#: src/xz/message.c:1127
 msgid ""
 "      --no-sparse     do not create sparse files when decompressing\n"
 "  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
@@ -552,7 +539,7 @@
 "                      et doivent être suivis d'un caractère de retour à la ligne\n"
 "      --files0[=FILE] comme --files mais avec un caractère null comme séparateur"
 
-#: src/xz/message.c:1129
+#: src/xz/message.c:1135
 msgid ""
 "\n"
 " Basic file format and compression options:\n"
@@ -560,7 +547,7 @@
 "\n"
 " Options basiques de format de fichier et de compression :\n"
 
-#: src/xz/message.c:1131
+#: src/xz/message.c:1137
 msgid ""
 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
 "                      `auto' (default), `xz', `lzma', and `raw'\n"
@@ -572,7 +559,7 @@
 "  -C, --check=CHECK   type de vérification d'intégrité : `none' (à utiliser avec\n"
 "                      précaution), `crc32', `crc64' (par défaut) ou `sha256'"
 
-#: src/xz/message.c:1138
+#: src/xz/message.c:1144
 msgid ""
 "  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
 "                      decompressor memory usage into account before using 7-9!"
@@ -581,7 +568,7 @@
 "                      l'utilisation mémoire du compresseur *et* du décompresseur\n"
 "                      avant d'utiliser 7, 8 ou 9 !"
 
-#: src/xz/message.c:1142
+#: src/xz/message.c:1148
 msgid ""
 "  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
 "                      does not affect decompressor memory requirements"
@@ -590,17 +577,7 @@
 "                      de temps processeur sans affecter les besoins mémoire du\n"
 "                      décompresseur"
 
-#: src/xz/message.c:1147
-msgid ""
-"      --block-size=SIZE\n"
-"                      when compressing to the .xz format, start a new block\n"
-"                      after every SIZE bytes of input; 0=disabled (default)"
-msgstr ""
-"      --block-size=SIZE\n"
-"                      pour une compression au format .xz, entamer un nouveau\n"
-"                      bloc après SIZE octets d'entrée ; 0=désactivé (par défaut)"
-
-#: src/xz/message.c:1151
+#: src/xz/message.c:1153
 #, no-c-format
 msgid ""
 "      --memlimit-compress=LIMIT\n"
@@ -616,7 +593,7 @@
 "                      décompression ou les deux ; LIMIT est en octets, % de\n"
 "                      RAM, ou 0 pour les valeurs par défaut"
 
-#: src/xz/message.c:1158
+#: src/xz/message.c:1160
 msgid ""
 "      --no-adjust     if compression settings exceed the memory usage limit,\n"
 "                      give an error instead of adjusting the settings downwards"
@@ -625,7 +602,7 @@
 "                      d'utilisation mémoire, renvoyer une erreur plutôt que de\n"
 "                      diminuer les réglages"
 
-#: src/xz/message.c:1164
+#: src/xz/message.c:1166
 msgid ""
 "\n"
 " Custom filter chain for compression (alternative for using presets):"
@@ -633,7 +610,7 @@
 "\n"
 " Enchaînement de filtres de compression personnalisé (au lieu des préréglages) :"
 
-#: src/xz/message.c:1173
+#: src/xz/message.c:1175
 msgid ""
 "\n"
 "  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
@@ -662,7 +639,7 @@
 "                        depth=NUM  profondeur de recherche maximale ;\n"
 "                                      0=automatique (par défaut)"
 
-#: src/xz/message.c:1188
+#: src/xz/message.c:1190
 msgid ""
 "\n"
 "  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
@@ -684,7 +661,7 @@
 "                      OPTS valides pour tous les filtres BCJ :\n"
 "                        start=NUM  start offset for conversions (default=0)"
 
-#: src/xz/message.c:1200
+#: src/xz/message.c:1202
 msgid ""
 "\n"
 "  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
@@ -696,7 +673,7 @@
 "                        dist=NUM   distance entre les octets soustraits\n"
 "                                   les uns aux autres (1-256 ; 1)"
 
-#: src/xz/message.c:1208
+#: src/xz/message.c:1210
 msgid ""
 "\n"
 " Other options:\n"
@@ -704,7 +681,7 @@
 "\n"
 " Autres options :\n"
 
-#: src/xz/message.c:1211
+#: src/xz/message.c:1213
 msgid ""
 "  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
 "  -v, --verbose       be verbose; specify twice for even more verbose"
@@ -713,17 +690,17 @@
 "                      aussi supprimer les erreur\n"
 "  -v, --verbose       être bavard ; spécifier deux fois pour l'être davantage"
 
-#: src/xz/message.c:1216
+#: src/xz/message.c:1218
 msgid "  -Q, --no-warn       make warnings not affect the exit status"
 msgstr "  -Q, --no-warn       les avertissements ne modifient pas le code de sortie"
 
-#: src/xz/message.c:1218
+#: src/xz/message.c:1220
 msgid "      --robot         use machine-parsable messages (useful for scripts)"
 msgstr ""
 "      --robot         utiliser des messages lisibles par un programme\n"
 "                      (utile pour les scripts)"
 
-#: src/xz/message.c:1221
+#: src/xz/message.c:1223
 msgid ""
 "      --info-memory   display the total amount of RAM and the currently active\n"
 "                      memory usage limits, and exit"
@@ -731,7 +708,7 @@
 "      --info-memory   affiche la quantité totale de RAM et la limite actuelle\n"
 "                      en mémoire puis quitte"
 
-#: src/xz/message.c:1224
+#: src/xz/message.c:1226
 msgid ""
 "  -h, --help          display the short help (lists only the basic options)\n"
 "  -H, --long-help     display this long help and exit"
@@ -739,7 +716,7 @@
 "  -h, --help          affiche l'aide courte (ne liste que les options de base)\n"
 "  -H, --long-help     affiche l'aide longue (ceci) puis quitte"
 
-#: src/xz/message.c:1228
+#: src/xz/message.c:1230
 msgid ""
 "  -h, --help          display this short help and exit\n"
 "  -H, --long-help     display the long help (lists also the advanced options)"
@@ -747,11 +724,11 @@
 "  -h, --help          affiche l'aide courte (ceci) puis quitte\n"
 "  -H, --long-help     affiche l'aide longue (liste aussi les options avancées)"
 
-#: src/xz/message.c:1233
+#: src/xz/message.c:1235
 msgid "  -V, --version       display the version number and exit"
 msgstr "  -V, --version       affiche le numéro de version puis quitte"
 
-#: src/xz/message.c:1235
+#: src/xz/message.c:1237
 msgid ""
 "\n"
 "With no FILE, or when FILE is -, read standard input.\n"
@@ -763,14 +740,14 @@
 #. for this package. Please add _another line_ saying
 #. "Report translation bugs to <...>\n" with the email or WWW
 #. address for translation bugs. Thanks.
-#: src/xz/message.c:1241
+#: src/xz/message.c:1243
 #, c-format
 msgid "Report bugs to <%s> (in English or Finnish).\n"
 msgstr ""
 "Signaler les bogues à <%s> (en anglais ou en finlandais).\n"
 "Signaler les bogues de traduction à <camaradetux@gmail.com>.\n"
 
-#: src/xz/message.c:1243
+#: src/xz/message.c:1245
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr "%s page du projet : <%s>\n"
@@ -804,22 +781,22 @@
 msgid "The selected match finder requires at least nice=%<PRIu32>"
 msgstr "Le `match finder' choisi nécessite au moins nice=%<PRIu32>"
 
-#: src/xz/suffix.c:133 src/xz/suffix.c:258
+#: src/xz/suffix.c:101 src/xz/suffix.c:194
 #, c-format
 msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
 msgstr "%s : Avec --format=raw, --suffix=.SUF est nécessaire sauf lors de l'écriture vers stdout"
 
-#: src/xz/suffix.c:164
+#: src/xz/suffix.c:121
 #, c-format
 msgid "%s: Filename has an unknown suffix, skipping"
 msgstr "%s : Le fichier a un suffixe inconnu, ignoré"
 
-#: src/xz/suffix.c:185
+#: src/xz/suffix.c:175 src/xz/suffix.c:184
 #, c-format
 msgid "%s: File already has `%s' suffix, skipping"
 msgstr "%s : Le fichier a déjà le suffixe '%s', ignoré"
 
-#: src/xz/suffix.c:393
+#: src/xz/suffix.c:235
 #, c-format
 msgid "%s: Invalid filename suffix"
 msgstr "%s: Suffixe de nom de fichier invalide"
@@ -862,3 +839,25 @@
 #: src/common/tuklib_exit.c:42
 msgid "Unknown error"
 msgstr "Erreur inconnue"
+
+#~ msgid "Using up to %<PRIu32> threads."
+#~ msgstr "Jusqu'à %<PRIu32> threads seront utilisés."
+
+#~ msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
+#~ msgstr "Nombre de threads réduit de %s à %s pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
+
+#~ msgid ""
+#~ "      --single-stream decompress only the first stream, and silently\n"
+#~ "                      ignore possible remaining input data"
+#~ msgstr ""
+#~ "      --single-stream décompresser uniquement le premier flux et ignorer\n"
+#~ "                      silenciseusement les données éventuellement restantes"
+
+#~ msgid ""
+#~ "      --block-size=SIZE\n"
+#~ "                      when compressing to the .xz format, start a new block\n"
+#~ "                      after every SIZE bytes of input; 0=disabled (default)"
+#~ msgstr ""
+#~ "      --block-size=SIZE\n"
+#~ "                      pour une compression au format .xz, entamer un nouveau\n"
+#~ "                      bloc après SIZE octets d'entrée ; 0=désactivé (par défaut)"
diff --git a/po/it.po b/po/it.po
index 8e096dd..2d5da57 100644
--- a/po/it.po
+++ b/po/it.po
@@ -2,26 +2,28 @@
 # This file is in the public domain
 # Gruppo traduzione italiano di Ubuntu-it <gruppo-traduzione@ubuntu-it.org>, 2009, 2010
 # Lorenzo De Liso <blackz@ubuntu.com>, 2010.
-# Milo Casagrande <milo@ubuntu.com>, 2009, 2010.
+# Milo Casagrande <milo@ubuntu.com>, 2009, 2010, 2011, 2012.
+#
 msgid ""
 msgstr ""
 "Project-Id-Version: xz-utils\n"
 "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
-"POT-Creation-Date: 2010-09-10 14:50+0300\n"
-"PO-Revision-Date: 2010-09-16 21:32+0200\n"
+"POT-Creation-Date: 2012-05-29 13:50+0300\n"
+"PO-Revision-Date: 2012-05-31 09:57+0800\n"
 "Last-Translator: Milo Casagrande <milo@ubuntu.com>\n"
 "Language-Team: Italian <tp@lists.linux.it>\n"
+"Language: it\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
+"Content-Transfer-Encoding: 8-bit\n"
 "X-Launchpad-Export-Date: 2010-08-16 19:16+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
 
 #: src/xz/args.c:333
 #, c-format
 msgid "%s: Unknown file format type"
-msgstr "%s: tipo di formato del file sconosciutoN"
+msgstr "%s: tipo di formato del file sconosciuto"
 
 #: src/xz/args.c:356 src/xz/args.c:364
 #, c-format
@@ -97,7 +99,7 @@
 msgid "%s: File seems to have been moved, not removing"
 msgstr "%s: sembra che il file sia stato spostato, non viene rimosso"
 
-#: src/xz/file_io.c:144 src/xz/file_io.c:590
+#: src/xz/file_io.c:144 src/xz/file_io.c:589
 #, c-format
 msgid "%s: Cannot remove: %s"
 msgstr "%s: impossibile rimuovere: %s"
@@ -127,58 +129,58 @@
 msgid "%s: Is a directory, skipping"
 msgstr "%s: è una directory, viene saltata"
 
-#: src/xz/file_io.c:462
+#: src/xz/file_io.c:461
 #, c-format
 msgid "%s: Not a regular file, skipping"
 msgstr "%s: non è un file regolare, viene saltato"
 
-#: src/xz/file_io.c:479
+#: src/xz/file_io.c:478
 #, c-format
 msgid "%s: File has setuid or setgid bit set, skipping"
 msgstr "%s: il file ha il bit setuid o setgid impostato, viene saltato"
 
-#: src/xz/file_io.c:486
+#: src/xz/file_io.c:485
 #, c-format
 msgid "%s: File has sticky bit set, skipping"
 msgstr "%s: il file ha lo sticky bit impostato, viene saltato"
 
-#: src/xz/file_io.c:493
+#: src/xz/file_io.c:492
 #, c-format
 msgid "%s: Input file has more than one hard link, skipping"
 msgstr "%s: il file di input ha più di un collegamento fisico, viene saltato"
 
-#: src/xz/file_io.c:714
+#: src/xz/file_io.c:713
 #, c-format
 msgid "Error restoring the O_APPEND flag to standard output: %s"
 msgstr "Errore nel ripristinare la flag O_APPEND sullo standard output: %s"
 
-#: src/xz/file_io.c:726
+#: src/xz/file_io.c:725
 #, c-format
 msgid "%s: Closing the file failed: %s"
 msgstr "%s: chiusura del file non riuscita: %s"
 
-#: src/xz/file_io.c:762 src/xz/file_io.c:946
+#: src/xz/file_io.c:761 src/xz/file_io.c:945
 #, c-format
 msgid "%s: Seeking failed when trying to create a sparse file: %s"
 msgstr ""
 "%s: posizionamento non riuscito nel tentativo di creare un file sparso: %s"
 
-#: src/xz/file_io.c:821
+#: src/xz/file_io.c:820
 #, c-format
 msgid "%s: Read error: %s"
 msgstr "%s: errore di lettura: %s"
 
-#: src/xz/file_io.c:844
+#: src/xz/file_io.c:843
 #, c-format
 msgid "%s: Error seeking the file: %s"
 msgstr "%s: errore nel cercare il file: %s"
 
-#: src/xz/file_io.c:854
+#: src/xz/file_io.c:853
 #, c-format
 msgid "%s: Unexpected end of file"
 msgstr "%s: fine del file inaspettata"
 
-#: src/xz/file_io.c:904
+#: src/xz/file_io.c:903
 #, c-format
 msgid "%s: Write error: %s"
 msgstr "%s: errore di scrittura: %s"
@@ -212,7 +214,7 @@
 #. but the Check ID is known (here 2). This and other "Unknown-N"
 #. strings are used in tables, so the width must not exceed ten
 #. columns with a fixed-width font. It's OK to omit the dash if
-#. you need space for one extra letter.
+#. you need space for one extra letter, but don't use spaces.
 #: src/xz/list.c:69
 msgid "Unknown-2"
 msgstr "Sconosc2"
@@ -275,41 +277,41 @@
 #. to Ratio, the columns are right aligned. Check and Filename
 #. are left aligned. If you need longer words, it's OK to
 #. use two lines here. Test with "xz -l foo.xz".
-#: src/xz/list.c:612
+#: src/xz/list.c:603
 msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
 msgstr " Strm  Blocc.    Compresso     Estratto  Rapp.  Contr   Nome file"
 
-#: src/xz/list.c:652
+#: src/xz/list.c:643
 #, c-format
 msgid "  Streams:            %s\n"
 msgstr "  Stream:               %s\n"
 
-#: src/xz/list.c:654
+#: src/xz/list.c:645
 #, c-format
 msgid "  Blocks:             %s\n"
 msgstr "  Blocchi:              %s\n"
 
-#: src/xz/list.c:656
+#: src/xz/list.c:647
 #, c-format
 msgid "  Compressed size:    %s\n"
 msgstr "  Dim. compresso:       %s\n"
 
-#: src/xz/list.c:659
+#: src/xz/list.c:650
 #, c-format
 msgid "  Uncompressed size:  %s\n"
 msgstr "  Dim. estratto:        %s\n"
 
-#: src/xz/list.c:662
+#: src/xz/list.c:653
 #, c-format
 msgid "  Ratio:              %s\n"
 msgstr "  Rapporto:             %s\n"
 
-#: src/xz/list.c:664
+#: src/xz/list.c:655
 #, c-format
 msgid "  Check:              %s\n"
 msgstr "  Controllo:            %s\n"
 
-#: src/xz/list.c:665
+#: src/xz/list.c:656
 #, c-format
 msgid "  Stream padding:     %s\n"
 msgstr "  Padding dello stream: %s\n"
@@ -317,7 +319,7 @@
 #. TRANSLATORS: The second line is column headings. All except
 #. Check are right aligned; Check is left aligned. Test with
 #. "xz -lv foo.xz".
-#: src/xz/list.c:693
+#: src/xz/list.c:684
 msgid ""
 "  Streams:\n"
 "    Stream    Blocks      CompOffset    UncompOffset        CompSize      "
@@ -329,7 +331,7 @@
 
 #. TRANSLATORS: The second line is column headings. All
 #. except Check are right aligned; Check is left aligned.
-#: src/xz/list.c:748
+#: src/xz/list.c:739
 #, c-format
 msgid ""
 "  Blocks:\n"
@@ -347,52 +349,52 @@
 #. are right aligned. %*s is replaced with 0-120
 #. spaces to make the CheckVal column wide enough.
 #. Test with "xz -lvv foo.xz".
-#: src/xz/list.c:760
+#: src/xz/list.c:751
 #, c-format
 msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
 msgstr "      Val.cont %*s Header  Flag       Dim.compr.    Uso mem.  Filtri"
 
-#: src/xz/list.c:838 src/xz/list.c:1007
+#: src/xz/list.c:829 src/xz/list.c:998
 #, c-format
 msgid "  Memory needed:      %s MiB\n"
 msgstr "  Memoria necessaria:   %s MiB\n"
 
-#: src/xz/list.c:840 src/xz/list.c:1009
+#: src/xz/list.c:831 src/xz/list.c:1000
 #, c-format
 msgid "  Sizes in headers:   %s\n"
 msgstr "  Dim. negli header:    %s\n"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "Yes"
 msgstr "Sì"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "No"
 msgstr "No"
 
 #. TRANSLATORS: %s is an integer. Only the plural form of this
 #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
-#: src/xz/list.c:986
+#: src/xz/list.c:977
 #, c-format
 msgid "%s file\n"
 msgid_plural "%s files\n"
 msgstr[0] "%s file\n"
 msgstr[1] "%s file\n"
 
-#: src/xz/list.c:999
+#: src/xz/list.c:990
 msgid "Totals:"
 msgstr "Totali:"
 
-#: src/xz/list.c:1000
+#: src/xz/list.c:991
 #, c-format
 msgid "  Number of files:    %s\n"
 msgstr "  Numero di file:       %s\n"
 
-#: src/xz/list.c:1072
+#: src/xz/list.c:1063
 msgid "--list works only on .xz files (--format=xz or --format=auto)"
 msgstr "--list funziona solamente con file .xz (--format=xz o --format=auto)"
 
-#: src/xz/list.c:1078
+#: src/xz/list.c:1069
 msgid "--list does not support reading from standard input"
 msgstr "--list non è in grado di leggere dallo standard input"
 
@@ -427,61 +429,75 @@
 "Impossibile leggere i dati dallo standard input durante la lettura dei nomi "
 "dei file dallo standard input"
 
-#: src/xz/message.c:800 src/xz/message.c:844
+#. TRANSLATORS: This is the program name in the beginning
+#. of the line in messages. Usually it becomes "xz: ".
+#. This is a translatable string because French needs
+#. a space before a colon.
+#: src/xz/message.c:733
+#, c-format
+msgid "%s: "
+msgstr "%s: "
+
+#: src/xz/message.c:796 src/xz/message.c:846
 msgid "Internal error (bug)"
 msgstr "Errore interno (bug)"
 
-#: src/xz/message.c:807
+#: src/xz/message.c:803
 msgid "Cannot establish signal handlers"
 msgstr "Impossibile stabilire i gestori dei segnali"
 
-#: src/xz/message.c:816
+#: src/xz/message.c:812
 msgid "No integrity check; not verifying file integrity"
 msgstr ""
 "Nessun controllo d'integrità; l'integrità del file non viene verificata"
 
-#: src/xz/message.c:819
+#: src/xz/message.c:815
 msgid "Unsupported type of integrity check; not verifying file integrity"
 msgstr ""
 "Tipo di controllo di integrità non supportato; l'integrità del file non "
 "viene verificata"
 
-#: src/xz/message.c:826
+#: src/xz/message.c:822
 msgid "Memory usage limit reached"
 msgstr "Limite di utilizzo della memoria raggiunto"
 
-#: src/xz/message.c:829
+#: src/xz/message.c:825
 msgid "File format not recognized"
 msgstr "Formato di file non riconosciuto"
 
-#: src/xz/message.c:832
+#: src/xz/message.c:828
 msgid "Unsupported options"
 msgstr "Opzioni non supportate"
 
-#: src/xz/message.c:835
+#: src/xz/message.c:831
 msgid "Compressed data is corrupt"
 msgstr "I dati compressi sono danneggiati"
 
-#: src/xz/message.c:838
+#: src/xz/message.c:834
 msgid "Unexpected end of input"
 msgstr "Fine dell'input non attesa"
 
-#: src/xz/message.c:886
+#: src/xz/message.c:867
+#, c-format
+msgid "%s MiB of memory is required. The limiter is disabled."
+msgstr "%s MiB di memoria sono richiesti. Alcun limite impostato."
+
+#: src/xz/message.c:895
 #, c-format
 msgid "%s MiB of memory is required. The limit is %s."
 msgstr "%s MiB di memoria sono richiesti. Il limite è %s."
 
-#: src/xz/message.c:1053
+#: src/xz/message.c:1062
 #, c-format
 msgid "%s: Filter chain: %s\n"
 msgstr "%s: catena di filtri: %s\n"
 
-#: src/xz/message.c:1063
+#: src/xz/message.c:1072
 #, c-format
 msgid "Try `%s --help' for more information."
 msgstr "Provare \"%s --help\" per maggiori informazioni."
 
-#: src/xz/message.c:1089
+#: src/xz/message.c:1098
 #, c-format
 msgid ""
 "Usage: %s [OPTION]... [FILE]...\n"
@@ -492,18 +508,18 @@
 "Comprime o estrae i FILE nel formato .xz.\n"
 "\n"
 
-#: src/xz/message.c:1096
+#: src/xz/message.c:1105
 msgid ""
 "Mandatory arguments to long options are mandatory for short options too.\n"
 msgstr ""
 "Gli argomenti obbligatori per le opzioni lunghe lo sono anche per quelle "
 "brevi.\n"
 
-#: src/xz/message.c:1100
+#: src/xz/message.c:1109
 msgid " Operation mode:\n"
 msgstr " Modalità di operazione:\n"
 
-#: src/xz/message.c:1103
+#: src/xz/message.c:1112
 msgid ""
 "  -z, --compress      force compression\n"
 "  -d, --decompress    force decompression\n"
@@ -515,7 +531,7 @@
 "  -t, --test          Verifica l'integrità dei file compressi\n"
 "  -l, --list          Elenca informazioni sui file .xz"
 
-#: src/xz/message.c:1109
+#: src/xz/message.c:1118
 msgid ""
 "\n"
 " Operation modifiers:\n"
@@ -523,7 +539,7 @@
 "\n"
 " Modificatori di operazioni:\n"
 
-#: src/xz/message.c:1112
+#: src/xz/message.c:1121
 msgid ""
 "  -k, --keep          keep (don't delete) input files\n"
 "  -f, --force         force overwrite of output file and (de)compress links\n"
@@ -536,7 +552,7 @@
 "  -c, --stdout        Scrive sullo standard output e non elimina i file di "
 "input"
 
-#: src/xz/message.c:1118
+#: src/xz/message.c:1127
 msgid ""
 "      --no-sparse     do not create sparse files when decompressing\n"
 "  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
@@ -556,7 +572,7 @@
 "                      di newline\n"
 "      --files0=[FILE] Come --files ma usa il carattere null come terminatore"
 
-#: src/xz/message.c:1126
+#: src/xz/message.c:1135
 msgid ""
 "\n"
 " Basic file format and compression options:\n"
@@ -564,7 +580,7 @@
 "\n"
 " Formato file di base e opzioni di compressione:\n"
 
-#: src/xz/message.c:1128
+#: src/xz/message.c:1137
 msgid ""
 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
 "                      `auto' (default), `xz', `lzma', and `raw'\n"
@@ -579,12 +595,12 @@
 "attenzione),\n"
 "                      \"crc32\", \"crc64\" (predefinito) o \"sha256\""
 
-#: src/xz/message.c:1135
+#: src/xz/message.c:1144
 msgid ""
 "  -0 ... -9           compression preset; default is 6; take compressor "
 "*and*\n"
-"                      decompressor memory usage into account before using 7-"
-"9!"
+"                      decompressor memory usage into account before using "
+"7-9!"
 msgstr ""
 "  -0 ... -9           Preset di compressione; predefinito è 6; tenere a "
 "mente\n"
@@ -592,7 +608,7 @@
 "prima\n"
 "                      di usare 7-9"
 
-#: src/xz/message.c:1139
+#: src/xz/message.c:1148
 msgid ""
 "  -e, --extreme       try to improve compression ratio by using more CPU "
 "time;\n"
@@ -603,7 +619,7 @@
 "di\n"
 "                      memoria in fase di estrazione"
 
-#: src/xz/message.c:1144
+#: src/xz/message.c:1153
 #, no-c-format
 msgid ""
 "      --memlimit-compress=LIMIT\n"
@@ -621,7 +637,7 @@
 "byte,\n"
 "                      % della memoria RAM oppure 0 per il valore predefinito"
 
-#: src/xz/message.c:1151
+#: src/xz/message.c:1160
 msgid ""
 "      --no-adjust     if compression settings exceed the memory usage "
 "limit,\n"
@@ -633,7 +649,7 @@
 "                      utilizzo della memoria, lancia un errore invece di\n"
 "                      utilizzare valori più piccoli"
 
-#: src/xz/message.c:1157
+#: src/xz/message.c:1166
 msgid ""
 "\n"
 " Custom filter chain for compression (alternative for using presets):"
@@ -642,7 +658,7 @@
 " Catena di filtri personalizzati per la compressione (alternative per\n"
 " l'utilizzo di preset):"
 
-#: src/xz/message.c:1166
+#: src/xz/message.c:1175
 msgid ""
 "\n"
 "  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero "
@@ -672,8 +688,8 @@
 "                                   (4KiB - 1536MiB; 8MiB)\n"
 "                        lc=NUM     Numero di bit letterali di contesto (0-4; "
 "3)\n"
-"                        lp=NUM     Numero di bit letterali di posizione (0-"
-"4; 0)\n"
+"                        lp=NUM     Numero di bit letterali di posizione "
+"(0-4; 0)\n"
 "                        pb=NUM     Numero di bit di posizione (0-4; 2)\n"
 "                        mode=MODE  Modalità di compressione\n"
 "                                   (fast, normal; normal)\n"
@@ -685,7 +701,7 @@
 "0=automatica\n"
 "                                   (predefinito)"
 
-#: src/xz/message.c:1181
+#: src/xz/message.c:1190
 msgid ""
 "\n"
 "  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
@@ -708,7 +724,7 @@
 "                      start=NUM Offset iniziale per le conversioni\n"
 "                                (predefinito=0)"
 
-#: src/xz/message.c:1193
+#: src/xz/message.c:1202
 msgid ""
 "\n"
 "  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
@@ -720,7 +736,7 @@
 "                      dist=NUM   Distanza tra byte sottratti\n"
 "                                 gli uni dagli altri (1-256; 1)"
 
-#: src/xz/message.c:1201
+#: src/xz/message.c:1210
 msgid ""
 "\n"
 " Other options:\n"
@@ -728,7 +744,7 @@
 "\n"
 " Altre opzioni:\n"
 
-#: src/xz/message.c:1204
+#: src/xz/message.c:1213
 msgid ""
 "  -q, --quiet         suppress warnings; specify twice to suppress errors "
 "too\n"
@@ -741,16 +757,16 @@
 "ancora\n"
 "                      più prolisso"
 
-#: src/xz/message.c:1209
+#: src/xz/message.c:1218
 msgid "  -Q, --no-warn       make warnings not affect the exit status"
 msgstr "  -Q, --no-warn       Gli avvisi non influenzano lo stato d'uscita"
 
-#: src/xz/message.c:1211
+#: src/xz/message.c:1220
 msgid ""
 "      --robot         use machine-parsable messages (useful for scripts)"
 msgstr "      --robot         Usa messaggi analizzabili (utile per gli script)"
 
-#: src/xz/message.c:1214
+#: src/xz/message.c:1223
 msgid ""
 "      --info-memory   display the total amount of RAM and the currently "
 "active\n"
@@ -760,7 +776,7 @@
 "attuale\n"
 "                      attivo di utilizzo della memore ed esce"
 
-#: src/xz/message.c:1217
+#: src/xz/message.c:1226
 msgid ""
 "  -h, --help          display the short help (lists only the basic options)\n"
 "  -H, --long-help     display this long help and exit"
@@ -768,7 +784,7 @@
 "  -h, --help          Stampa l'aiuto breve (elenca solo le opzioni di base)\n"
 "  -H, --long-help     Stampa questo lungo aiuto ed esce"
 
-#: src/xz/message.c:1221
+#: src/xz/message.c:1230
 msgid ""
 "  -h, --help          display this short help and exit\n"
 "  -H, --long-help     display the long help (lists also the advanced options)"
@@ -776,11 +792,11 @@
 "  -h, --help          Stampa questo breve aiuto ed esce\n"
 "  -H, --long-help     Stampa l'aiuto lungo (elenca anche le opzioni avanzate)"
 
-#: src/xz/message.c:1226
+#: src/xz/message.c:1235
 msgid "  -V, --version       display the version number and exit"
 msgstr "  -V, --version       Stampa il numero della versione ed esce"
 
-#: src/xz/message.c:1228
+#: src/xz/message.c:1237
 msgid ""
 "\n"
 "With no FILE, or when FILE is -, read standard input.\n"
@@ -792,14 +808,14 @@
 #. for this package. Please add _another line_ saying
 #. "Report translation bugs to <...>\n" with the email or WWW
 #. address for translation bugs. Thanks.
-#: src/xz/message.c:1234
+#: src/xz/message.c:1243
 #, c-format
 msgid "Report bugs to <%s> (in English or Finnish).\n"
 msgstr ""
 "Segnalare i bug a <%s> (in inglese o finlandese).\n"
 "Segnalare i bug di traduzione a <tp@lists.linux.it>.\n"
 
-#: src/xz/message.c:1236
+#: src/xz/message.c:1245
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr "Sito web di %s: <%s>\n"
@@ -833,10 +849,10 @@
 #, c-format
 msgid "The selected match finder requires at least nice=%<PRIu32>"
 msgstr ""
-"Lo strumento per cercare corrispondenze selezionato richiede almeno nice=%"
-"<PRIu32>"
+"Lo strumento per cercare corrispondenze selezionato richiede almeno nice="
+"%<PRIu32>"
 
-#: src/xz/suffix.c:79 src/xz/suffix.c:164
+#: src/xz/suffix.c:101 src/xz/suffix.c:194
 #, c-format
 msgid ""
 "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
@@ -844,17 +860,17 @@
 "%s: con --format=raw, --suffix=.SUF è richiesto a meno che non si scriva "
 "sullo stdout"
 
-#: src/xz/suffix.c:99
+#: src/xz/suffix.c:121
 #, c-format
 msgid "%s: Filename has an unknown suffix, skipping"
 msgstr "%s: il nome del file ha un suffisso sconosciuto, viene saltato"
 
-#: src/xz/suffix.c:154
+#: src/xz/suffix.c:175 src/xz/suffix.c:184
 #, c-format
 msgid "%s: File already has `%s' suffix, skipping"
 msgstr "%s: il file ha già il suffisso \"%s\", viene saltato"
 
-#: src/xz/suffix.c:205
+#: src/xz/suffix.c:235
 #, c-format
 msgid "%s: Invalid filename suffix"
 msgstr "%s: suffisso del nome del file non valido"
@@ -878,8 +894,8 @@
 #, c-format
 msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]"
 msgstr ""
-"Il valore dell'opzione \"%s\" deve essere nell'intervallo [%<PRIu64>, %"
-"<PRIu64>]"
+"Il valore dell'opzione \"%s\" deve essere nell'intervallo [%<PRIu64>, "
+"%<PRIu64>]"
 
 #: src/xz/util.c:247
 msgid "Empty filename, skipping"
diff --git a/po/pl.po b/po/pl.po
index f359fae..c1056a7 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -1,13 +1,13 @@
 # Polish translation for xz.
 # This file is in the public domain.
-# Jakub Bogusz <qboosh@pld-linux.org>, 2011.
+# Jakub Bogusz <qboosh@pld-linux.org>, 2011-2012.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: xz 5.0.1\n"
+"Project-Id-Version: xz 5.0.2\n"
 "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
-"POT-Creation-Date: 2011-01-28 20:01+0200\n"
-"PO-Revision-Date: 2011-02-02 16:51+0100\n"
+"POT-Creation-Date: 2012-05-29 13:50+0300\n"
+"PO-Revision-Date: 2012-05-29 18:15+0200\n"
 "Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
 "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
 "Language: pl\n"
@@ -265,41 +265,41 @@
 #. to Ratio, the columns are right aligned. Check and Filename
 #. are left aligned. If you need longer words, it's OK to
 #. use two lines here. Test with "xz -l foo.xz".
-#: src/xz/list.c:612
+#: src/xz/list.c:603
 msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
 msgstr "Strum.  Bloki    Spakowany  Rozpakowany  Wsp.  Kontrola Nazwa pliku"
 
-#: src/xz/list.c:652
+#: src/xz/list.c:643
 #, c-format
 msgid "  Streams:            %s\n"
 msgstr "  Strumienie:            %s\n"
 
-#: src/xz/list.c:654
+#: src/xz/list.c:645
 #, c-format
 msgid "  Blocks:             %s\n"
 msgstr "  Bloki:                 %s\n"
 
-#: src/xz/list.c:656
+#: src/xz/list.c:647
 #, c-format
 msgid "  Compressed size:    %s\n"
 msgstr "  Rozmiar spakowany:     %s\n"
 
-#: src/xz/list.c:659
+#: src/xz/list.c:650
 #, c-format
 msgid "  Uncompressed size:  %s\n"
 msgstr "  Rozmiar rozpakowany:   %s\n"
 
-#: src/xz/list.c:662
+#: src/xz/list.c:653
 #, c-format
 msgid "  Ratio:              %s\n"
 msgstr "  Współczynnik:          %s\n"
 
-#: src/xz/list.c:664
+#: src/xz/list.c:655
 #, c-format
 msgid "  Check:              %s\n"
 msgstr "  Kontrola spójności:    %s\n"
 
-#: src/xz/list.c:665
+#: src/xz/list.c:656
 #, c-format
 msgid "  Stream padding:     %s\n"
 msgstr "  Wyrównanie strumienia: %s\n"
@@ -307,7 +307,7 @@
 #. TRANSLATORS: The second line is column headings. All except
 #. Check are right aligned; Check is left aligned. Test with
 #. "xz -lv foo.xz".
-#: src/xz/list.c:693
+#: src/xz/list.c:684
 msgid ""
 "  Streams:\n"
 "    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
@@ -317,7 +317,7 @@
 
 #. TRANSLATORS: The second line is column headings. All
 #. except Check are right aligned; Check is left aligned.
-#: src/xz/list.c:748
+#: src/xz/list.c:739
 #, c-format
 msgid ""
 "  Blocks:\n"
@@ -333,32 +333,32 @@
 #. are right aligned. %*s is replaced with 0-120
 #. spaces to make the CheckVal column wide enough.
 #. Test with "xz -lvv foo.xz".
-#: src/xz/list.c:760
+#: src/xz/list.c:751
 #, c-format
 msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
 msgstr "   S.kontr. %*sNagłówek Flagi     Rozm. spak.  Uż.pamięci  Filtry"
 
-#: src/xz/list.c:838 src/xz/list.c:1007
+#: src/xz/list.c:829 src/xz/list.c:998
 #, c-format
 msgid "  Memory needed:      %s MiB\n"
 msgstr "  Wymagana pamięć:       %s MiB\n"
 
-#: src/xz/list.c:840 src/xz/list.c:1009
+#: src/xz/list.c:831 src/xz/list.c:1000
 #, c-format
 msgid "  Sizes in headers:   %s\n"
 msgstr "  Rozmiar w nagłówkach:  %s\n"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "Yes"
 msgstr "Tak"
 
-#: src/xz/list.c:841 src/xz/list.c:1010
+#: src/xz/list.c:832 src/xz/list.c:1001
 msgid "No"
 msgstr "Nie"
 
 #. TRANSLATORS: %s is an integer. Only the plural form of this
 #. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
-#: src/xz/list.c:986
+#: src/xz/list.c:977
 #, c-format
 msgid "%s file\n"
 msgid_plural "%s files\n"
@@ -366,20 +366,20 @@
 msgstr[1] "%s pliki\n"
 msgstr[2] "%s plików\n"
 
-#: src/xz/list.c:999
+#: src/xz/list.c:990
 msgid "Totals:"
 msgstr "Sumarycznie:"
 
-#: src/xz/list.c:1000
+#: src/xz/list.c:991
 #, c-format
 msgid "  Number of files:    %s\n"
 msgstr "  Liczba plików:         %s\n"
 
-#: src/xz/list.c:1072
+#: src/xz/list.c:1063
 msgid "--list works only on .xz files (--format=xz or --format=auto)"
 msgstr "--list działa tylko z plikami .xz (--format=xz lub --format=auto)"
 
-#: src/xz/list.c:1078
+#: src/xz/list.c:1069
 msgid "--list does not support reading from standard input"
 msgstr "--list nie obsługuje odczytu ze standardowego wejścia"
 
@@ -406,58 +406,72 @@
 msgid "Cannot read data from standard input when reading filenames from standard input"
 msgstr "Nie można odczytać danych ze standardowego wejścia przy czytaniu nazw plików ze standardowego wejścia"
 
-#: src/xz/message.c:792 src/xz/message.c:842
+#. TRANSLATORS: This is the program name in the beginning
+#. of the line in messages. Usually it becomes "xz: ".
+#. This is a translatable string because French needs
+#. a space before a colon.
+#: src/xz/message.c:733
+#, c-format
+msgid "%s: "
+msgstr "%s: "
+
+#: src/xz/message.c:796 src/xz/message.c:846
 msgid "Internal error (bug)"
 msgstr "Błąd wewnętrzny"
 
-#: src/xz/message.c:799
+#: src/xz/message.c:803
 msgid "Cannot establish signal handlers"
 msgstr "Nie można ustawić obsługi sygnałów"
 
-#: src/xz/message.c:808
+#: src/xz/message.c:812
 msgid "No integrity check; not verifying file integrity"
 msgstr "Brak kontroli spójności; poprawność plików nie będzie weryfikowana"
 
-#: src/xz/message.c:811
+#: src/xz/message.c:815
 msgid "Unsupported type of integrity check; not verifying file integrity"
 msgstr "Nieobsługiwany typ kontroli spójności; poprawność plików nie będzie weryfikowana"
 
-#: src/xz/message.c:818
+#: src/xz/message.c:822
 msgid "Memory usage limit reached"
 msgstr "Osiągnięto limit użycia pamięci"
 
-#: src/xz/message.c:821
+#: src/xz/message.c:825
 msgid "File format not recognized"
 msgstr "Nie rozpoznany format pliku"
 
-#: src/xz/message.c:824
+#: src/xz/message.c:828
 msgid "Unsupported options"
 msgstr "Nieobsługiwane opcje"
 
-#: src/xz/message.c:827
+#: src/xz/message.c:831
 msgid "Compressed data is corrupt"
 msgstr "Dane skompresowane są uszkodzone"
 
-#: src/xz/message.c:830
+#: src/xz/message.c:834
 msgid "Unexpected end of input"
 msgstr "Nieoczekiwany koniec wejścia"
 
-#: src/xz/message.c:881
+#: src/xz/message.c:867
+#, c-format
+msgid "%s MiB of memory is required. The limiter is disabled."
+msgstr "Wymagane jest %s MiB pamięci. Limit jest wyłączony."
+
+#: src/xz/message.c:895
 #, c-format
 msgid "%s MiB of memory is required. The limit is %s."
 msgstr "Wymagane jest %s MiB pamięci. Limit to %s."
 
-#: src/xz/message.c:1048
+#: src/xz/message.c:1062
 #, c-format
 msgid "%s: Filter chain: %s\n"
 msgstr "%s: Łańcuch filtrów: %s\n"
 
-#: src/xz/message.c:1058
+#: src/xz/message.c:1072
 #, c-format
 msgid "Try `%s --help' for more information."
 msgstr "Polecenie `%s --help' pokaże więcej informacji."
 
-#: src/xz/message.c:1084
+#: src/xz/message.c:1098
 #, c-format
 msgid ""
 "Usage: %s [OPTION]... [FILE]...\n"
@@ -468,17 +482,17 @@
 "Kompresja lub dekompresja PLIKÓW w formacie .xz.\n"
 "\n"
 
-#: src/xz/message.c:1091
+#: src/xz/message.c:1105
 msgid "Mandatory arguments to long options are mandatory for short options too.\n"
 msgstr ""
 "Argumenty obowiązkowe dla opcji długich są obowiązkowe również dla opcji\n"
 "krótkich.\n"
 
-#: src/xz/message.c:1095
+#: src/xz/message.c:1109
 msgid " Operation mode:\n"
 msgstr " Tryb pracy:\n"
 
-#: src/xz/message.c:1098
+#: src/xz/message.c:1112
 msgid ""
 "  -z, --compress      force compression\n"
 "  -d, --decompress    force decompression\n"
@@ -490,7 +504,7 @@
 "  -t, --test          sprawdzenie spójności plików skompresowanych\n"
 "  -l, --list          wypisanie informacji o plikach .xz"
 
-#: src/xz/message.c:1104
+#: src/xz/message.c:1118
 msgid ""
 "\n"
 " Operation modifiers:\n"
@@ -498,7 +512,7 @@
 "\n"
 " Modyfikatory operacji:\n"
 
-#: src/xz/message.c:1107
+#: src/xz/message.c:1121
 msgid ""
 "  -k, --keep          keep (don't delete) input files\n"
 "  -f, --force         force overwrite of output file and (de)compress links\n"
@@ -508,7 +522,7 @@
 "  -f, --force         nadpisywanie plików wyjściowych i (de)kompresja dowiązań\n"
 "  -c, --stdout        zapis na standardowe wyjście, nieusuwanie plików wej."
 
-#: src/xz/message.c:1113
+#: src/xz/message.c:1127
 msgid ""
 "      --no-sparse     do not create sparse files when decompressing\n"
 "  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
@@ -524,7 +538,7 @@
 "                      wejścia; muszą być zakończone znakiem nowej linii\n"
 "      --files0[=PLIK] podobnie do --files, ale znakiem kończącym musi być NUL"
 
-#: src/xz/message.c:1121
+#: src/xz/message.c:1135
 msgid ""
 "\n"
 " Basic file format and compression options:\n"
@@ -532,7 +546,7 @@
 "\n"
 " Podstawowe opcje formatu pliku i kompresji:\n"
 
-#: src/xz/message.c:1123
+#: src/xz/message.c:1137
 msgid ""
 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
 "                      `auto' (default), `xz', `lzma', and `raw'\n"
@@ -544,7 +558,7 @@
 "  -C, --check=TEST    typ kontroli spójności: `none' (ostrożnie!),\n"
 "                      `crc32', `crc64' (domyślny) lub `sha256'"
 
-#: src/xz/message.c:1130
+#: src/xz/message.c:1144
 msgid ""
 "  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
 "                      decompressor memory usage into account before using 7-9!"
@@ -553,7 +567,7 @@
 "                      użyciem wartości 7-9 należy wziąć pod uwagę wykorzystanie\n"
 "                      pamięci przy kompresji *oraz* dekompresji!"
 
-#: src/xz/message.c:1134
+#: src/xz/message.c:1148
 msgid ""
 "  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
 "                      does not affect decompressor memory requirements"
@@ -562,7 +576,7 @@
 "                      ilości czasu procesora; nie wpływa na wymagania\n"
 "                      pamięciowe dekompresora"
 
-#: src/xz/message.c:1139
+#: src/xz/message.c:1153
 #, no-c-format
 msgid ""
 "      --memlimit-compress=LIMIT\n"
@@ -578,7 +592,7 @@
 "                      dekompresji lub obu; LIMIT jest w bajtach, % RAM lub 0\n"
 "                      dla limitów domyślnych"
 
-#: src/xz/message.c:1146
+#: src/xz/message.c:1160
 msgid ""
 "      --no-adjust     if compression settings exceed the memory usage limit,\n"
 "                      give an error instead of adjusting the settings downwards"
@@ -587,7 +601,7 @@
 "                      pamięci, zostanie zgłoszony błąd zamiast zmniejszania\n"
 "                      ustawień"
 
-#: src/xz/message.c:1152
+#: src/xz/message.c:1166
 msgid ""
 "\n"
 " Custom filter chain for compression (alternative for using presets):"
@@ -595,7 +609,7 @@
 "\n"
 " Łańcuch własnych filtrów do kompresji (alternatywa do używania -0 .. -9):"
 
-#: src/xz/message.c:1161
+#: src/xz/message.c:1175
 msgid ""
 "\n"
 "  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
@@ -624,7 +638,7 @@
 "                        mf=NAZWA   dopasowywacz (hc3, hc4, bt2, bt3, bt4; bt4)\n"
 "                        depth=ILE  maks. głębokość szukania; 0=auto (domyślne)"
 
-#: src/xz/message.c:1176
+#: src/xz/message.c:1190
 msgid ""
 "\n"
 "  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
@@ -646,7 +660,7 @@
 "                      Poprawne OPCJE dla wszystkich filtrów BCJ:\n"
 "                        start=ILE  offset początku konwersji (domyślnie=0)"
 
-#: src/xz/message.c:1188
+#: src/xz/message.c:1202
 msgid ""
 "\n"
 "  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
@@ -658,7 +672,7 @@
 "                        dist=ILE   odległość między bajtami odejmowanymi od\n"
 "                                   siebie (1-256; 1)"
 
-#: src/xz/message.c:1196
+#: src/xz/message.c:1210
 msgid ""
 "\n"
 " Other options:\n"
@@ -666,7 +680,7 @@
 "\n"
 " Inne opcje:\n"
 
-#: src/xz/message.c:1199
+#: src/xz/message.c:1213
 msgid ""
 "  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
 "  -v, --verbose       be verbose; specify twice for even more verbose"
@@ -674,15 +688,15 @@
 "  -q, --quiet         pominięcie ostrzeżeń; dwukrotne podanie pomija też błędy\n"
 "  -v, --verbose       więcej informacji; dwukrotne podanie to jeszcze więcej"
 
-#: src/xz/message.c:1204
+#: src/xz/message.c:1218
 msgid "  -Q, --no-warn       make warnings not affect the exit status"
 msgstr "  -Q, --no-warn       ostrzeżenia nie mają wpływu na status zakończenia"
 
-#: src/xz/message.c:1206
+#: src/xz/message.c:1220
 msgid "      --robot         use machine-parsable messages (useful for scripts)"
 msgstr "      --robot         komunikaty w formacie dla maszyny (do skryptów)"
 
-#: src/xz/message.c:1209
+#: src/xz/message.c:1223
 msgid ""
 "      --info-memory   display the total amount of RAM and the currently active\n"
 "                      memory usage limits, and exit"
@@ -690,7 +704,7 @@
 "      --info-memory   wyświetlenie całkowitej ilości pamięci RAM oraz aktualnie\n"
 "                      aktywnych limitów pamięci i zakończenie pracy"
 
-#: src/xz/message.c:1212
+#: src/xz/message.c:1226
 msgid ""
 "  -h, --help          display the short help (lists only the basic options)\n"
 "  -H, --long-help     display this long help and exit"
@@ -698,7 +712,7 @@
 "  -h, --help          wyświetlenie krótkiego opisu (tylko podstawowe opcje)\n"
 "  -H, --long-help     wyświetlenie tego długiego opisu i zakończenie"
 
-#: src/xz/message.c:1216
+#: src/xz/message.c:1230
 msgid ""
 "  -h, --help          display this short help and exit\n"
 "  -H, --long-help     display the long help (lists also the advanced options)"
@@ -706,11 +720,11 @@
 "  -h, --help          wyświetlenie tego krótkiego opisu i zakończenie\n"
 "  -H, --long-help     wyświetlenie długiego opisu (także opcje zaawansowane)"
 
-#: src/xz/message.c:1221
+#: src/xz/message.c:1235
 msgid "  -V, --version       display the version number and exit"
 msgstr "  -V, --version       wyświetlenie informacji o wersji i zakończenie"
 
-#: src/xz/message.c:1223
+#: src/xz/message.c:1237
 msgid ""
 "\n"
 "With no FILE, or when FILE is -, read standard input.\n"
@@ -722,7 +736,7 @@
 #. for this package. Please add _another line_ saying
 #. "Report translation bugs to <...>\n" with the email or WWW
 #. address for translation bugs. Thanks.
-#: src/xz/message.c:1229
+#: src/xz/message.c:1243
 #, c-format
 msgid "Report bugs to <%s> (in English or Finnish).\n"
 msgstr ""
@@ -731,7 +745,7 @@
 "Błędy w tłumaczeniu prosimy zgłaszać na adres\n"
 "<translation-team-pl@lists.sourceforge.net>.\n"
 
-#: src/xz/message.c:1231
+#: src/xz/message.c:1245
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr "Strona domowa %s: <%s>\n"
@@ -765,22 +779,22 @@
 msgid "The selected match finder requires at least nice=%<PRIu32>"
 msgstr "Wybrany dopasowywacz wymaga przynajmniej nice=%<PRIu32>"
 
-#: src/xz/suffix.c:104 src/xz/suffix.c:189
+#: src/xz/suffix.c:101 src/xz/suffix.c:194
 #, c-format
 msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
 msgstr "%s: Przy --format=raw i zapisie do pliku wymagana jest opcja --suffix=.ROZ"
 
-#: src/xz/suffix.c:124
+#: src/xz/suffix.c:121
 #, c-format
 msgid "%s: Filename has an unknown suffix, skipping"
 msgstr "%s: Nazwa pliku ma nieznane rozszerzenie, pominięto"
 
-#: src/xz/suffix.c:179
+#: src/xz/suffix.c:175 src/xz/suffix.c:184
 #, c-format
 msgid "%s: File already has `%s' suffix, skipping"
 msgstr "%s: Plik już ma rozszerzenie `%s', pominięto"
 
-#: src/xz/suffix.c:230
+#: src/xz/suffix.c:235
 #, c-format
 msgid "%s: Invalid filename suffix"
 msgstr "%s: Błędne rozszerzenie nazwy pliku"
diff --git a/src/common/sysdefs.h b/src/common/sysdefs.h
index 69370ba..5ea6bda 100644
--- a/src/common/sysdefs.h
+++ b/src/common/sysdefs.h
@@ -103,9 +103,12 @@
 #	define UINT64_MAX UINT64_C(18446744073709551615)
 #endif
 
-// Interix has broken header files, which typedef size_t to unsigned long,
-// but a few lines later define SIZE_MAX to INT32_MAX.
-#ifdef __INTERIX
+// Incorrect(?) SIZE_MAX:
+//   - Interix headers typedef size_t to unsigned long,
+//     but a few lines later define SIZE_MAX to INT32_MAX.
+//   - SCO OpenServer (x86) headers typedef size_t to unsigned int
+//     but define SIZE_MAX to INT32_MAX.
+#if defined(__INTERIX) || defined(_SCO_DS)
 #	undef SIZE_MAX
 #endif
 
diff --git a/src/common/tuklib_open_stdxxx.c b/src/common/tuklib_open_stdxxx.c
index 08bc60d..26702a6 100644
--- a/src/common/tuklib_open_stdxxx.c
+++ b/src/common/tuklib_open_stdxxx.c
@@ -39,12 +39,14 @@
 					| (i == 0 ? O_WRONLY : O_RDONLY));
 
 			if (fd != i) {
+				if (fd != -1)
+					(void)close(fd);
+
 				// Something went wrong. Exit with the
 				// exit status we were given. Don't try
 				// to print an error message, since stderr
 				// may very well be non-existent. This
 				// error should be extremely rare.
-				(void)close(fd);
 				exit(err_status);
 			}
 		}
diff --git a/src/liblzma/Makefile.am b/src/liblzma/Makefile.am
index 7b3d69a..16e8edd 100644
--- a/src/liblzma/Makefile.am
+++ b/src/liblzma/Makefile.am
@@ -24,7 +24,7 @@
 	-I$(top_srcdir)/src/liblzma/simple \
 	-I$(top_srcdir)/src/common \
 	-DTUKLIB_SYMBOL_PREFIX=lzma_
-liblzma_la_LDFLAGS = -no-undefined -version-info 5:3:0
+liblzma_la_LDFLAGS = -no-undefined -version-info 5:4:0
 
 include $(srcdir)/common/Makefile.inc
 include $(srcdir)/check/Makefile.inc
diff --git a/src/liblzma/api/lzma/version.h b/src/liblzma/api/lzma/version.h
index 9226663..629e8e1 100644
--- a/src/liblzma/api/lzma/version.h
+++ b/src/liblzma/api/lzma/version.h
@@ -22,7 +22,7 @@
  */
 #define LZMA_VERSION_MAJOR 5
 #define LZMA_VERSION_MINOR 0
-#define LZMA_VERSION_PATCH 3
+#define LZMA_VERSION_PATCH 4
 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
 
 #ifndef LZMA_VERSION_COMMIT
diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c
index ddb9d36..9af4bc1 100644
--- a/src/liblzma/common/index.c
+++ b/src/liblzma/common/index.c
@@ -398,10 +398,13 @@
 lzma_index_init(lzma_allocator *allocator)
 {
 	lzma_index *i = index_init_plain(allocator);
+	if (i == NULL)
+		return NULL;
+
 	index_stream *s = index_stream_init(0, 0, 1, 0, allocator);
-	if (i == NULL || s == NULL) {
-		index_stream_end(s, allocator);
+	if (s == NULL) {
 		lzma_free(i, allocator);
+		return NULL;
 	}
 
 	index_tree_append(&i->streams, &s->node);
diff --git a/src/liblzma/lz/lz_encoder_hash.h b/src/liblzma/lz/lz_encoder_hash.h
index c398d7d..342a333 100644
--- a/src/liblzma/lz/lz_encoder_hash.h
+++ b/src/liblzma/lz/lz_encoder_hash.h
@@ -39,7 +39,7 @@
 // Endianness doesn't matter in hash_2_calc() (no effect on the output).
 #ifdef TUKLIB_FAST_UNALIGNED_ACCESS
 #	define hash_2_calc() \
-		const uint32_t hash_value = *(const uint16_t *)(cur);
+		const uint32_t hash_value = *(const uint16_t *)(cur)
 #else
 #	define hash_2_calc() \
 		const uint32_t hash_value \
diff --git a/src/liblzma/simple/simple_coder.c b/src/liblzma/simple/simple_coder.c
index 37de7fa..a02b039 100644
--- a/src/liblzma/simple/simple_coder.c
+++ b/src/liblzma/simple/simple_coder.c
@@ -35,9 +35,6 @@
 
 	} else {
 		// Call the next coder in the chain to provide us some data.
-		// We don't care about uncompressed_size here, because
-		// the next filter in the chain will do it for us (since
-		// we don't change the size of the data).
 		const lzma_ret ret = coder->next.code(
 				coder->next.coder, allocator,
 				in, in_pos, in_size,
@@ -110,7 +107,7 @@
 	// filtered if the buffer sizes used by the application are reasonable.
 	const size_t out_avail = out_size - *out_pos;
 	const size_t buf_avail = coder->size - coder->pos;
-	if (out_avail > buf_avail) {
+	if (out_avail > buf_avail || buf_avail == 0) {
 		// Store the old position so that we know from which byte
 		// to start filtering.
 		const size_t out_start = *out_pos;
diff --git a/src/liblzma/simple/simple_private.h b/src/liblzma/simple/simple_private.h
index a69f827..fcf9f7c 100644
--- a/src/liblzma/simple/simple_private.h
+++ b/src/liblzma/simple/simple_private.h
@@ -22,8 +22,7 @@
 	/// Next filter in the chain
 	lzma_next_coder next;
 
-	/// True if the next coder in the chain has returned LZMA_STREAM_END
-	/// or if we have processed uncompressed_size bytes.
+	/// True if the next coder in the chain has returned LZMA_STREAM_END.
 	bool end_was_reached;
 
 	/// True if filter() should encode the data; false to decode.
diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in
index 45633e0..deec3eb 100644
--- a/src/scripts/xzdiff.in
+++ b/src/scripts/xzdiff.in
@@ -120,10 +120,12 @@
                 ( ($xz2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
                 eval "$cmp" /dev/fd/5 - >&3) 5<&0
             )
+            cmp_status=$?
             case $xz_status in
               *[1-9]*) xz_status=1;;
               *) xz_status=0;;
             esac
+            (exit $cmp_status)
           else
             F=`expr "/$2" : '.*/\(.*\)[-.][ablmtxz2]*$'` || F=$prog
             tmp=
diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in
index ae30725..515b516 100644
--- a/src/scripts/xzgrep.in
+++ b/src/scripts/xzgrep.in
@@ -194,7 +194,8 @@
     fi >&3 5>&-
   )
   r=$?
-  test "$xz_status" -eq 0 || test "$xz_status" -eq 2 || r=2
+  test "$xz_status" -eq 0 || test "$xz_status" -eq 2 \
+      || test "$(kill -l "$xz_status" 2> /dev/null)" = "PIPE" || r=2
   test $res -lt $r && res=$r
 done
 exit $res
diff --git a/src/xz/args.c b/src/xz/args.c
index 4bd84a0..34761d4 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -438,7 +438,7 @@
 		} else if (prev_was_space) {
 			prev_was_space = false;
 
-			// Keep argc small enough to fit into a singed int
+			// Keep argc small enough to fit into a signed int
 			// and to keep it usable for memory allocation.
 			if (++argc == my_min(
 					INT_MAX, SIZE_MAX / sizeof(char *)))
diff --git a/src/xz/coder.c b/src/xz/coder.c
index b123ec5..69b1225 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -284,7 +284,10 @@
 static bool
 is_format_xz(void)
 {
-	return strm.avail_in >= 6 && memcmp(in_buf.u8, "\3757zXZ", 6) == 0;
+	// Specify the magic as hex to be compatible with EBCDIC systems.
+	static const uint8_t magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 };
+	return strm.avail_in >= sizeof(magic)
+			&& memcmp(in_buf.u8, magic, sizeof(magic)) == 0;
 }
 
 
diff --git a/src/xz/list.c b/src/xz/list.c
index 1c93718..98307eb 100644
--- a/src/xz/list.c
+++ b/src/xz/list.c
@@ -382,14 +382,9 @@
 	if (buf.u8[0] == 0)
 		goto data_error;
 
-	lzma_block block;
-	lzma_filter filters[LZMA_FILTERS_MAX + 1];
-
-	// Initialize the pointers so that they can be passed to free().
-	for (size_t i = 0; i < ARRAY_SIZE(filters); ++i)
-		filters[i].options = NULL;
-
 	// Initialize the block structure and decode Block Header Size.
+	lzma_filter filters[LZMA_FILTERS_MAX + 1];
+	lzma_block block;
 	block.version = 0;
 	block.check = iter->stream.flags->check;
 	block.filters = filters;
@@ -437,6 +432,10 @@
 		break;
 
 	case LZMA_DATA_ERROR:
+		// Free the memory allocated by lzma_block_header_decode().
+		for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+			free(filters[i].options);
+
 		goto data_error;
 
 	default:
@@ -466,14 +465,6 @@
 	// Show the error message.
 	message_error("%s: %s", pair->src_name,
 			message_strm(LZMA_DATA_ERROR));
-
-	// Free the memory allocated by lzma_block_header_decode().
-	// This is truly needed only if we get here after a succcessful
-	// call to lzma_block_header_decode() but it doesn't hurt to
-	// always do it.
-	for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
-		free(filters[i].options);
-
 	return true;
 }
 
diff --git a/src/xz/message.c b/src/xz/message.c
index 80c86a4..0a7a522 100644
--- a/src/xz/message.c
+++ b/src/xz/message.c
@@ -211,7 +211,7 @@
 static void
 print_filename(void)
 {
-	if (files_total != 1 || filename != stdin_filename) {
+	if (!opt_robot && (files_total != 1 || filename != stdin_filename)) {
 		signals_block();
 
 		FILE *file = opt_mode == MODE_LIST ? stdout : stderr;
@@ -859,6 +859,17 @@
 	// the user might need to +1 MiB to get high enough limit.)
 	memusage = round_up_to_mib(memusage);
 
+	uint64_t memlimit = hardware_memlimit_get(opt_mode);
+
+	// Handle the case when there is no memory usage limit.
+	// This way we don't print a weird message with a huge number.
+	if (memlimit == UINT64_MAX) {
+		message(v, _("%s MiB of memory is required. "
+				"The limiter is disabled."),
+				uint64_to_str(memusage, 0));
+		return;
+	}
+
 	// With US-ASCII:
 	// 2^64 with thousand separators + " MiB" suffix + '\0' = 26 + 4 + 1
 	// But there may be multibyte chars so reserve enough space.
@@ -867,7 +878,6 @@
 	// Show the memory usage limit as MiB unless it is less than 1 MiB.
 	// This way it's easy to notice errors where one has typed
 	// --memory=123 instead of --memory=123MiB.
-	uint64_t memlimit = hardware_memlimit_get(opt_mode);
 	if (memlimit < (UINT32_C(1) << 20)) {
 		snprintf(memlimitstr, sizeof(memlimitstr), "%s B",
 				uint64_to_str(memlimit, 1));
diff --git a/src/xz/xz.1 b/src/xz/xz.1
index f1c9135..8edc456 100644
--- a/src/xz/xz.1
+++ b/src/xz/xz.1
@@ -5,7 +5,7 @@
 .\" This file has been put into the public domain.
 .\" You can do whatever you want with this file.
 .\"
-.TH XZ 1 "2010-10-04" "Tukaani" "XZ Utils"
+.TH XZ 1 "2012-05-27" "Tukaani" "XZ Utils"
 .
 .SH NAME
 xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files
@@ -1836,6 +1836,25 @@
 .PD
 .PP
 The columns of the
+.B summary
+lines:
+.PD 0
+.RS
+.IP 2. 4
+Amount of memory (in bytes) required to decompress
+this file with this
+.B xz
+version
+.IP 3. 4
+.B yes
+or
+.B no
+indicating if all block headers have both compressed size and
+uncompressed size stored in them
+.RE
+.PD
+.PP
+The columns of the
 .B totals
 line:
 .PD 0
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d0807ae..c4e17ed 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,6 +10,7 @@
 	tests.h \
 	test_files.sh \
 	test_compress.sh \
+	test_scripts.sh \
 	bcj_test.c \
 	compress_prepared_bcj_sparc \
 	compress_prepared_bcj_x86
@@ -33,7 +34,8 @@
 	test_stream_flags \
 	test_filter_flags \
 	test_block_header \
-	test_index
+	test_index \
+	test_bcj_exact_size
 
 TESTS = \
 	test_check \
@@ -41,8 +43,13 @@
 	test_filter_flags \
 	test_block_header \
 	test_index \
+	test_bcj_exact_size \
 	test_files.sh \
 	test_compress.sh
 
+if COND_SCRIPTS
+TESTS += test_scripts.sh
+endif
+
 clean-local:
 	-rm -f compress_generated_*
diff --git a/tests/create_compress_files.c b/tests/create_compress_files.c
index 44367d8..bd5b4ef 100644
--- a/tests/create_compress_files.c
+++ b/tests/create_compress_files.c
@@ -79,7 +79,8 @@
 write_abc(FILE *file)
 {
 	for (size_t i = 0; i < 12345; ++i)
-		fwrite("abc\n", 4, 1, file);
+		if (fwrite("abc\n", 4, 1, file) != 1)
+			exit(1);
 }
 
 
diff --git a/tests/files/README b/tests/files/README
index 2f74cef..53950ed 100644
--- a/tests/files/README
+++ b/tests/files/README
@@ -188,6 +188,10 @@
 
     bad-1-block_header-5.xz has zero as Compressed Size in Block Header.
 
+    bad-1-block_header-6.xz has corrupt Block Header which may crash
+    xz -lvv in XZ Utils 5.0.3 and earlier. It was fixed in the commit
+    c0297445064951807803457dca1611b3c47e7f0f.
+
     bad-2-index-1.xz has wrong Unpadded Sizes in Index.
 
     bad-2-index-2.xz has wrong Uncompressed Sizes in Index.
diff --git a/tests/files/bad-1-block_header-6.xz b/tests/files/bad-1-block_header-6.xz
new file mode 100644
index 0000000..ecf0ff0
--- /dev/null
+++ b/tests/files/bad-1-block_header-6.xz
Binary files differ
diff --git a/tests/test_bcj_exact_size.c b/tests/test_bcj_exact_size.c
new file mode 100644
index 0000000..cbd9340
--- /dev/null
+++ b/tests/test_bcj_exact_size.c
@@ -0,0 +1,112 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file       test_bcj_exact_size.c
+/// \brief      Tests BCJ decoding when the output size is known
+///
+/// These tests fail with XZ Utils 5.0.3 and earlier.
+//
+//  Author:     Lasse Collin
+//
+//  This file has been put into the public domain.
+//  You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+
+/// Something to be compressed
+static const uint8_t in[16] = "0123456789ABCDEF";
+
+/// in[] after compression
+static uint8_t compressed[1024];
+static size_t compressed_size = 0;
+
+/// Output buffer for decompressing compressed[]
+static uint8_t out[sizeof(in)];
+
+
+static void
+compress(void)
+{
+	// Compress with PowerPC BCJ and LZMA2. PowerPC BCJ is used because
+	// it has fixed 4-byte alignment which makes triggering the potential
+	// bug easy.
+	lzma_options_lzma opt_lzma2;
+	succeed(lzma_lzma_preset(&opt_lzma2, 0));
+
+	lzma_filter filters[3] = {
+		{ .id = LZMA_FILTER_POWERPC, .options = NULL },
+		{ .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
+		{ .id = LZMA_VLI_UNKNOWN, .options = NULL },
+	};
+
+	expect(lzma_stream_buffer_encode(filters, LZMA_CHECK_CRC32, NULL,
+			in, sizeof(in),
+			compressed, &compressed_size, sizeof(compressed))
+			== LZMA_OK);
+}
+
+
+static void
+decompress(void)
+{
+	lzma_stream strm = LZMA_STREAM_INIT;
+	expect(lzma_stream_decoder(&strm, 10 << 20, 0) == LZMA_OK);
+
+	strm.next_in = compressed;
+	strm.next_out = out;
+
+	while (true) {
+		if (strm.total_in < compressed_size)
+			strm.avail_in = 1;
+
+		const lzma_ret ret = lzma_code(&strm, LZMA_RUN);
+		if (ret == LZMA_STREAM_END) {
+			expect(strm.total_in == compressed_size);
+			expect(strm.total_out == sizeof(in));
+			return;
+		}
+
+		expect(ret == LZMA_OK);
+
+		if (strm.total_out < sizeof(in))
+			strm.avail_out = 1;
+	}
+}
+
+
+static void
+decompress_empty(void)
+{
+	// An empty file with one Block using PowerPC BCJ and LZMA2.
+	static const uint8_t empty_bcj_lzma2[] = {
+		0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x01,
+		0x69, 0x22, 0xDE, 0x36, 0x02, 0x01, 0x05, 0x00,
+		0x21, 0x01, 0x00, 0x00, 0x7F, 0xE0, 0xF1, 0xC8,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x01, 0x11, 0x00, 0x3B, 0x96, 0x5F, 0x73,
+		0x90, 0x42, 0x99, 0x0D, 0x01, 0x00, 0x00, 0x00,
+		0x00, 0x01, 0x59, 0x5A
+	};
+
+	// Decompress without giving any output space.
+	uint64_t memlimit = 1 << 20;
+	size_t in_pos = 0;
+	size_t out_pos = 0;
+	expect(lzma_stream_buffer_decode(&memlimit, 0, NULL,
+			empty_bcj_lzma2, &in_pos, sizeof(empty_bcj_lzma2),
+			out, &out_pos, 0) == LZMA_OK);
+	expect(in_pos == sizeof(empty_bcj_lzma2));
+	expect(out_pos == 0);
+}
+
+
+extern int
+main(void)
+{
+	compress();
+	decompress();
+	decompress_empty();
+	return 0;
+}
diff --git a/tests/test_scripts.sh b/tests/test_scripts.sh
new file mode 100755
index 0000000..293929e
--- /dev/null
+++ b/tests/test_scripts.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+###############################################################################
+#
+# Author: Jonathan Nieder
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+###############################################################################
+
+# If scripts weren't built, this test is skipped.
+XZ=../src/xz/xz
+XZDIFF=../src/scripts/xzdiff
+test -x "$XZ" || XZ=
+test -x "$XZDIFF" || XZDIFF=
+if test -z "$XZ" || test -z "$XZDIFF"; then
+	(exit 77)
+	exit 77
+fi
+
+PATH=`pwd`/../src/xz:$PATH
+export PATH
+
+preimage=$srcdir/files/good-1-check-crc32.xz
+samepostimage=$srcdir/files/good-1-check-crc64.xz
+otherpostimage=$srcdir/files/good-1-lzma2-1.xz
+
+"$XZDIFF" "$preimage" "$samepostimage" >/dev/null
+status=$?
+if test "$status" != 0 ; then
+	echo "xzdiff with no changes exited with status $status != 0"
+	(exit 1)
+	exit 1
+fi
+
+"$XZDIFF" "$preimage" "$otherpostimage" >/dev/null
+status=$?
+if test "$status" != 1 ; then
+	echo "xzdiff with changes exited with status $status != 1"
+	(exit 1)
+	exit 1
+fi
+
+"$XZDIFF" "$preimage" "$srcdir/files/missing.xz" >/dev/null 2>&1
+status=$?
+if test "$status" != 2 ; then
+	echo "xzdiff with missing operand exited with status $status != 2"
+	(exit 1)
+	exit 1
+fi
+
+(exit 0)
+exit 0
diff --git a/windows/README-Windows.txt b/windows/README-Windows.txt
index 786d66b..72c5a98 100644
--- a/windows/README-Windows.txt
+++ b/windows/README-Windows.txt
@@ -90,10 +90,15 @@
 
         lib /def:liblzma.def /out:liblzma.lib /machine:x64
 
-    Linking against static liblzma should work too. Rename liblzma.a
-    to e.g. liblzma_static.lib and tell MSVC to link against it. You
-    also need to tell lzma.h to not use __declspec(dllimport) by defining
-    the macro LZMA_API_STATIC. You can do it either in the C/C++ code
+    Linking against static liblzma might work too, but usually you
+    should use liblzma.dll if possible. (Or, if having a decompressor
+    is enough, consider using XZ Embedded or LZMA SDK which can be
+    compiled with MSVC.)
+
+    To try linking against static liblzma, rename liblzma.a to e.g.
+    liblzma_static.lib and tell MSVC to link against it. You also need
+    to tell lzma.h to not use __declspec(dllimport) by defining the
+    macro LZMA_API_STATIC. You can do it either in the C/C++ code
 
         #define LZMA_API_STATIC
         #include <lzma.h>
diff --git a/windows/build.bash b/windows/build.bash
index faec83b..c5cf2b3 100755
--- a/windows/build.bash
+++ b/windows/build.bash
@@ -77,6 +77,7 @@
 	./configure \
 		--prefix= \
 		--disable-nls \
+		--disable-scripts \
 		--disable-threads \
 		--disable-shared \
 		--enable-small \
@@ -97,6 +98,7 @@
 	./configure \
 		--prefix= \
 		--disable-nls \
+		--disable-scripts \
 		--disable-threads \
 		--build="$BUILD" \
 		CFLAGS="$CFLAGS -O2"