Use err(3).

This commit is contained in:
Philippe Charnier 1997-09-01 06:12:37 +00:00
parent 3efa2f585c
commit b63f602a08

View File

@ -32,23 +32,27 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)accton.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void usage __P((void));
static void usage __P((void));
int
main(argc, argv)
@ -68,18 +72,12 @@ main(argc, argv)
switch(argc) {
case 0:
if (acct(NULL)) {
(void)fprintf(stderr,
"accton: %s\n", strerror(errno));
exit(1);
}
if (acct(NULL))
err(1, NULL);
break;
case 1:
if (acct(*argv)) {
(void)fprintf(stderr,
"accton: %s: %s\n", *argv, strerror(errno));
exit(1);
}
if (acct(*argv))
err(1, "%s", *argv);
break;
default:
usage();
@ -87,7 +85,7 @@ main(argc, argv)
exit(0);
}
void
static void
usage()
{
(void)fprintf(stderr, "usage: accton [file]\n");