xref: /csrg-svn/usr.bin/f77/libF77/i_indx.c (revision 47940)
1*47940Sbostic /*-
2*47940Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47940Sbostic  * All rights reserved.
422912Skre  *
5*47940Sbostic  * %sccs.include.proprietary.c%
610500Sdlw  */
710500Sdlw 
8*47940Sbostic #ifndef lint
9*47940Sbostic static char sccsid[] = "@(#)i_indx.c	5.2 (Berkeley) 04/12/91";
10*47940Sbostic #endif /* not lint */
11*47940Sbostic 
i_indx(a,b,la,lb)1210500Sdlw long int i_indx(a, b, la, lb)
1310500Sdlw char *a, *b;
1410500Sdlw long int la, lb;
1510500Sdlw {
1610500Sdlw long int i, n;
1710500Sdlw char *s, *t, *bend;
1810500Sdlw 
1910500Sdlw n = la - lb + 1;
2010500Sdlw bend = b + lb;
2110500Sdlw 
2210500Sdlw for(i = 0 ; i < n ; ++i)
2310500Sdlw 	{
2410500Sdlw 	s = a + i;
2510500Sdlw 	t = b;
2610500Sdlw 	while(t < bend)
2710500Sdlw 		if(*s++ != *t++)
2810500Sdlw 			goto no;
2910500Sdlw 	return(i+1);
3010500Sdlw 	no: ;
3110500Sdlw 	}
3210500Sdlw return(0);
3310500Sdlw }
34