Printing messages to stderr. More...
Enumerations | |
enum | message_verbosity { V_SILENT, V_ERROR, V_WARNING, V_VERBOSE, V_DEBUG } |
Verbosity levels. More... | |
Functions | |
void | message_init (const char *argv0) |
Initializes the message functions. | |
void | message_verbosity_increase (void) |
Increase verbosity level by one step unless it was at maximum. | |
void | message_verbosity_decrease (void) |
Decrease verbosity level by one step unless it was at minimum. | |
void | message_set_files (unsigned int files) |
void | message (enum message_verbosity verbosity, const char *fmt,...) lzma_attribute((format(printf |
Print a message if verbosity level is at least "verbosity". | |
void void | message_warning (const char *fmt,...) lzma_attribute((format(printf |
Prints a warning and possibly sets exit status. | |
void void void | message_error (const char *fmt,...) lzma_attribute((format(printf |
Prints an error message and sets exit status. | |
void void void void | message_fatal (const char *fmt,...) lzma_attribute((format(printf |
Prints an error message and exits with EXIT_ERROR. | |
void void void void | lzma_attribute ((noreturn)) |
void | message_bug (void) lzma_attribute((noreturn)) |
void | message_signal_handler (void) lzma_attribute((noreturn)) |
const char * | message_strm (lzma_ret code) |
Convert lzma_ret to a string. | |
void | message_filters (enum message_verbosity v, const lzma_filter *filters) |
Print the filter chain. | |
void | message_try_help (void) |
Print a message that user should try --help. | |
void | message_version (void) lzma_attribute((noreturn)) |
Prints the version number to stdout and exits with exit status SUCCESS. | |
void | message_help (bool long_help) lzma_attribute((noreturn)) |
Print the help message. | |
void | message_progress_start (const char *filename, uint64_t in_size) |
void | message_progress_update (uint64_t in_pos, uint64_t out_pos) |
void | message_progress_end (uint64_t in_pos, uint64_t out_pos, bool success) |
Finishes the progress message if we were in verbose mode. |
Printing messages to stderr.
enum message_verbosity |
void message_init | ( | const char * | argv0 | ) |
Initializes the message functions.
argv0 | Name of the program i.e. argv[0] from main() | |
verbosity | Verbosity level |
If an error occurs, this function doesn't return.
References argv0, message_signal_handler(), progress_automatic, and progress_signal_handler().
void message_verbosity_increase | ( | void | ) |
void message_verbosity_decrease | ( | void | ) |
void message_set_files | ( | unsigned int | files | ) |
Set the total number of files to be processed (stdin is counted as a file here). The default is one.
References files_total.
void message | ( | enum message_verbosity | verbosity, | |
const char * | fmt, | |||
... | ||||
) |
Print a message if verbosity level is at least "verbosity".
This doesn't touch the exit status.
Referenced by message_try_help(), my_exit(), and str_to_uint64().
void void message_warning | ( | const char * | fmt, | |
... | ||||
) |
Prints a warning and possibly sets exit status.
The message is printed only if verbosity level is at least V_WARNING. The exit status is set to WARNING unless it was already at ERROR.
Referenced by compressed_name(), io_copy_attrs(), io_open_src(), and uncompressed_name().
void void void message_error | ( | const char * | fmt, | |
... | ||||
) |
Prints an error message and sets exit status.
The message is printed only if verbosity level is at least V_ERROR. The exit status is set to ERROR.
Referenced by compressed_name(), io_close_dest(), io_open_src(), io_read(), io_unlink(), io_write(), is_empty_filename(), is_tty_stdin(), is_tty_stdout(), and uncompressed_name().
void void void void message_fatal | ( | const char * | fmt, | |
... | ||||
) |
Prints an error message and exits with EXIT_ERROR.
The message is printed only if verbosity level is at least V_ERROR.
Referenced by coder_add_filter(), message_bug(), message_signal_handler(), options_lzma(), parse_options(), str_to_uint64(), suffix_set(), and xrealloc().
void message_bug | ( | void | ) |
Print an error message that an internal error occurred and exit with EXIT_ERROR.
References message_fatal().
void message_signal_handler | ( | void | ) |
Print a message that establishing signal handlers failed, and exit with exit status ERROR.
References message_fatal().
Referenced by message_init(), and signals_init().
const char* message_strm | ( | lzma_ret | code | ) |
Convert lzma_ret to a string.
References LZMA_BUF_ERROR, LZMA_DATA_ERROR, LZMA_FORMAT_ERROR, LZMA_GET_CHECK, LZMA_MEM_ERROR, LZMA_NO_CHECK, LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_PROG_ERROR, LZMA_STREAM_END, and LZMA_UNSUPPORTED_CHECK.
void message_filters | ( | enum message_verbosity | v, | |
const lzma_filter * | filters | |||
) |
Print the filter chain.
References argv0, lzma_options_lzma::depth, lzma_options_lzma::dict_size, lzma_options_delta::dist, lzma_filter::id, lzma_options_lzma::lc, lzma_options_lzma::lp, LZMA_FILTER_ARM, LZMA_FILTER_ARMTHUMB, LZMA_FILTER_DELTA, LZMA_FILTER_IA64, LZMA_FILTER_LZMA1, LZMA_FILTER_LZMA2, LZMA_FILTER_POWERPC, LZMA_FILTER_SPARC, LZMA_FILTER_X86, LZMA_MF_BT2, LZMA_MF_BT3, LZMA_MF_BT4, LZMA_MF_HC3, LZMA_MF_HC4, LZMA_MODE_FAST, LZMA_MODE_NORMAL, LZMA_VLI_UNKNOWN, lzma_options_lzma::mf, lzma_options_lzma::mode, lzma_options_lzma::nice_len, lzma_filter::options, lzma_options_lzma::pb, and verbosity.
void message_try_help | ( | void | ) |
void message_version | ( | void | ) |
Prints the version number to stdout and exits with exit status SUCCESS.
References my_exit().
void message_help | ( | bool | long_help | ) |
Print the help message.
References argv0, hardware_memlimit_decoder(), hardware_memlimit_encoder(), my_exit(), and opt_threads.
void message_progress_end | ( | uint64_t | in_pos, | |
uint64_t | out_pos, | |||
bool | success | |||
) |
Finishes the progress message if we were in verbose mode.
in_pos | Final input position i.e. how much input there was. | |
out_pos | Final output position | |
success | True if the operation was successful. We don't print the final progress message if the operation wasn't successful. |
References filename, my_time(), opt_mode, progress_active, progress_automatic, progress_sizes(), progress_speed(), progress_time(), signals_block(), signals_unblock(), start_time, user_abort, V_VERBOSE, and verbosity.