Printing messages to stderr. More...
| Defines | |
| #define | FILTERS_STR_SIZE 512 | 
| Buffer size for message_filters_to_str(). | |
| Enumerations | |
| enum | message_verbosity { V_SILENT, V_ERROR, V_WARNING, V_VERBOSE, V_DEBUG } | 
| Verbosity levels.More... | |
| Functions | |
| void | message_init (void) | 
| 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. | |
| enum message_verbosity | message_verbosity_get (void) | 
| Get the current verbosity level. | |
| 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_mem_needed (enum message_verbosity v, uint64_t memusage) | 
| Display how much memory was needed and how much the limit was. | |
| void | message_filters_to_str (char buf[FILTERS_STR_SIZE], const lzma_filter *filters, bool all_known) | 
| Get the filter chain as a string. | |
| void | message_filters_show (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_set_files (unsigned int files) | 
| Set the total number of files to be processed. | |
| void | message_filename (const char *src_name) | 
| Set the name of the current file and possibly print it too. | |
| void | message_progress_start (lzma_stream *strm, uint64_t in_size) | 
| Start progress info handling. | |
| void | message_progress_update (void) | 
| void | message_progress_end (bool finished) | 
| Finishes the progress message if we were in verbose mode. | |
| Variables | |
| const int | message_progress_sigs [] | 
| Signals used for progress message handling. | |
Printing messages to stderr.
| #define FILTERS_STR_SIZE 512 | 
Buffer size for message_filters_to_str().
| enum message_verbosity | 
| void message_init | ( | void | ) | 
Initializes the message functions.
If an error occurs, this function doesn't return.
References message_progress_sigs, message_signal_handler(), and progress_automatic.
| void message_verbosity_increase | ( | void | ) | 
| void message_verbosity_decrease | ( | void | ) | 
| enum message_verbosity message_verbosity_get | ( | void | ) | 
Get the current verbosity level.
References verbosity.
Referenced by hardware_memlimit_show(), list_file(), and list_totals().
| 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_mem_needed(), message_try_help(), 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 coder_normal(), compressed_name(), io_copy_attrs(), io_open_src_real(), 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 coder_init(), coder_normal(), compressed_name(), io_close(), io_close_dest(), io_open_src_real(), io_pread(), io_read(), io_unlink(), io_write(), is_empty_filename(), is_tty_stdin(), is_tty_stdout(), list_file(), parse_block_header(), parse_indexes(), 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(), list_file(), 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().
Referenced by options_lzma(), parse_block_header(), and parse_indexes().
| 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.
Referenced by coder_init(), coder_normal(), parse_block_header(), and parse_indexes().
| void message_mem_needed | ( | enum message_verbosity | v, | |
| uint64_t | memusage | |||
| ) | 
Display how much memory was needed and how much the limit was.
References hardware_memlimit_get(), message(), opt_mode, round_up_to_mib(), uint64_to_str(), and verbosity.
Referenced by coder_init(), coder_normal(), and parse_indexes().
| void message_filters_to_str | ( | char | buf[FILTERS_STR_SIZE], | |
| const lzma_filter * | filters, | |||
| bool | all_known | |||
| ) | 
Get the filter chain as a string.
| buf | Pointer to caller allocated buffer to hold the filter chain string | |
| filters | Pointer to the filter chain | |
| all_known | If true, all filter options are printed. If false, only the options that get stored into .xz headers are printed. | 
References 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_options_lzma::mf, lzma_options_lzma::mode, my_snprintf(), lzma_options_lzma::nice_len, lzma_filter::options, lzma_options_lzma::pb, lzma_options_bcj::start_offset, and uint32_to_optstr().
Referenced by message_filters_show(), and parse_block_header().
| void message_filters_show | ( | enum message_verbosity | v, | |
| const lzma_filter * | filters | |||
| ) | 
Print the filter chain.
References message_filters_to_str(), and verbosity.
| void message_try_help | ( | void | ) | 
| void message_version | ( | void | ) | 
Prints the version number to stdout and exits with exit status SUCCESS.
References LZMA_VERSION, lzma_version_number(), lzma_version_string(), LZMA_VERSION_STRING, V_SILENT, and verbosity.
| void message_set_files | ( | unsigned int | files | ) | 
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().
References files_total.
| void message_filename | ( | const char * | src_name | ) | 
Set the name of the current file and possibly print it too.
The name is printed immediately 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.
References current_filename_printed, filename, files_pos, opt_mode, print_filename(), progress_automatic, V_VERBOSE, and verbosity.
Referenced by coder_run(), and list_file().
| void message_progress_start | ( | lzma_stream * | strm, | |
| uint64_t | in_size | |||
| ) | 
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.
| strm | Pointer to lzma_stream used for the coding. | |
| in_size | Size of the input file, or zero if unknown. | 
References expected_in_size, my_time(), progress_automatic, progress_started, start_time, V_VERBOSE, and verbosity.
Referenced by coder_run().
| void message_progress_update | ( | void | ) | 
Update the progress info if in verbose mode and enough time has passed since the previous update. This can be called only when message_progress_start() has already been used.
References current_filename_printed, print_filename(), progress_active, progress_automatic, progress_elapsed(), progress_percentage(), progress_pos(), progress_remaining(), progress_sizes(), progress_speed(), progress_time(), signals_block(), signals_unblock(), V_VERBOSE, and verbosity.
Referenced by coder_normal(), and coder_passthru().
| void message_progress_end | ( | bool | finished | ) | 
Finishes the progress message if we were in verbose mode.
| finished | True if the whole stream was successfully coded and output written to the output stream. | 
References progress_started.
Referenced by coder_run().
| const int message_progress_sigs[] | 
Signals used for progress message handling.
Referenced by message_init(), and signals_init().
 1.7.1
 1.7.1