diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2009-05-22 14:43:00 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2009-05-22 14:43:00 +0300 |
commit | b60376249e0c586910c4121fab4f791820cc1289 (patch) | |
tree | a05903c27ddb37000c1eafe453189acf13eb4153 /src/xz/main.c | |
parent | Fix a comment. (diff) | |
download | xz-b60376249e0c586910c4121fab4f791820cc1289.tar.xz |
Add --no-warn.
Diffstat (limited to 'src/xz/main.c')
-rw-r--r-- | src/xz/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/xz/main.c b/src/xz/main.c index 0afd9ff7..8a6cde63 100644 --- a/src/xz/main.c +++ b/src/xz/main.c @@ -17,6 +17,10 @@ /// Exit status to use. This can be changed with set_exit_status(). static enum exit_status_type exit_status = E_SUCCESS; +/// True if --no-warn is specified. When this is true, we don't set +/// the exit status to E_WARNING when something worth a warning happens. +static bool no_warn = false; + extern void set_exit_status(enum exit_status_type new_status) @@ -31,6 +35,14 @@ set_exit_status(enum exit_status_type new_status) extern void +set_exit_no_warn(void) +{ + no_warn = true; + return; +} + + +extern void my_exit(enum exit_status_type status) { // Close stdout. If something goes wrong, print an error message @@ -59,6 +71,11 @@ my_exit(enum exit_status_type status) status = E_ERROR; } + // Suppress the exit status indicating a warning if --no-warn + // was specified. + if (status == E_WARNING && no_warn) + status = E_SUCCESS; + // If we have got a signal, raise it to kill the program. // Otherwise we just call exit(). signals_exit(); |