19806ff75Sbostic /*
2*a4ca5a8cSbostic * Copyright (c) 1988, 1993
3*a4ca5a8cSbostic * The Regents of the University of California. All rights reserved.
49806ff75Sbostic *
595ecce55Sbostic * %sccs.include.redist.c%
69806ff75Sbostic */
79806ff75Sbostic
89806ff75Sbostic #ifndef lint
9*a4ca5a8cSbostic static char copyright[] =
10*a4ca5a8cSbostic "@(#) Copyright (c) 1988, 1993\n\
11*a4ca5a8cSbostic The Regents of the University of California. All rights reserved.\n";
129806ff75Sbostic #endif /* not lint */
139806ff75Sbostic
149806ff75Sbostic #ifndef lint
15*a4ca5a8cSbostic static char sccsid[] = "@(#)accton.c 8.1 (Berkeley) 06/06/93";
169806ff75Sbostic #endif /* not lint */
179806ff75Sbostic
180be0a61aSbostic #include <sys/types.h>
190be0a61aSbostic #include <errno.h>
200be0a61aSbostic #include <unistd.h>
210be0a61aSbostic #include <stdlib.h>
229806ff75Sbostic #include <stdio.h>
230be0a61aSbostic #include <string.h>
249806ff75Sbostic
250be0a61aSbostic void usage __P((void));
260be0a61aSbostic
270be0a61aSbostic int
main(argc,argv)28a4b7b01aSbill main(argc, argv)
299806ff75Sbostic int argc;
300be0a61aSbostic char *argv[];
31a4b7b01aSbill {
320be0a61aSbostic int ch;
330be0a61aSbostic
340be0a61aSbostic while ((ch = getopt(argc, argv, "")) != EOF)
350be0a61aSbostic switch(ch) {
360be0a61aSbostic case '?':
370be0a61aSbostic default:
380be0a61aSbostic usage();
390be0a61aSbostic }
400be0a61aSbostic argc -= optind;
410be0a61aSbostic argv += optind;
420be0a61aSbostic
430be0a61aSbostic switch(argc) {
4478150017Sbostic case 0:
450be0a61aSbostic if (acct(NULL)) {
460be0a61aSbostic (void)fprintf(stderr,
470be0a61aSbostic "accton: %s\n", strerror(errno));
489806ff75Sbostic exit(1);
499806ff75Sbostic }
500be0a61aSbostic break;
5178150017Sbostic case 1:
5278150017Sbostic if (acct(*argv)) {
530be0a61aSbostic (void)fprintf(stderr,
540be0a61aSbostic "accton: %s: %s\n", *argv, strerror(errno));
55a4b7b01aSbill exit(1);
56a4b7b01aSbill }
570be0a61aSbostic break;
580be0a61aSbostic default:
590be0a61aSbostic usage();
600be0a61aSbostic }
61a4b7b01aSbill exit(0);
62a4b7b01aSbill }
630be0a61aSbostic
640be0a61aSbostic void
usage()650be0a61aSbostic usage()
660be0a61aSbostic {
670be0a61aSbostic (void)fprintf(stderr, "usage: accton [file]\n");
680be0a61aSbostic exit(1);
690be0a61aSbostic }
70