[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/7] use standard error printing facilities
From: |
Reuben Thomas |
Subject: |
Re: [PATCH 4/7] use standard error printing facilities |
Date: |
Tue, 31 Dec 2013 19:58:42 +0000 |
Fine.
On 30 December 2013 11:58, Sami Kerola <address@hidden> wrote:
> * bootstrap.conf: add error module
> * src/hello.c: use error() where needed
> ---
> bootstrap.conf | 1 +
> src/hello.c | 10 ++++------
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/bootstrap.conf b/bootstrap.conf
> index a1ca8b5..82766f3 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -23,6 +23,7 @@ gnulib_modules="
> configmake
> do-release-commit-and-tag
> dirname
> + error
> fdl
> gendocs
> getopt-gnu
> diff --git a/src/hello.c b/src/hello.c
> index 90b1c08..c475840 100644
> --- a/src/hello.c
> +++ b/src/hello.c
> @@ -18,6 +18,8 @@
>
> #include <config.h>
> #include "system.h"
> +#include "errno.h"
> +#include "error.h"
> #include "progname.h"
> #include "progname.h"
> #include "propername.h"
> @@ -88,17 +90,13 @@ main (int argc, char *argv[])
> if (optind < argc)
> {
> /* Print error message and exit. */
> - fprintf (stderr, _("%s: extra operand: %s\n"), program_name,
> - argv[optind]);
> + error (0, 0, "%s: %s", _("extra operand"), argv[optind]);
> usage (EXIT_FAILURE);
> }
>
> len = mbsrtowcs(NULL, &greeting_msg, 0, NULL);
> if (len == (size_t)-1)
> - {
> - fprintf (stderr, _("%s: conversion to a multibyte string
> failed\n"), program_name);
> - exit (EXIT_FAILURE);
> - }
> + error (EXIT_FAILURE, errno, _("conversion to a multibyte string
> failed"));
> mb_greeting = xmalloc((len + 1) * sizeof(wchar_t));
> mbsrtowcs(mb_greeting, &greeting_msg, len + 1, NULL);
>
> --
> 1.8.5.2
>
>
>
--
http://rrt.sc3d.org
- [PATCH 3/7] use gnulib to print --help and --version, (continued)
[PATCH 5/7] demonstrate how to add information to a manual page, Sami Kerola, 2013/12/30
[PATCH 4/7] use standard error printing facilities, Sami Kerola, 2013/12/30
- Re: [PATCH 4/7] use standard error printing facilities,
Reuben Thomas <=
[PATCH 7/7] update NLS file sources, Sami Kerola, 2013/12/30
[PATCH 6/7] update gnulib, Sami Kerola, 2013/12/30
Re: [PATCH 0/7] pull: changes before release 2.10, Reuben Thomas, 2013/12/31
Re: [PATCH 0/7] pull: changes before release 2.10, Reuben Thomas, 2013/12/31