Use err(3).

This commit is contained in:
Philippe Charnier 1997-09-01 06:12:37 +00:00
parent 3efa2f585c
commit b63f602a08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28996

View File

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