prettyness police
[unix-history] / usr / src / bin / ls / util.c
index 55d2aa9..4ad8bc5 100644 (file)
@@ -1,6 +1,6 @@
 /*
 /*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Michael Fischbein.
  *
  * This code is derived from software contributed to Berkeley by
  * Michael Fischbein.
@@ -9,77 +9,37 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
+
 #include <ctype.h>
 #include <fts.h>
 #include <ctype.h>
 #include <fts.h>
-#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
+
 #include "ls.h"
 #include "extern.h"
 
 void
 prcopy(src, dest, len)
 #include "ls.h"
 #include "extern.h"
 
 void
 prcopy(src, dest, len)
-       register char *src, *dest;
-       register int len;
+       char *src, *dest;
+       int len;
 {
 {
-       register int ch;
+       int ch;
 
 
-       while(len--) {
+       while (len--) {
                ch = *src++;
                *dest++ = isprint(ch) ? ch : '?';
        }
 }
 
                ch = *src++;
                *dest++ = isprint(ch) ? ch : '?';
        }
 }
 
-void *
-emalloc(size)
-       u_int size;
-{
-       void *retval;
-
-       if ((retval = malloc(size)) == NULL)
-               err(1, "%s", strerror(errno));
-       return (retval);
-}
-
 void
 usage()
 {
 void
 usage()
 {
-       (void)fprintf(stderr, "usage: ls [-1ACFLRTacdfgiklqrstu] [file ...]\n");
+       (void)fprintf(stderr, "usage: ls [-1ACFLRTacdfiklqrstu] [file ...]\n");
        exit(1);
 }
        exit(1);
 }
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-void
-#if __STDC__
-err(int fatal, const char *fmt, ...)
-#else
-err(fatal, fmt, va_alist)
-       int fatal;
-       char *fmt;
-        va_dcl
-#endif
-{
-       va_list ap;
-#if __STDC__
-       va_start(ap, fmt);
-#else
-       va_start(ap);
-#endif
-       (void)fprintf(stderr, "ls: ");
-       (void)vfprintf(stderr, fmt, ap);
-       va_end(ap);
-       (void)fprintf(stderr, "\n");
-       if (fatal)
-               exit(1);
-}