aboutsummaryrefslogtreecommitdiff
path: root/src/xz/message.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-01-31 12:01:54 +0200
committerLasse Collin <lasse.collin@tukaani.org>2010-01-31 12:01:54 +0200
commit231c3c7098f1099a56abb8afece76fc9b8699f05 (patch)
tree5887a319a46895b20f87075ba4f3b467a84bd85b /src/xz/message.h
parentAdd list.h to src/xz/Makefile.am. (diff)
downloadxz-231c3c7098f1099a56abb8afece76fc9b8699f05.tar.xz
Delay opening the destionation file and other fixes.
The opening of the destination file is now delayed a little. The coder is initialized, and if decompressing, the memory usage of the first Block compared against the memory usage limit before the destination file is opened. This means that if --force was used, the old "target" file won't be deleted so easily when something goes wrong very early. Thanks to Mark K for the bug report. The above fix required some changes to progress message handling. Now there is a separate function for setting and printing the filename. It is used also in list.c. list_file() now handles stdin correctly (gives an error). A useless check for user_abort was removed from file_io.c.
Diffstat (limited to '')
-rw-r--r--src/xz/message.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/xz/message.h b/src/xz/message.h
index 9edc403c..b894bcf3 100644
--- a/src/xz/message.h
+++ b/src/xz/message.h
@@ -37,11 +37,6 @@ extern void message_verbosity_decrease(void);
extern enum message_verbosity message_verbosity_get(void);
-/// Set the total number of files to be processed (stdin is counted as a file
-/// here). The default is one.
-extern void message_set_files(unsigned int files);
-
-
/// \brief Print a message if verbosity level is at least "verbosity"
///
/// This doesn't touch the exit status.
@@ -112,18 +107,34 @@ extern void message_version(void) lzma_attribute((noreturn));
extern void message_help(bool long_help) lzma_attribute((noreturn));
+/// \brief Set the total number of files to be processed
+///
+/// Standard input is counted as a file here. This is used when printing
+/// the filename via message_filename().
+extern void message_set_files(unsigned int files);
+
+
+/// \brief Set the name of the current file and possibly print it too
+///
+/// The name is printed immediatelly if --list was used or if --verbose
+/// was used and stderr is a terminal. Even when the filename isn't printed,
+/// it is stored so that it can be printed later if needed for progress
+/// messages.
+extern void message_filename(const char *src_name);
+
+
/// \brief Start progress info handling
///
+/// message_filename() must be called before this function to set
+/// the filename.
+///
/// This must be paired with a call to message_progress_end() before the
/// given *strm becomes invalid.
///
/// \param strm Pointer to lzma_stream used for the coding.
-/// \param filename Name of the input file. stdin_filename is
-/// handled specially.
/// \param in_size Size of the input file, or zero if unknown.
///
-extern void message_progress_start(
- lzma_stream *strm, const char *filename, uint64_t in_size);
+extern void message_progress_start(lzma_stream *strm, uint64_t in_size);
/// Update the progress info if in verbose mode and enough time has passed