]> git.saurik.com Git - apple/system_cmds.git/blobdiff - accton.tproj/accton.c
system_cmds-805.200.21.tar.gz
[apple/system_cmds.git] / accton.tproj / accton.c
index 723c336c222a0639c3ddae6e3cf7ee01ba770c16..dcb7e83c831e060730a4a85229ab57107be1aaaa 100644 (file)
@@ -1,26 +1,3 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License').  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
 /*
  * Copyright (c) 1988, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -54,8 +27,9 @@
  * SUCH DAMAGE.
  */
 
+#if 0
 #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 */
@@ -63,24 +37,25 @@ static char copyright[] =
 #ifndef lint
 static char sccsid[] = "@(#)accton.c   8.1 (Berkeley) 6/6/93";
 #endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/usr.sbin/accton/accton.c,v 1.8 2004/08/07 04:19:37 imp Exp $");
 
 #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(void);
 
 int
-main(argc, argv)
-       int argc;
-       char *argv[];
+main(int argc, char *argv[])
 {
        int ch;
 
-       while ((ch = getopt(argc, argv, "")) != EOF)
+       while ((ch = getopt(argc, argv, "")) != -1)
                switch(ch) {
                case '?':
                default:
@@ -90,19 +65,13 @@ main(argc, argv)
        argv += optind;
 
        switch(argc) {
-       case 0: 
-               if (acct(NULL)) {
-                       (void)fprintf(stderr,
-                           "accton: %s\n", strerror(errno));
-                       exit(1);
-               }
+       case 0:
+               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();
@@ -110,8 +79,8 @@ main(argc, argv)
        exit(0);
 }
 
-void
-usage()
+static void
+usage(void)
 {
        (void)fprintf(stderr, "usage: accton [file]\n");
        exit(1);