# 2.11BSD#431 - /usr/src/usr.bin/refer/deliv2.c

##### Functions

    err               X
    hash              X
    mindex            X
    prefix            X
    zalloc            X

       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: }

#### Defined functions

err defined in line 16; used 34 times

- in /usr/src/usr.bin/refer/deliv1.c line 38
- in /usr/src/usr.bin/refer/glue1.c line 163-168(2), 180, 187
- in /usr/src/usr.bin/refer/glue3.c line 32, 68
- in /usr/src/usr.bin/refer/glue4.c line 45-49(2), 67
- in /usr/src/usr.bin/refer/glue5.c line 52
- in /usr/src/usr.bin/refer/hunt1.c line 139
- in /usr/src/usr.bin/refer/hunt8.c line 78
- in /usr/src/usr.bin/refer/inv1.c line 61, 115
- in /usr/src/usr.bin/refer/inv5.c line 20
- in /usr/src/usr.bin/refer/mkey1.c line 92
- in /usr/src/usr.bin/refer/refer1.c line 47, 110
- in /usr/src/usr.bin/refer/refer2.c line 38-40(2), 86, 100-105(2)
- in /usr/src/usr.bin/refer/refer3.c line 27
- in /usr/src/usr.bin/refer/refer4.c line 20, 64
- in /usr/src/usr.bin/refer/refer5.c line 87, 115, 150, 259-261(2)
- in /usr/src/usr.bin/refer/refer7.c line 20-24(2)

hash defined in line 7; used 5 times

- in /usr/src/usr.bin/refer/hunt2.c line 57
- in /usr/src/usr.bin/refer/inv2.c line 60-63(2), 78
- in /usr/src/usr.bin/refer/mkey3.c line 46

mindex defined in line 35; used 10 times

- in /usr/src/usr.bin/refer/hunt7.c line 31
- in /usr/src/usr.bin/refer/mkey2.c line 63, 89
- in /usr/src/usr.bin/refer/refer6.c line 43, 55, 61, 83, 97-102(3)

prefix defined in line 25; used 6 times

- in /usr/src/usr.bin/refer/refer1.c line 120
- in /usr/src/usr.bin/refer/refer2.c line 28
- in /usr/src/usr.bin/refer/refer5.c line 82, 178-182(3)

zalloc defined in line 46; used 9 times

- in /usr/src/usr.bin/refer/glue1.c line 158, 166, 176-178(2)
- in /usr/src/usr.bin/refer/glue5.c line 50
- in /usr/src/usr.bin/refer/hunt2.c line 38-45(4)

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 508 |