1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)h_indx.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 short h_indx(a, b, la, lb) 13 char *a, *b; 14 long int la, lb; 15 { 16 int i, n; 17 char *s, *t, *bend; 18 19 n = la - lb + 1; 20 bend = b + lb; 21 22 for(i = 0 ; i < n ; ++i) 23 { 24 s = a + i; 25 t = b; 26 while(t < bend) 27 if(*s++ != *t++) 28 goto no; 29 return(i+1); 30 no: ; 31 } 32 return(0); 33 } 34