1*47940Sbostic /*-
2*47940Sbostic * Copyright (c) 1980 The Regents of the University of California.
3*47940Sbostic * All rights reserved.
422896Skre *
5*47940Sbostic * %sccs.include.proprietary.c%
610488Sdlw */
710488Sdlw
8*47940Sbostic #ifndef lint
9*47940Sbostic static char sccsid[] = "@(#)h_indx.c 5.2 (Berkeley) 04/12/91";
10*47940Sbostic #endif /* not lint */
11*47940Sbostic
h_indx(a,b,la,lb)1210488Sdlw short h_indx(a, b, la, lb)
1310488Sdlw char *a, *b;
1410488Sdlw long int la, lb;
1510488Sdlw {
1610488Sdlw int i, n;
1710488Sdlw char *s, *t, *bend;
1810488Sdlw
1910488Sdlw n = la - lb + 1;
2010488Sdlw bend = b + lb;
2110488Sdlw
2210488Sdlw for(i = 0 ; i < n ; ++i)
2310488Sdlw {
2410488Sdlw s = a + i;
2510488Sdlw t = b;
2610488Sdlw while(t < bend)
2710488Sdlw if(*s++ != *t++)
2810488Sdlw goto no;
2910488Sdlw return(i+1);
3010488Sdlw no: ;
3110488Sdlw }
3210488Sdlw return(0);
3310488Sdlw }
34