This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / usr.bin / cksum / cksum.c
index c189d93..3e66ca5 100644 (file)
@@ -1,9 +1,9 @@
 /*-
 /*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  *
  * This code is derived from software contributed to Berkeley by
- * James W. Williams of the University of Maryland.
+ * James W. Williams of NASA Goddard Space Flight Center.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1991 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1991, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)cksum.c    5.3 (Berkeley) 4/4/91";
+static char sccsid[] = "@(#)cksum.c    8.1 (Berkeley) 6/6/93";
 #endif /* not lint */
 
 #include <sys/cdefs.h>
 #endif /* not lint */
 
 #include <sys/cdefs.h>
@@ -54,6 +54,9 @@ static char sccsid[] = "@(#)cksum.c   5.3 (Berkeley) 4/4/91";
 #include <string.h>
 #include "extern.h"
 
 #include <string.h>
 #include "extern.h"
 
+void usage __P((void));
+
+int
 main(argc, argv)
        int argc;
        char **argv;
 main(argc, argv)
        int argc;
        char **argv;
@@ -90,21 +93,21 @@ main(argc, argv)
        argv += optind;
 
        fd = STDIN_FILENO;
        argv += optind;
 
        fd = STDIN_FILENO;
-       fn = "stdin";
+       fn = NULL;
        rval = 0;
        do {
                if (*argv) {
                        fn = *argv++;
                        if ((fd = open(fn, O_RDONLY, 0)) < 0) {
        rval = 0;
        do {
                if (*argv) {
                        fn = *argv++;
                        if ((fd = open(fn, O_RDONLY, 0)) < 0) {
-                               (void)fprintf(stderr,
-                                   "cksum: %s: %s\n", fn, strerror(errno));
+                               (void)fprintf(stderr, "cksum: %s: %s\n",
+                                   fn, strerror(errno));
                                rval = 1;
                                continue;
                        }
                }
                if (cfncn(fd, &val, &len)) {
                                rval = 1;
                                continue;
                        }
                }
                if (cfncn(fd, &val, &len)) {
-                       (void)fprintf(stderr,
-                           "cksum: %s: %s\n", fn, strerror(errno));
+                       (void)fprintf(stderr, "cksum: %s: %s\n",
+                           fn ? fn : "stdin", strerror(errno));
                        rval = 1;
                } else
                        pfncn(fn, val, len);
                        rval = 1;
                } else
                        pfncn(fn, val, len);
@@ -113,6 +116,7 @@ main(argc, argv)
        exit(rval);
 }
 
        exit(rval);
 }
 
+void
 usage()
 {
        (void)fprintf(stderr, "usage: cksum [-o 1 | 2] [file ...]\n");
 usage()
 {
        (void)fprintf(stderr, "usage: cksum [-o 1 | 2] [file ...]\n");