uptime: add gettext support

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola
2011-10-09 12:25:30 +02:00
parent 24762e2ed8
commit 8152fa571e

View File

@ -2,19 +2,20 @@
#include <getopt.h> #include <getopt.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "c.h"
#include "nls.h"
#include "proc/whattime.h" #include "proc/whattime.h"
#include "proc/version.h" #include "proc/version.h"
static void __attribute__ ((__noreturn__)) static void __attribute__ ((__noreturn__)) usage(FILE * out)
usage(FILE * out)
{ {
fprintf(out, fputs(USAGE_HEADER, out);
"\nUsage: %s [options]\n" fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
"\nOptions:\n", program_invocation_short_name); fputs(USAGE_OPTIONS, out);
fprintf(out, fputs(USAGE_HELP, out);
" -h, --help display this help text\n" fputs(USAGE_VERSION, out);
" -V, --version display version information and exit\n"); fprintf(out, USAGE_MAN_TAIL("uptime(1)"));
fprintf(out, "\nFor more information see uptime(1).\n");
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
} }
@ -34,7 +35,7 @@ int main(int argc, char **argv)
case 'h': case 'h':
usage(stdout); usage(stdout);
case 'V': case 'V':
display_version(); printf(PROCPS_NG_VERSION);
return EXIT_SUCCESS; return EXIT_SUCCESS;
default: default:
usage(stderr); usage(stderr);