don't zero pad uid/gid's
[unix-history] / usr / src / bin / ls / util.c
CommitLineData
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 *
63332977
KB
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 */
20
21#ifndef lint
f066c6c9 22static char sccsid[] = "@(#)util.c 5.3 (Berkeley) %G%";
63332977
KB
23#endif /* not lint */
24
25#include <sys/types.h>
26#include <stdio.h>
27#include <ctype.h>
28
f066c6c9
KB
29prcopy(src, dest, len)
30 register char *src, *dest;
63332977 31 register int len;
f066c6c9
KB
32{
33 register int ch;
63332977 34
f066c6c9
KB
35 while(len--) {
36 ch = *src++;
37 *dest++ = isprint(ch) ? ch : '?';
38 }
63332977
KB
39}
40
41char
42*emalloc(size)
43 u_int size;
44{
45 char *retval, *malloc();
46
47 if (!(retval = malloc(size)))
48 nomem();
49 return(retval);
50}
51
52nomem()
53{
54 (void)fprintf(stderr, "ls: out of memory.\n");
55 exit(1);
56}
57
58usage()
59{
60 (void)fprintf(stderr, "usage: ls [-1ACFLRacdfgilqrstu] [file ...]\n");
61 exit(1);
62}