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: mindex(s, c)
  27:     char *s;
  28: {
  29: register char *p;
  30: for( p=s; *p; p++)
  31:     if (*p ==c)
  32:         return(p);
  33: return(0);
  34: }
  35: zalloc(m,n)
  36: {
  37:     int t;
  38: # if D1
  39: fprintf(stderr, "calling calloc for %d*%d bytes\n",m,n);
  40: # endif
  41: t = calloc(m,n);
  42: # if D1
  43: fprintf(stderr, "calloc returned %o\n", t);
  44: # endif
  45: return(t);
  46: }

Defined functions

Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 693
Valid CSS Valid XHTML 1.0 Strict