1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-12-06 16:03:57 +00:00

--help and --version work

SCCS-file: zic.c
SCCS-SID: 8.18
This commit is contained in:
Arthur David Olson
2009-01-14 10:54:44 -05:00
committed by Paul Eggert
parent 34942154e8
commit e789071cd8

22
zic.c
View File

@ -156,7 +156,7 @@ static void stringzone(char * result,
const struct zone * zp, int ntzones);
static void setboundaries(void);
static zic_t tadd(zic_t t1, long t2);
static void usage(void);
static void usage(FILE *stream, int status);
static void writezone(const char * name, const char * string);
static int yearistype(int year, const char * type);
@ -454,13 +454,15 @@ const char * const string;
}
static void
usage(void)
usage(FILE *stream, int status)
{
(void) fprintf(stderr, _("%s: usage is %s \
[ --version ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
progname, progname);
exit(EXIT_FAILURE);
(void) fprintf(stream, _("%s: usage is %s \
[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\
\n\
Report bugs to tz@elsie.nci.nih.gov.\n"),
progname, progname);
exit(status);
}
static const char * psxrules;
@ -498,11 +500,13 @@ char * argv[];
if (strcmp(argv[i], "--version") == 0) {
(void) printf("%s\n", elsieid);
exit(EXIT_SUCCESS);
} else if (strcmp(argv[i], "--help") == 0) {
usage(stdout, EXIT_SUCCESS);
}
while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
switch (c) {
default:
usage();
usage(stderr, EXIT_FAILURE);
case 'd':
if (directory == NULL)
directory = optarg;
@ -561,7 +565,7 @@ _("%s: More than one -L option specified\n"),
break;
}
if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
usage(); /* usage message by request */
usage(stderr, EXIT_FAILURE); /* usage message by request */
if (directory == NULL)
directory = TZDIR;
if (yitcommand == NULL)