1*2572Sdlw /* 2*2572Sdlw char id_rindex[] = "@(#)rindex_.c 1.1"; 3*2572Sdlw * 4*2572Sdlw * find last occurrence of substring in string 5*2572Sdlw * 6*2572Sdlw * calling sequence: 7*2572Sdlw * character*(*) substr, string 8*2572Sdlw * indx = rindex (string, substr) 9*2572Sdlw * where: 10*2572Sdlw * indx will be the index of the first character of the last occurence 11*2572Sdlw * of substr in string, or zero if not found. 12*2572Sdlw */ 13*2572Sdlw 14*2572Sdlw long rindex_(str, substr, slen, sublen) 15*2572Sdlw char *str, *substr; long slen, sublen; 16*2572Sdlw { 17*2572Sdlw register char *p = str + (slen - sublen); 18*2572Sdlw 19*2572Sdlw while (p >= str) 20*2572Sdlw if (strncmp(p, substr, (int)sublen) == 0) 21*2572Sdlw return((long)(++p - str)); 22*2572Sdlw else 23*2572Sdlw p--; 24*2572Sdlw return(0L); 25*2572Sdlw } 26