From: Yann Collet Date: Mon, 24 Jun 2019 23:08:30 +0000 (-0700) Subject: fix #734 : --version should output to stdout X-Git-Tag: upstream/1.9.3~2^2~26^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=baf9b0e0434e1e516f468c4b96bde5bb38d4c737;p=platform%2Fupstream%2Flz4.git fix #734 : --version should output to stdout instead of stderr --- diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 3619cd5..3b5d61e 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -67,6 +67,7 @@ static int g_lz4c_legacy_commands = 0; /*-************************************ * Macros ***************************************/ +#define DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__) #define DISPLAY(...) fprintf(stderr, __VA_ARGS__) #define DISPLAYLEVEL(l, ...) if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } static unsigned displayLevel = 2; /* 0 : no display ; 1: errors only ; 2 : downgradable normal ; 3 : non-downgradable normal; 4 : + information */ @@ -390,7 +391,7 @@ int main(int argc, const char** argv) if (!strcmp(argument, "--favor-decSpeed")) { LZ4IO_favorDecSpeed(prefs, 1); continue; } if (!strcmp(argument, "--verbose")) { displayLevel++; continue; } if (!strcmp(argument, "--quiet")) { if (displayLevel) displayLevel--; continue; } - if (!strcmp(argument, "--version")) { DISPLAY(WELCOME_MESSAGE); return 0; } + if (!strcmp(argument, "--version")) { DISPLAYOUT(WELCOME_MESSAGE); return 0; } if (!strcmp(argument, "--help")) { usage_advanced(exeName); goto _cleanup; } if (!strcmp(argument, "--keep")) { LZ4IO_setRemoveSrcFile(prefs, 0); continue; } /* keep source file (default) */ if (!strcmp(argument, "--rm")) { LZ4IO_setRemoveSrcFile(prefs, 1); continue; } @@ -437,7 +438,7 @@ int main(int argc, const char** argv) switch(argument[0]) { /* Display help */ - case 'V': DISPLAY(WELCOME_MESSAGE); goto _cleanup; /* Version */ + case 'V': DISPLAYOUT(WELCOME_MESSAGE); goto _cleanup; /* Version */ case 'h': usage_advanced(exeName); goto _cleanup; case 'H': usage_longhelp(exeName); goto _cleanup;