home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sharew / f_2_c / libf77 / i_indx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-10  |  305 b   |  25 lines

  1. #include "f2c.h"
  2.  
  3. integer i_indx(a, b, la, lb)
  4. char *a, *b;
  5. long int la, lb;
  6. {
  7. long int i, n;
  8. char *s, *t, *bend;
  9.  
  10. n = la - lb + 1;
  11. bend = b + lb;
  12.  
  13. for(i = 0 ; i < n ; ++i)
  14.     {
  15.     s = a + i;
  16.     t = b;
  17.     while(t < bend)
  18.         if(*s++ != *t++)
  19.             goto no;
  20.     return(i+1);
  21.     no: ;
  22.     }
  23. return(0);
  24. }
  25.