|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)deliv2.c 4.1 (Berkeley) 5/6/83"; ! 3: #endif ! 4: ! 5: #include <stdio.h> ! 6: ! 7: hash (s) ! 8: char *s; ! 9: { ! 10: int c, n; ! 11: for(n=0; c= *s; s++) ! 12: n += (c*n+ c << (n%4)); ! 13: return(n>0 ? n : -n); ! 14: } ! 15: ! 16: err (s, a) ! 17: char *s; ! 18: { ! 19: fprintf(stderr, "Error: "); ! 20: fprintf(stderr, s, a); ! 21: putc('\n', stderr); ! 22: exit(1); ! 23: } ! 24: ! 25: prefix(t, s) ! 26: char *t, *s; ! 27: { ! 28: int c; ! 29: ! 30: while ((c= *t++) == *s++) ! 31: if (c==0) return(1); ! 32: return(c==0 ? 1: 0); ! 33: } ! 34: ! 35: char * ! 36: mindex(s, c) ! 37: char *s; ! 38: { ! 39: register char *p; ! 40: for( p=s; *p; p++) ! 41: if (*p ==c) ! 42: return(p); ! 43: return(0); ! 44: } ! 45: ! 46: zalloc(m,n) ! 47: { ! 48: char *calloc(); ! 49: int t; ! 50: # if D1 ! 51: fprintf(stderr, "calling calloc for %d*%d bytes\n",m,n); ! 52: # endif ! 53: t = (int) calloc(m,n); ! 54: # if D1 ! 55: fprintf(stderr, "calloc returned %o\n", t); ! 56: # endif ! 57: return(t); ! 58: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.