8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / refer / deliv2.c
blobc0b24039cc280a9aae6eaf36c8cc3f03224c1978
1 /*
2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
18 #include <stdio.h>
19 #include <locale.h>
21 int
22 hash(char *s)
24 int c, n;
25 for (n = 0; c = *s; s++)
26 n += (c*n+ c << (n%4));
27 return (n > 0 ? n : -n);
30 void
31 err(char *s, int a)
33 fprintf(stderr, gettext("Error: "));
34 fprintf(stderr, s, a);
35 putc('\n', stderr);
36 exit(1);
39 int
40 prefix(char *t, char *s)
42 int c;
44 while ((c = *t++) == *s++)
45 if (c == 0)
46 return (1);
47 return (c == 0 ? 1 : 0);
50 char *
51 mindex(char *s, char c)
53 char *p;
54 for (p = s; *p; p++)
55 if (*p == c)
56 return (p);
57 return (0);
60 void *
61 zalloc(size_t m, size_t n)
63 char *calloc();
64 void *t;
65 #if D1
66 fprintf(stderr, "calling calloc for %d*%d bytes\n", m, n);
67 #endif
68 t = calloc(m, n);
69 #if D1
70 fprintf(stderr, "calloc returned %o\n", t);
71 #endif
72 return (t);