xref: /original-bsd/usr.bin/f77/libF77/h_indx.c (revision 9087ff44)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)h_indx.c	5.1	06/07/85
7  */
8 
9 short h_indx(a, b, la, lb)
10 char *a, *b;
11 long int la, lb;
12 {
13 int i, n;
14 char *s, *t, *bend;
15 
16 n = la - lb + 1;
17 bend = b + lb;
18 
19 for(i = 0 ; i < n ; ++i)
20 	{
21 	s = a + i;
22 	t = b;
23 	while(t < bend)
24 		if(*s++ != *t++)
25 			goto no;
26 	return(i+1);
27 	no: ;
28 	}
29 return(0);
30 }
31