xref: /original-bsd/bin/ls/util.c (revision 2f46dd9e)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Michael Fischbein.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #ifndef lint
12 static char sccsid[] = "@(#)util.c	5.13 (Berkeley) 04/29/93";
13 #endif /* not lint */
14 
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 
18 #include <ctype.h>
19 #include <fts.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #include "ls.h"
25 #include "extern.h"
26 
27 void
28 prcopy(src, dest, len)
29 	register char *src, *dest;
30 	register int len;
31 {
32 	register int ch;
33 
34 	while(len--) {
35 		ch = *src++;
36 		*dest++ = isprint(ch) ? ch : '?';
37 	}
38 }
39 
40 void
41 usage()
42 {
43 	(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfiklqrstu] [file ...]\n");
44 	exit(1);
45 }
46