Changed the err and warns to macros
err and warn are BSD format but they are not recommended by library developers. However their consiseness is useful! The solution is to use some macros that create xerr etc which then just map to the error() function. The next problem is error() uses program_invocation_name so we set this to program_invovation_short_name This is a global set but seems to be the convention (or at least errors are on the short name only) used everywhere else.
This commit is contained in:
7
free.c
7
free.c
@ -206,6 +206,7 @@ int main(int argc, char **argv)
|
||||
args.repeat_interval = 1000000;
|
||||
args.repeat_counter = 0;
|
||||
|
||||
program_invocation_name = program_invocation_short_name;
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
@ -246,9 +247,9 @@ int main(int argc, char **argv)
|
||||
flags |= FREE_REPEAT;
|
||||
args.repeat_interval = (1000000 * strtof(optarg, &endptr));
|
||||
if (errno || optarg == endptr || (endptr && *endptr))
|
||||
errx(EXIT_FAILURE, _("seconds argument `%s' failed"), optarg);
|
||||
xerrx(EXIT_FAILURE, _("seconds argument `%s' failed"), optarg);
|
||||
if (args.repeat_interval < 1)
|
||||
errx(EXIT_FAILURE,
|
||||
xerrx(EXIT_FAILURE,
|
||||
_("seconds argument `%s' is not positive number"), optarg);
|
||||
break;
|
||||
case 'c':
|
||||
@ -256,7 +257,7 @@ int main(int argc, char **argv)
|
||||
flags |= FREE_REPEATCOUNT;
|
||||
args.repeat_counter = strtoul(optarg, &endptr, 10);
|
||||
if (errno || optarg == endptr || (endptr && *endptr))
|
||||
errx(EXIT_FAILURE, _("count argument `%s' failed"), optarg);
|
||||
xerrx(EXIT_FAILURE, _("count argument `%s' failed"), optarg);
|
||||
|
||||
break;
|
||||
case HELP_OPTION:
|
||||
|
Reference in New Issue
Block a user