|
|
1.1 ! root 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: * @(#)i_indx.c 5.1 6/7/85 ! 7: */ ! 8: ! 9: long int i_indx(a, b, la, lb) ! 10: char *a, *b; ! 11: long int la, lb; ! 12: { ! 13: long 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: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.