[PATCH 2/6] mtdinfo: send help/version info to stdout

Florian Fainelli ffainelli at freebox.fr
Tue Jun 7 04:40:56 EDT 2011


On Tuesday 07 June 2011 08:19:04 Mike Frysinger wrote:
> Usage/version information should go to stdout when it is expected behavior
> (i.e. the user requested it explicitly).  This info should go to stderr
> only when the usage info is being shown as a result of incorrect options.
> 
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> ---
>  ubi-utils/src/mtdinfo.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/ubi-utils/src/mtdinfo.c b/ubi-utils/src/mtdinfo.c
> index c9f6f58..f20fe49 100644
> --- a/ubi-utils/src/mtdinfo.c
> +++ b/ubi-utils/src/mtdinfo.c
> @@ -110,13 +110,13 @@ static int parse_opt(int argc, char * const argv[])
>  			break;
> 
>  		case 'h':
> -			fprintf(stderr, "%s\n\n", doc);
> -			fprintf(stderr, "%s\n\n", usage);
> -			fprintf(stderr, "%s\n", optionsstr);
> +			printf("%s\n\n", doc);
> +			printf("%s\n\n", usage);
> +			printf("%s\n", optionsstr);

Why not use fprintf(stdout ...), instead of printf()? to be consistent with was is existing?

>  			exit(EXIT_SUCCESS);
> 
>  		case 'V':
> -			fprintf(stderr, "%s\n", PROGRAM_VERSION);
> +			printf("%s\n", PROGRAM_VERSION);
>  			exit(EXIT_SUCCESS);
> 
>  		case ':':



More information about the linux-mtd mailing list