home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume7
/
nsubj
/
jimsindex.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-03
|
436b
|
33 lines
jimsindex(a,b)
char *a, *b;
{
int i,j;
if(!*a || !*b)return -1;
for(i=0;a[i];i++)
{
for(j=0;;j++)
{
/* printf("compare %x and %x\n",a[i+j],b[j]);*/
if(a[i+j]!=b[j])break;
}
if(!b[j])return i;
}
return -1;
}
/*
char *x = "Now is the time for all zorkmids";
main()
{
char y[132];
int i;
for(;;){
gets(y);
i=jimsindex(x,y);
printf("%s,%d\n",x,i);
y[0]=0;
i=jimsindex(x,y);
printf("%s,%d\n",x,i);
}
}
*/