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