Commit | Line | Data |
---|---|---|
63332977 KB |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
eeb191cb KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Michael Fischbein. | |
7 | * | |
ff47ce84 | 8 | %sccs.include.redist.c% |
63332977 KB |
9 | */ |
10 | ||
11 | #ifndef lint | |
926d5d7d | 12 | static char sccsid[] = "@(#)util.c 5.8 (Berkeley) %G%"; |
63332977 KB |
13 | #endif /* not lint */ |
14 | ||
15 | #include <sys/types.h> | |
16 | #include <stdio.h> | |
17 | #include <ctype.h> | |
18 | ||
f066c6c9 KB |
19 | prcopy(src, dest, len) |
20 | register char *src, *dest; | |
63332977 | 21 | register int len; |
f066c6c9 KB |
22 | { |
23 | register int ch; | |
63332977 | 24 | |
f066c6c9 KB |
25 | while(len--) { |
26 | ch = *src++; | |
27 | *dest++ = isprint(ch) ? ch : '?'; | |
28 | } | |
63332977 KB |
29 | } |
30 | ||
31 | char | |
32 | *emalloc(size) | |
33 | u_int size; | |
34 | { | |
35 | char *retval, *malloc(); | |
36 | ||
37 | if (!(retval = malloc(size))) | |
38 | nomem(); | |
39 | return(retval); | |
40 | } | |
41 | ||
42 | nomem() | |
43 | { | |
44 | (void)fprintf(stderr, "ls: out of memory.\n"); | |
45 | exit(1); | |
46 | } | |
47 | ||
48 | usage() | |
49 | { | |
926d5d7d | 50 | (void)fprintf(stderr, "usage: ls [-1ACFLRTacdfgiklqrstu] [file ...]\n"); |
63332977 KB |
51 | exit(1); |
52 | } |