Skip to content

Commit

Permalink
Use err(3). Rewrote man page using mdoc format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Charnier authored and Philippe Charnier committed Oct 29, 1997
1 parent 0da8bf4 commit dd63f75
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 283 deletions.
5 changes: 5 additions & 0 deletions usr.sbin/zic/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ static char elsieid[] = "@(#)ialloc.c 8.28";
#endif /* !defined NOID */
#endif /* !defined lint */

#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */

/*LINTLIBRARY*/

#include "private.h"
Expand Down
5 changes: 5 additions & 0 deletions usr.sbin/zic/scheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ static char elsieid[] = "@(#)scheck.c 8.13";
#endif /* !defined lint */
#endif /* !defined NOID */

#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */

/*LINTLIBRARY*/

#include "private.h"
Expand Down
51 changes: 26 additions & 25 deletions usr.sbin/zic/zdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ static char elsieid[] = "@(#)zdump.c 7.24";
#endif /* !defined NOID */
#endif /* !defined lint */

#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */

/*
** This code has been made independent of the rest of the time
** conversion package to increase confidence in the verification it provides.
** You can use this code to help in verifying other implementations.
*/

#include "stdio.h" /* for stdout, stderr, perror */
#include "string.h" /* for strcpy */
#include "sys/types.h" /* for time_t */
#include "time.h" /* for struct tm */
#include "stdlib.h" /* for exit, malloc, atoi */
#include <err.h>
#include <stdio.h> /* for stdout, stderr */
#include <stdlib.h> /* for exit, malloc, atoi */
#include <string.h> /* for strcpy */
#include <sys/types.h> /* for time_t */
#include <time.h> /* for struct tm */
#include <unistd.h>

#ifndef MAX_STRING_LENGTH
#define MAX_STRING_LENGTH 1024
Expand Down Expand Up @@ -112,18 +119,14 @@ static char elsieid[] = "@(#)zdump.c 7.24";
#endif /* !defined TZ_DOMAIN */

extern char ** environ;
extern int getopt();
extern char * optarg;
extern int optind;
extern time_t time();
extern char * tzname[2];

static char * abbr();
static long delta();
static time_t hunt();
static int longest;
static char * progname;
static void show();
static void usage __P((void));

int
main(argc, argv)
Expand Down Expand Up @@ -152,7 +155,6 @@ char * argv[];
#endif /* defined(TEXTDOMAINDIR) */
(void) textdomain(TZ_DOMAIN);
#endif /* HAVE_GETTEXT - 0 */
progname = argv[0];
vflag = 0;
cutoff = NULL;
while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
Expand All @@ -161,10 +163,7 @@ char * argv[];
else cutoff = optarg;
if (c != EOF ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
(void) fprintf(stderr,
_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
argv[0], argv[0]);
(void) exit(EXIT_FAILURE);
usage();
}
if (cutoff != NULL) {
int y;
Expand Down Expand Up @@ -192,10 +191,9 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
sizeof *fakeenv));
if (fakeenv == NULL ||
(fakeenv[0] = (char *) malloc((size_t) (longest +
4))) == NULL) {
(void) perror(progname);
(void) exit(EXIT_FAILURE);
}
4))) == NULL)
errx(EXIT_FAILURE,
_("malloc() failed"));
to = 0;
(void) strcpy(fakeenv[to++], "TZ=");
for (from = 0; environ[from] != NULL; ++from)
Expand Down Expand Up @@ -254,19 +252,22 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
t += SECSPERHOUR * HOURSPERDAY;
show(argv[i], t, TRUE);
}
if (fflush(stdout) || ferror(stdout)) {
(void) fprintf(stderr, _("%s: Error writing standard output "),
argv[0]);
(void) perror(_("standard output"));
(void) exit(EXIT_FAILURE);
}
if (fflush(stdout) || ferror(stdout))
errx(EXIT_FAILURE, _("error writing standard output"));
exit(EXIT_SUCCESS);

/* gcc -Wall pacifier */
for ( ; ; )
continue;
}

static void
usage()
{
fprintf(stderr, _("usage: zdump [-v] [-c cutoff] zonename ...\n"));
exit(EXIT_FAILURE);
}

static time_t
hunt(name, lot, hit)
char * name;
Expand Down
Loading

0 comments on commit dd63f75

Please sign in to comment.