Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/time/zdump.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/time/zdump.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- src/lib/libc/time/zdump.c 1995/03/10 18:12:43 1.2 +++ src/lib/libc/time/zdump.c 1996/09/10 22:04:35 1.3 @@ -1,8 +1,8 @@ -/* $NetBSD: zdump.c,v 1.2 1995/03/10 18:12:43 jtc Exp $ */ +/* $NetBSD: zdump.c,v 1.3 1996/09/10 22:04:35 jtc Exp $ */ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)zdump.c 7.20"; +static char elsieid[] = "@(#)zdump.c 7.24"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -70,6 +70,11 @@ static char elsieid[] = "@(#)zdump.c 7.2 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) #endif /* !defined isleap */ +#if HAVE_GETTEXT - 0 +#include "locale.h" /* for setlocale */ +#include "libintl.h" +#endif /* HAVE_GETTEXT - 0 */ + #ifndef GNUC_or_lint #ifdef lint #define GNUC_or_lint @@ -90,6 +95,24 @@ static char elsieid[] = "@(#)zdump.c 7.2 #endif /* !defined GNUC_or_lint */ #endif /* !defined INITIALIZE */ +/* +** For the benefit of GNU folk... +** `_(MSGID)' uses the current locale's message library string for MSGID. +** The default is to use gettext if available, and use MSGID otherwise. +*/ + +#ifndef _ +#if HAVE_GETTEXT - 0 +#define _(msgid) gettext(msgid) +#else /* !(HAVE_GETTEXT - 0) */ +#define _(msgid) msgid +#endif /* !(HAVE_GETTEXT - 0) */ +#endif /* !defined _ */ + +#ifndef TZ_DOMAIN +#define TZ_DOMAIN "tz" +#endif /* !defined TZ_DOMAIN */ + extern char ** environ; extern int getopt(); extern char * optarg; @@ -124,6 +147,13 @@ char * argv[]; struct tm newtm; INITIALIZE(cuttime); +#if HAVE_GETTEXT - 0 + (void) setlocale(LC_MESSAGES, ""); +#ifdef TZ_DOMAINDIR + (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); +#endif /* defined(TEXTDOMAINDIR) */ + (void) textdomain(TZ_DOMAIN); +#endif /* HAVE_GETTEXT - 0 */ progname = argv[0]; vflag = 0; cutoff = NULL; @@ -134,7 +164,7 @@ char * argv[]; if (c != EOF || (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { (void) fprintf(stderr, -"%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n", +_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"), argv[0], argv[0]); (void) exit(EXIT_FAILURE); } @@ -180,9 +210,10 @@ char * argv[]; static char buf[MAX_STRING_LENGTH]; (void) strcpy(&fakeenv[0][3], argv[i]); - show(argv[i], now, FALSE); - if (!vflag) + if (!vflag) { + show(argv[i], now, FALSE); continue; + } /* ** Get lowest value of t. */ @@ -226,9 +257,9 @@ char * argv[]; show(argv[i], t, TRUE); } if (fflush(stdout) || ferror(stdout)) { - (void) fprintf(stderr, "%s: Error writing standard output ", + (void) fprintf(stderr, _("%s: Error writing standard output "), argv[0]); - (void) perror("standard output"); + (void) perror(_("standard output")); (void) exit(EXIT_FAILURE); } exit(EXIT_SUCCESS);