register char *p;
for (p = keys = optarg; *p; ++p)
- if (!index(keylist, *p)) {
+ if (!strchr(keylist, *p)) {
(void)fprintf(stderr,
"arithmetic: unknown key.\n");
exit(1);
{
char *p;
- if (op == 0 || (p = index(keylist, op)) == NULL) {
+ if (op == 0 || (p = strchr(keylist, op)) == NULL) {
(void)fprintf(stderr,
"arithmetic: bug: op %c not in keylist %s\n", op, keylist);
exit(1);
register int i, fd, num_scores = 0, good, changed = 0, found = 0;
struct passwd *pw;
FILE *fp;
- char *cp, *index(), *rindex();
+ char *cp;
SCORE score[100], thisscore;
#ifdef SYSV
struct utsname name;
strcpy(thisscore.host, name.sysname);
#endif
- cp = rindex(file, '/');
+ cp = strrchr(file, '/');
if (cp == NULL) {
fprintf(stderr, "log: where's the '/' in %s?\n", file);
return (-1);
"game", "time", "real time", "planes safe");
puts("-------------------------------------------------------------------------------");
for (i = 0; i < num_scores; i++) {
- cp = index(score[i].host, '.');
+ cp = strchr(score[i].host, '.');
if (cp != NULL)
*cp = '\0';
printf("%2d: %-8s %-8s %-18s %4d %9s %4d\n", i + 1,
PLANE *pp;
{
static char buf[50], *bp, *comm_start;
- char *index();
buf[0] = '\0';
bp = buf;
(pp->fuel < LOWFUEL) ? '*' : ' ',
(pp->dest_type == T_AIRPORT) ? 'A' : 'E', pp->dest_no);
- comm_start = bp = index(buf, '\0');
+ comm_start = bp = strchr(buf, '\0');
if (pp->altitude == 0)
(void)sprintf(bp, "Holding @ A%d", pp->orig_no);
else if (pp->new_dir >= MAXDIR || pp->new_dir < 0)
else if (pp->new_dir != pp->dir)
(void)sprintf(bp, "%d", dir_deg(pp->new_dir));
- bp = index(buf, '\0');
+ bp = strchr(buf, '\0');
if (pp->delayd)
(void)sprintf(bp, " @ B%d", pp->delayd_no);
- bp = index(buf, '\0');
+ bp = strchr(buf, '\0');
if (*comm_start == '\0' &&
(pp->status == S_UNMARKED || pp->status == S_IGNORED))
strcpy(bp, "---------");
static char rowchars[] = " 123456789";
register int i, row;
register char *p;
- char *index();
/* ruthlessly remove newlines and truncate at 48 characters. */
- if ((p = index(str, '\n')))
+ if ((p = strchr(str, '\n')))
*p = '\0';
if (strlen(str) > COLUMNS)
for (nwords = 1;
fgets(buf[current], MAXWORDLEN + 1, stdin) != NULL; ++nwords) {
- if ((p = index(buf[current], '\n')) == NULL) {
+ if ((p = strchr(buf[current], '\n')) == NULL) {
fprintf(stderr,
"mkdict: word too long: %s\n", buf[current]);
while ((ch = getc(stdin)) != EOF && ch != '\n')
case 0:
if (!(path = getenv("PAGER")))
path = _PATH_MORE;
- if (pager = rindex(path, '/'))
+ if (pager = strrchr(path, '/'))
++pager;
pager = path;
execlp(path, pager, _PATH_INSTR, (char *)NULL);
obscene->fd = fd;
obscene->inf = NULL;
obscene->path = offensive;
- if ((sp = rindex(offensive, '/')) == NULL)
+ if ((sp = strrchr(offensive, '/')) == NULL)
obscene->name = offensive;
else
obscene->name = ++sp;
return FALSE;
}
- if ((sp = rindex(file, '/')) == NULL)
+ if ((sp = strrchr(file, '/')) == NULL)
sp = file;
else
sp++;
DPRINTF(2, (stderr, "FALSE (file starts with '.')\n"));
return FALSE;
}
- if ((sp = rindex(sp, '.')) != NULL) {
+ if ((sp = strrchr(sp, '.')) != NULL) {
sp++;
for (i = 0; suflist[i] != NULL; i++)
if (strcmp(sp, suflist[i]) == 0) {
char c;
pline("Pick up %s ? [ynaq]", doname(obj));
- while(!index("ynaq ", (c = readchar())))
+ while(!strchr("ynaq ", (c = readchar())))
bell();
if(c == 'q') return;
if(c == 'n') continue;
for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){
if(x == u.ux && y == u.uy) continue;
if((mtmp = m_at(x,y)) && !mtmp->mimic && !mtmp->mtame &&
- !mtmp->mpeaceful && !index("Ea", mtmp->data->mlet) &&
+ !mtmp->mpeaceful && !strchr("Ea", mtmp->data->mlet) &&
!mtmp->mfroz && !mtmp->msleep && /* aplvax!jcn */
(!mtmp->minvis || See_invisible))
return(1);
register char *dp;
u.dz = 0;
- if(!(dp = index(sdir, sym))) return(0);
+ if(!(dp = strchr(sdir, sym))) return(0);
u.dx = xdir[dp-sdir];
u.dy = ydir[dp-sdir];
u.dz = zdir[dp-sdir];
if(s) pline("In what direction?");
dirsym = readchar();
if(!movecmd(dirsym) && !u.dz) {
- if(!index(quitchars, dirsym))
+ if(!strchr(quitchars, dirsym))
pline("What a strange direction!");
return(0);
}
otemp.quan = 1;
otemp.onamelth = 0;
str = xname(&otemp);
- pline("Call %s %s: ", index(vowels,*str) ? "an" : "a", str);
+ pline("Call %s %s: ", strchr(vowels,*str) ? "an" : "a", str);
getlin(buf);
clrlin();
if(!*buf || *buf == '\033')
char answer;
pline("What ring, Right or Left? [ rl?]");
- if(index(quitchars, (answer = readchar())))
+ if(strchr(quitchars, (answer = readchar())))
return(0);
switch(answer) {
case 'l':
char answer;
pline("What ring-finger, Right or Left? ");
- if(index(quitchars, (answer = readchar())))
+ if(strchr(quitchars, (answer = readchar())))
return(0);
switch(answer){
case 'l':
edog->droptime = moves;
}
} else {
- if(obj = o_at(omx,omy)) if(!index("0_", obj->olet)){
+ if(obj = o_at(omx,omy)) if(!strchr("0_", obj->olet)){
if((otyp = dogfood(obj)) <= CADAVER){
nix = omx;
niy = omy;
#ifndef NOWORM
mtmp->wormno ||
#endif NOWORM
- mtmp->isshk || mtmp->isgd || index(" &@12", mtmp->data->mlet))
+ mtmp->isshk || mtmp->isgd || strchr(" &@12", mtmp->data->mlet))
return(0); /* no tame long worms? */
if(obj) {
if(dogfood(obj) >= MANFOOD) return(0);
poisonous(otmp)
register struct obj *otmp;
{
- return(index(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0);
+ return(strchr(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0);
}
/* returns 1 if some text was printed */
pline("You get very sick.");
Sick = 10 + rn2(10);
u.usick_cause = objects[otmp->otyp].oc_name;
- } else if(index(POISONOUS, let) && rn2(5)){
+ } else if(strchr(POISONOUS, let) && rn2(5)){
tp++;
pline("Ecch -- that must have been poisonous!");
if(!Poison_resistance){
losehp(rnd(15), "poisonous corpse");
} else
pline("You don't seem affected by the poison.");
- } else if(index("ELNOPQRUuxz", let) && rn2(5)){
+ } else if(strchr("ELNOPQRUuxz", let) && rn2(5)){
tp++;
pline("You feel sick.");
losehp(rnd(8), "cadaver");
if(*st1 == 'd' && st1[1] == 'r') killer = "drowning"; else
if(*st1 == 'p') killer = "panic"; else
if(*st1 == 't') killer = "trickery"; else
- if(!index("bcd", *st1)) killer = st1;
+ if(!strchr("bcd", *st1)) killer = st1;
paybill();
clearlocks();
if(flags.toplin == 1) more();
- if(index("bcds", *st1)){
+ if(strchr("bcds", *st1)){
#ifdef WIZARD
if(!wizard)
#endif WIZARD
if(killed) Sprintf(eos(linebuf), " by %s%s",
(!strncmp(t1->death, "trick", 5) || !strncmp(t1->death, "the ", 4))
? "" :
- index(vowels,*t1->death) ? "an " : "a ",
+ strchr(vowels,*t1->death) ? "an " : "a ",
t1->death);
Sprintf(eos(linebuf), ".");
if(t1->maxhp) {
if(!argv[1][2]){
argc--;
argv++;
- } else if(!argv[1][3] && index("CFKSTWX", argv[1][2])) {
+ } else if(!argv[1][3] && strchr("CFKSTWX", argv[1][2])) {
argv[1]++;
argv[1][0] = '-';
} else argv[1] += 2;
.hacklog or something in his home directory. */
flags.beginner = (total_score < 6000);
for(i=0; i<6; i++)
- if(!index(totchars, "CFKSTWX"[i])) {
+ if(!strchr(totchars, "CFKSTWX"[i])) {
flags.beginner = 1;
if(!pl_character[0]) pl_character[0] = "CFKSTWX"[i];
break;
int hit;
schar tmp;
boolean vis;
- if(index("Eauy", pa->mlet)) return(0);
+ if(strchr("Eauy", pa->mlet)) return(0);
if(magr->mfroz) return(0); /* riv05!a3 */
tmp = pd->ac + pa->mlevel;
if(mdef->mconf || mdef->mfroz || mdef->msleep){
/* drop a rock and remove monster */
monstone(mdef) register struct monst *mdef; {
extern char mlarge[];
- if(index(mlarge, mdef->data->mlet))
+ if(strchr(mlarge, mdef->data->mlet))
mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my);
else
mksobj_at(ROCK, mdef->mx, mdef->my);
if(obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG))
tmp = rnd(2);
else {
- if(index(mlarge, mon->data->mlet)) {
+ if(strchr(mlarge, mon->data->mlet)) {
tmp = rnd(objects[obj->otyp].wldam);
if(obj->otyp == TWO_HANDED_SWORD) tmp += d(2,6);
else if(obj->otyp == FLAIL) tmp += rnd(4);
killed(mon);
return(FALSE);
case CLOVE_OF_GARLIC: /* no effect against demons */
- if(index(UNDEAD, mon->data->mlet))
+ if(strchr(UNDEAD, mon->data->mlet))
mon->mflee = 1;
tmp = 1;
break;
else if(uwep->otyp == DAGGER) tmp += 2;
else if(uwep->otyp == CRYSKNIFE) tmp += 3;
else if(uwep->otyp == SPEAR &&
- index("XDne", mdat->mlet)) tmp += 2;
+ strchr("XDne", mdat->mlet)) tmp += 2;
}
if(mtmp->msleep) {
mtmp->msleep = 0;
ilet = 'a';
for(otmp = invent; otmp; otmp = otmp->nobj){
- if(!*let || index(let, otmp->olet)) {
+ if(!*let || strchr(let, otmp->olet)) {
bp[foo++] = flags.invlet_constant ? otmp->invlet : ilet;
/* ugly check: remove inappropriate things */
pline("No count allowed with this command.");
continue;
}
- if(index(quitchars,ilet))
+ if(strchr(quitchars,ilet))
return((struct obj *)0);
if(ilet == '-') {
return(allownone ? &zeroobj : (struct obj *) 0);
}
break;
}
- if(!allowall && let && !index(let,otmp->olet)) {
+ if(!allowall && let && !strchr(let,otmp->olet)) {
pline("That is a silly thing to %s.",word);
return(0);
}
if(allowgold) ilets[iletct++] = '$';
ilets[iletct] = 0;
while(otmp) {
- if(!index(ilets, otmp->olet)){
+ if(!strchr(ilets, otmp->olet)){
ilets[iletct++] = otmp->olet;
ilets[iletct] = 0;
}
} else
if(sym == 'a' || sym == 'A') allflag = TRUE; else
if(sym == 'u' || sym == 'U') ckfn = ckunpaid; else
- if(index("!%?[()=*/\"0", sym)){
- if(!index(olets, sym)){
+ if(strchr("!%?[()=*/\"0", sym)){
+ if(!strchr(olets, sym)){
olets[oletct++] = sym;
olets[oletct] = 0;
}
for(otmp = objchn; otmp; otmp = otmp2){
if(ilet == 'z') ilet = 'A'; else ilet++;
otmp2 = otmp->nobj;
- if(olets && *olets && !index(olets, otmp->olet)) continue;
+ if(olets && *olets && !strchr(olets, otmp->olet)) continue;
if(ckfn && !(*ckfn)(otmp)) continue;
if(!allflag) {
pline(xprname(otmp, ilet));
ilet = 'a';
for(otmp = invent; otmp; otmp = otmp->nobj) {
if(flags.invlet_constant) ilet = otmp->invlet;
- if(!lets || !*lets || index(lets, ilet)) {
+ if(!lets || !*lets || strchr(lets, ilet)) {
cornline(1, xprname(otmp, ilet));
any[ct++] = ilet;
}
if(u.ugold) stuff[stct++] = '$';
stuff[stct] = 0;
for(otmp = invent; otmp; otmp = otmp->nobj) {
- if (!index (stuff, otmp->olet)) {
+ if (!strchr (stuff, otmp->olet)) {
stuff[stct++] = otmp->olet;
stuff[stct] = 0;
}
pline ("What type of object [%s] do you want an inventory of? ",
stuff);
c = readchar();
- if(index(quitchars,c)) return(0);
+ if(strchr(quitchars,c)) return(0);
} else
c = stuff[0];
obj->spe == otmp->spe &&
obj->dknown == otmp->dknown &&
obj->cursed == otmp->cursed &&
- (index("%*?!", obj->olet) ||
+ (strchr("%*?!", obj->olet) ||
(obj->known == otmp->known &&
(obj->olet == WEAPON_SYM && obj->otyp < BOOMERANG)))) {
otmp->quan += obj->quan;
long newhp; /* tmoves may be very large */
mtmp2 = mtmp->nmon;
- if(index(genocided, mtmp->data->mlet)) {
+ if(strchr(genocided, mtmp->data->mlet)) {
mondead(mtmp);
continue;
}
}
newhp = mtmp->mhp +
- (index(MREGEN, mtmp->data->mlet) ? tmoves : tmoves/20);
+ (strchr(MREGEN, mtmp->data->mlet) ? tmoves : tmoves/20);
if(newhp > mtmp->mhpmax)
mtmp->mhp = mtmp->mhpmax;
else
register char *gp = genocided;
while(pm < mons+CMNUM+2){
- if(!index(sfoo, pm->mlet))
+ if(!strchr(sfoo, pm->mlet))
*gp++ = pm->mlet;
pm++;
}
#include "hack.h"
extern char fut_geno[];
-extern char *index();
extern struct obj *mkobj_at();
struct monst zeromonst;
if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0);
if(ptr){
- if(index(fut_geno, ptr->mlet)) return((struct monst *) 0);
+ if(strchr(fut_geno, ptr->mlet)) return((struct monst *) 0);
} else {
ct = CMNUM - strlen(fut_geno);
- if(index(fut_geno, 'm')) ct++; /* make only 1 minotaur */
- if(index(fut_geno, '@')) ct++;
+ if(strchr(fut_geno, 'm')) ct++; /* make only 1 minotaur */
+ if(strchr(fut_geno, '@')) ct++;
if(ct <= 0) return(0); /* no more monsters! */
tmp = rn2(ct*dlevel/24 + 7);
if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12);
if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2);
for(ct = 0; ct < CMNUM; ct++){
ptr = &mons[ct];
- if(index(fut_geno, ptr->mlet))
+ if(strchr(fut_geno, ptr->mlet))
continue;
if(!tmp--) goto gotmon;
}
if(ptr->mlet == 'I' || ptr->mlet == ';')
mtmp->minvis = 1;
if(ptr->mlet == 'L' || ptr->mlet == 'N'
- || (in_mklev && index("&w;", ptr->mlet) && rn2(5))
+ || (in_mklev && strchr("&w;", ptr->mlet) && rn2(5))
) mtmp->msleep = 1;
#ifndef NOWORM
mtmp->minvis = 0;
pmon(mtmp);
}
- if(!index("1&DuxynNF",mdat->mlet))
+ if(!strchr("1&DuxynNF",mdat->mlet))
tmp = hitu(mtmp,d(mdat->damn,mdat->damd));
else
tmp = 0;
- if(index(UNDEAD, mdat->mlet) && midnight())
+ if(strchr(UNDEAD, mdat->mlet) && midnight())
tmp += hitu(mtmp,d(mdat->damn,mdat->damd));
ctmp = tmp && !mtmp->mcan &&
if(!num || num >= TRAPNUM) {
nopierc = (dlevel < 4) ? 1 : 0;
nomimic = (dlevel < 9 || goldseen ) ? 1 : 0;
- if(index(fut_geno, 'M')) nomimic = 1;
+ if(strchr(fut_geno, 'M')) nomimic = 1;
kind = rn2(TRAPNUM - nopierc - nomimic);
/* note: PIERC = 7, MIMIC = 8, TRAPNUM = 9 */
} else kind = num;
otmp->quan = 1;
otmp->olet = let;
otmp->otyp = otyp;
- otmp->dknown = index("/=!?*", let) ? 0 : 1;
+ otmp->dknown = strchr("/=!?*", let) ? 0 : 1;
switch(let) {
case WEAPON_SYM:
otmp->quan = (otmp->otyp <= ROCK) ? rn1(6,6) : 1;
panic("bad monster %c (%d)",mdat->mlet,mdat->mlevel);
/* regenerate monsters */
- if((!(moves%20) || index(MREGEN, mdat->mlet)) &&
+ if((!(moves%20) || strchr(MREGEN, mdat->mlet)) &&
mtmp->mhp < mtmp->mhpmax)
mtmp->mhp++;
/* Nymphs and Leprechauns do not easily wake up */
if(cansee(mtmp->mx,mtmp->my) &&
(!Stealth || (mdat->mlet == 'e' && rn2(10))) &&
- (!index("NL",mdat->mlet) || !rn2(50)) &&
- (Aggravate_monster || index("d1", mdat->mlet)
+ (!strchr("NL",mdat->mlet) || !rn2(50)) &&
+ (Aggravate_monster || strchr("d1", mdat->mlet)
|| (!rn2(7) && !mtmp->mimic)))
mtmp->msleep = 0;
else return(0);
if(mtmp->mconf && !rn2(50)) mtmp->mconf = 0;
/* some monsters teleport */
- if(mtmp->mflee && index("tNL", mdat->mlet) && !rn2(40)){
+ if(mtmp->mflee && strchr("tNL", mdat->mlet) && !rn2(40)){
rloc(mtmp);
return(0);
}
mtmp->mflee ||
mtmp->mconf ||
(mtmp->minvis && !rn2(3)) ||
- (index("BIuy", mdat->mlet) && !rn2(4)) ||
+ (strchr("BIuy", mdat->mlet) && !rn2(4)) ||
(mdat->mlet == 'L' && !u.ugold && (mtmp->mgold || rn2(2))) ||
(!mtmp->mcansee && !rn2(4)) ||
mtmp->mpeaceful
return(tmp == 2);
}
- if(!index("Ea", mdat->mlet) && nearby &&
+ if(!strchr("Ea", mdat->mlet) && nearby &&
!mtmp->mpeaceful && u.uhp > 0 && !scared) {
if(mhitu(mtmp))
return(1); /* monster died (e.g. 'y' or 'F') */
}
/* spit fire ('D') or use a wand ('1') when appropriate */
- if(index("D1", msym))
+ if(strchr("D1", msym))
inrange(mtmp);
if(msym == 'U' && !mtmp->mcan && canseemon(mtmp) &&
appr = 1;
if(mtmp->mflee) appr = -1;
if(mtmp->mconf || Invis || !mtmp->mcansee ||
- (index("BIy", msym) && !rn2(3)))
+ (strchr("BIy", msym) && !rn2(3)))
appr = 0;
omx = mtmp->mx;
omy = mtmp->my;
}
/* look for gold or jewels nearby */
- likegold = (index("LOD", msym) != NULL);
- likegems = (index("ODu", msym) != NULL);
+ likegold = (strchr("LOD", msym) != NULL);
+ likegems = (strchr("ODu", msym) != NULL);
likeobjs = mtmp->mhide;
#define SRCHRADIUS 25
{ xchar mind = SRCHRADIUS; /* not too far away */
cnt = mfndpos(mtmp,poss,info,
msym == 'u' ? NOTONL :
(msym == '@' || msym == '1') ? (ALLOW_SSM | ALLOW_TRAPS) :
- index(UNDEAD, msym) ? NOGARLIC : ALLOW_TRAPS);
+ strchr(UNDEAD, msym) ? NOGARLIC : ALLOW_TRAPS);
/* ALLOW_ROCK for some monsters ? */
chcnt = 0;
chi = -1;
extern char fut_geno[];
u.nr_killed[tmp]++;
if((nk = u.nr_killed[tmp]) > MAXMONNO &&
- !index(fut_geno, mdat->mlet))
+ !strchr(fut_geno, mdat->mlet))
charcat(fut_geno, mdat->mlet);
}
/* give experience points */
tmp = 1 + mdat->mlevel * mdat->mlevel;
if(mdat->ac < 3) tmp += 2*(7 - mdat->ac);
- if(index("AcsSDXaeRTVWU&In:P", mdat->mlet))
+ if(strchr("AcsSDXaeRTVWU&In:P", mdat->mlet))
tmp += 2*mdat->mlevel;
- if(index("DeV&P",mdat->mlet)) tmp += (7*mdat->mlevel);
+ if(strchr("DeV&P",mdat->mlet)) tmp += (7*mdat->mlevel);
if(mdat->mlevel > 6) tmp += 50;
if(mdat->mlet == ';') tmp += 1000;
stackobj(fobj);
} else
#endif NOWORM
- if(!letter(tmp) || (!index("mw", tmp) && !rn2(3))) tmp = 0;
+ if(!letter(tmp) || (!strchr("mw", tmp) && !rn2(3))) tmp = 0;
if(ACCESSIBLE(levl[x][y].typ)) /* might be mimic in wall or dead eel*/
if(x != u.ux || y != u.uy) /* might be here after swallowed */
- if(index("NTVm&",mdat->mlet) || rn2(5)) {
+ if(strchr("NTVm&",mdat->mlet) || rn2(5)) {
register struct obj *obj2 = mkobj_at(tmp,x,y);
if(cansee(x,y))
atl(x,y,obj2->olet);
if(*p == 's' || *p == 'z' || *p == 'x' ||
(*p == 'h' && p[-1] == 's'))
Strcat(buf, "es"); /* boxes */
- else if(*p == 'y' && !index(vowels, p[-1]))
+ else if(*p == 'y' && !strchr(vowels, p[-1]))
Strcpy(p, "ies"); /* rubies, zruties */
else
Strcat(buf, "s");
Strcat(bp, " (weapon in hand)");
if(obj->unpaid)
Strcat(bp, " (unpaid)");
- if(!strcmp(prefix, "a ") && index(vowels, *bp))
+ if(!strcmp(prefix, "a ") && strchr(vowels, *bp))
Strcpy(prefix, "an ");
bp = strprepend(bp, prefix);
return(bp);
setan(str,buf)
register char *str,*buf;
{
- if(index(vowels,*str))
+ if(strchr(vowels,*str))
Sprintf(buf, "an %s", str);
else
Sprintf(buf, "a %s", str);
while(digit(*bp)) bp++;
while(*bp == ' ') bp++;
} else {
- p = rindex(bp, '(');
+ p = strrchr(bp, '(');
if(p) {
if(p > bp && p[-1] == ' ') p[-1] = 0;
else *p = 0;
otmp = mksobj(typ);
if(heavy)
otmp->owt += 15;
- if(cnt > 0 && index("%?!*)", let) &&
+ if(cnt > 0 && strchr("%?!*)", let) &&
(cnt < 4 || (let == WEAPON_SYM && typ <= ROCK && cnt < 20)))
otmp->quan = cnt;
unsigned num;
boolean negated;
- if(op = index(opts, ',')) {
+ if(op = strchr(opts, ',')) {
*op++ = 0;
parseoptions(op, from_env);
}
- if(op = index(opts, ' ')) {
+ if(op = strchr(opts, ' ')) {
op2 = op;
while(*op++)
if(*op != ' ') *op2++ = *op;
pline("The playername can be set only from HACKOPTIONS.");
return;
}
- op = index(opts,':');
+ op = strchr(opts,':');
if(!op) goto bad;
(void) strncpy(plname, op+1, sizeof(plname)-1);
plname[sizeof(plname)-1] = '\0';
/* endgame:5t[op] 5a[round] o[wn] */
if(!strncmp(opts,"endgame",3)) {
- op = index(opts,':');
+ op = strchr(opts,':');
if(!op) goto bad;
op++;
while(*op) {
if(q != '\t')
while(fgets(buf,BUFSZ,fp))
if(*buf == q) {
- ep = index(buf, '\n');
+ ep = strchr(buf, '\n');
if(ep) *ep = 0;
/* else: bad data file */
/* Expand tab 'by hand' */
bufr = (char *) alloc((unsigned) CO);
bufr[CO-1] = 0;
while(fgets(bufr,CO-1,fp) && (!strip || *bufr == '\t') && !got_intrup){
- ep = index(bufr, '\n');
+ ep = strchr(bufr, '\n');
if(ep)
*ep = 0;
if(page_line(bufr+strip)) {
char c;
pline ("Long or short help? ");
- while (((c = readchar ()) != 'l') && (c != 's') && !index(quitchars,c))
+ while (((c = readchar ()) != 'l') && (c != 's') && !strchr(quitchars,c))
bell ();
- if (!index(quitchars, c))
+ if (!strchr(quitchars, c))
(void) page_file((c == 'l') ? HELP : SHELP, FALSE);
return(0);
}
pline("What monster do you want to genocide (Type the letter)? ");
getlin(buf);
} while(strlen(buf) != 1 || !monstersym(*buf));
- if(!index(fut_geno, *buf))
+ if(!strchr(fut_geno, *buf))
charcat(fut_geno, *buf);
- if(!index(genocided, *buf))
+ if(!strchr(genocided, *buf))
charcat(genocided, *buf);
else {
pline("Such monsters do not exist in this world.");
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if(dist(mtmp->mx,mtmp->my) < 3) {
mtmp->mhp -= num;
- if(index("FY", mtmp->data->mlet))
+ if(strchr("FY", mtmp->data->mlet))
mtmp->mhp -= 3*num; /* this might well kill 'F's */
if(mtmp->mhp < 1) {
killed(mtmp);
/*
* can't genocide certain monsters
*/
- if (index("12 &:", ch))
+ if (strchr("12 &:", ch))
return FALSE;
if (ch == pm_eel.mlet)
(void) sprintf(buf, "killed by%s",
!strncmp(killer, "the ", 4) ? "" :
!strcmp(killer, "starvation") ? "" :
- index(vowels, *killer) ? " an" : " a");
+ strchr(vowels, *killer) ? " an" : " a");
center(8, buf);
(void) strcpy(buf, killer);
{
#include "hack.h" /* for RUMORFILE and BSD (index) */
#define CHARSZ 8 /* number of bits in a char */
extern long *alloc();
-extern char *index();
int n_rumors = 0;
int n_used_rumors = -1;
char *usedbits;
char line[COLNO];
while(1) {
if(!fgets(line, sizeof(line), rumf)) return(0);
- if(index(line, '\n')) return(1);
+ if(strchr(line, '\n')) return(1);
}
}
char line[COLNO];
register char *ep;
if(!fgets(line, sizeof(line), rumf)) return;
- if((ep = index(line, '\n')) != 0) *ep = 0;
+ if((ep = strchr(line, '\n')) != 0) *ep = 0;
pline("This cookie has a scrap of paper inside! It reads: ");
pline(line);
}
return;
if(ESHK(shopkeeper)->billct == BILLSZ ||
((tmp = shtypes[rooms[ESHK(shopkeeper)->shoproom].rtype-8]) && tmp != obj->olet)
- || index("_0", obj->olet)) {
+ || strchr("_0", obj->olet)) {
pline("%s seems not interested.", Monnam(shopkeeper));
return;
}
follower(mtmp)
register struct monst *mtmp;
{
- return( mtmp->mtame || index("1TVWZi&, ", mtmp->data->mlet)
+ return( mtmp->mtame || strchr("1TVWZi&, ", mtmp->data->mlet)
#ifndef QUEST
|| (mtmp->isshk && ESHK(mtmp)->following)
#endif QUEST
redotoplin() {
home();
- if(index(toplines, '\n')) cl_end();
+ if(strchr(toplines, '\n')) cl_end();
putstr(toplines);
cl_end();
tlx = curx;
register int n,n0;
if(!line || !*line) return;
- if(!index(line, '%')) (void) strcpy(pbuf,line); else
+ if(!strchr(line, '%')) (void) strcpy(pbuf,line); else
(void) sprintf(pbuf,line,arg1,arg2,arg3,arg4,arg5,arg6);
if(flags.toplin == 1 && !strcmp(pbuf, toplines)) return;
nscr(); /* %% */
mtmp->mtrapseen |= (1 << tt);
switch (tt) {
case BEAR_TRAP:
- if(index(mlarge, mtmp->data->mlet)) {
+ if(strchr(mlarge, mtmp->data->mlet)) {
if(in_sight)
pline("%s is caught in a bear trap!",
Monnam(mtmp));
break;
case PIT:
/* there should be a mtmp/data -> floating */
- if(!index("EywBfk'& ", mtmp->data->mlet)) { /* ab */
+ if(!strchr("EywBfk'& ", mtmp->data->mlet)) { /* ab */
mtmp->mtrapped = 1;
if(in_sight)
pline("%s falls in a pit!", Monnam(mtmp));
while((c = readchar()) != '\n') {
if(flags.cbreak) {
if(c == ' ') break;
- if(s && index(s,c)) {
+ if(s && strchr(s,c)) {
morc = c;
break;
}
printf("\nAre you an experienced player? [ny] ");
- while(!index("ynYN \n\004", (exper = readchar())))
+ while(!strchr("ynYN \n\004", (exper = readchar())))
bell();
if(exper == '\004') /* Give him an opportunity to get out */
end_of_input();
printf("%c\n", exper); /* echo */
- if(index("Nn \n", exper)) {
+ if(strchr("Nn \n", exper)) {
exper = 0;
goto beginner;
}
register int type;
while(ep && *ep) {
type = atoi(ep);
- ep = index(ep, ',');
+ ep = strchr(ep, ',');
if(ep) while(*ep == ',' || *ep == ' ') ep++;
if(type <= 0 || type > NROFOBJECTS) continue;
trop->trotyp = type;
plnamesuffix() {
register char *p;
- if(p = rindex(plname, '-')) {
+ if(p = strrchr(plname, '-')) {
*p = 0;
pl_character[0] = p[1];
pl_character[1] = 0;
/* so that rolesyms[] is defined */
register char *cp;
- if(cp = index(rolesyms, pc))
+ if(cp = strchr(rolesyms, pc))
return(cp - rolesyms);
return(-1);
}
#include <stdio.h>
#include <errno.h>
-#include "hack.h" /* mainly for index() which depends on BSD */
+#include "hack.h"
#include <sys/types.h> /* for time_t and stat */
#include <sys/stat.h>
register char *np;
if(stat(name, &hbuf))
error("Cannot get status of %s.",
- (np = rindex(name, '/')) ? np+1 : name);
+ (np = strrchr(name, '/')) ? np+1 : name);
version using PATH from: seismo!gregc@ucsf-cgl.ARPA (Greg Couch) */
register char *np, *path;
char filename[MAXPATHLEN+1];
- if (index(name, '/') != NULL || (path = getenv("PATH")) == NULL)
+ if (strchr(name, '/') != NULL || (path = getenv("PATH")) == NULL)
path = "";
for (;;) {
- if ((np = index(path, ':')) == NULL)
+ if ((np = strchr(path, ':')) == NULL)
np = path + strlen(path); /* point to end str */
if (np - path <= 1) /* %% */
(void) strcpy(filename, name);
path = np + 1;
}
error("Cannot get status of %s.",
- (np = rindex(name, '/')) ? np+1 : name);
+ (np = strrchr(name, '/')) ? np+1 : name);
}
uptodate(fd) {
{
register char *lp;
- while((lp = index(s, '.')) || (lp = index(s, '/')))
+ while((lp = strchr(s, '.')) || (lp = strchr(s, '/')))
*lp = '_';
}
mtmp->mspeed = MFAST;
break;
case WAN_UNDEAD_TURNING:
- if(index(UNDEAD,mtmp->data->mlet)) {
+ if(strchr(UNDEAD,mtmp->data->mlet)) {
mtmp->mhp -= rnd(8);
if(mtmp->mhp < 1) killed(mtmp);
else mtmp->mflee = 1;
break;
case -1: /* Dragon blazing fire */
case 1: /* fire */
- if(index("Dg", mon->data->mlet)) break;
+ if(strchr("Dg", mon->data->mlet)) break;
tmp = d(6,6);
- if(index("YF", mon->data->mlet)) tmp += 7;
+ if(strchr("YF", mon->data->mlet)) tmp += 7;
break;
case 2: /* sleep*/
mon->mfroz = 1;
break;
case 3: /* cold */
- if(index("YFgf", mon->data->mlet)) break;
+ if(strchr("YFgf", mon->data->mlet)) break;
tmp = d(6,6);
if(mon->data->mlet == 'D') tmp += 7;
break;
case 4: /* death*/
- if(index(UNDEAD, mon->data->mlet)) break;
+ if(strchr(UNDEAD, mon->data->mlet)) break;
tmp = mon->mhp+1;
break;
}
bp = Guessed;
while (bp < &Guessed[26])
*bp++ = FALSE;
- while (Errors < MAXERRS && index(Known, '-') != NULL) {
+ while (Errors < MAXERRS && strchr(Known, '-') != NULL) {
prword();
prdata();
prman();
* If the word starts with a vowel, append "way". Don't treat 'y'
* as a vowel if it appears first.
*/
- if (index("aeiouAEIOU", buf[0]) != NULL) {
+ if (strchr("aeiouAEIOU", buf[0]) != NULL) {
(void)printf("%.*sway", len, buf);
return;
}
* isn't treated as a vowel.
*/
for (start = 0, olen = len;
- !index("aeiouyAEIOUY", buf[start]) && start < olen;) {
+ !strchr("aeiouyAEIOUY", buf[start]) && start < olen;) {
ch = buf[len++] = buf[start++];
if ((ch == 'q' || ch == 'Q') && start < olen &&
(buf[start] == 'u' || buf[start] == 'U'))
else {
Scorefile = av[0];
# ifdef FANCY
- sp = rindex(Scorefile, '/');
+ sp = strrchr(Scorefile, '/');
if (sp == NULL)
sp = Scorefile;
if (strcmp(sp, "pattern_roll") == 0)
(void) srand(getpid());
issetuid = getuid() != geteuid();
- if (p = rindex(*argv, '/'))
+ if (p = strrchr(*argv, '/'))
p++;
else
p = *argv;
-/* $Id: krb_lib.c,v 1.2 1996/09/16 18:48:51 millert Exp $ */
+/* $Id: krb_lib.c,v 1.3 1997/01/17 07:11:52 millert Exp $ */
/*-
* Copyright (C) 1989 by the Massachusetts Institute of Technology
* preceeded by a backslash.
*/
wild = 0;
- if (index(name, '*') || index(name, '?') ||
- index(inst, '*') || index(inst, '?'))
+ if (strchr(name, '*') || strchr(name, '?') ||
+ strchr(inst, '*') || strchr(inst, '?'))
wild = 1;
if (!wild) {
*/
wild = 0;
- if (index(name, '*') || index(name, '?') ||
- index(inst, '*') || index(inst, '?'))
+ if (strchr(name, '*') || strchr(name, '?') ||
+ strchr(inst, '*') || strchr(inst, '?'))
wild = 1;
if (!wild) {
#ifdef NOENCRYPTION
/*
* $Source: /home/cvs/src/kerberosIV/krb/Attic/get_in_tkt.c,v $
- * $Author: tholo $
+ * $Author: millert $
*
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* of Technology.
#ifndef lint
static char rcsid_read_password_c[] =
-"Bones$Header: /home/cvs/src/kerberosIV/krb/Attic/get_in_tkt.c,v 1.2 1996/02/05 10:06:40 tholo Exp $";
+"Bones$Header: /home/cvs/src/kerberosIV/krb/Attic/get_in_tkt.c,v 1.3 1997/01/17 07:11:54 millert Exp $";
#endif /* lint */
#include <des.h>
clearerr(stdin);
continue;
}
- if ((ptr = index(s, '\n')))
+ if ((ptr = strchr(s, '\n')))
*ptr = '\0';
if (verify) {
printf("\nVerifying, please re-enter %s",prompt);
clearerr(stdin);
continue;
}
- if ((ptr = index(key_string, '\n')))
+ if ((ptr = strchr(key_string, '\n')))
*ptr = '\0';
if (strcmp(s,key_string)) {
printf("\n\07\07Mismatch - try again\n");
-/* $OpenBSD: kvm.c,v 1.2 1996/05/26 01:04:39 deraadt Exp $ */
+/* $OpenBSD: kvm.c,v 1.3 1997/01/17 07:11:56 millert Exp $ */
/* $NetBSD: kvm.c,v 1.2 1996/05/13 02:30:22 thorpej Exp $ */
char kversion[_POSIX2_LINE_MAX];
char dbname[MAXPATHLEN];
- if ((cp = rindex(uf, '/')) != 0)
+ if ((cp = strrchr(uf, '/')) != 0)
uf = cp + 1;
(void)snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
-/* $OpenBSD: kvm.c,v 1.4 1996/05/10 12:58:30 deraadt Exp $ */
+/* $OpenBSD: kvm.c,v 1.5 1997/01/17 07:11:59 millert Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#else
-static char *rcsid = "$OpenBSD: kvm.c,v 1.4 1996/05/10 12:58:30 deraadt Exp $";
+static char *rcsid = "$OpenBSD: kvm.c,v 1.5 1997/01/17 07:11:59 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
char kversion[_POSIX2_LINE_MAX];
char dbname[MAXPATHLEN];
- if ((cp = rindex(uf, '/')) != 0)
+ if ((cp = strrchr(uf, '/')) != 0)
uf = cp + 1;
(void)snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
#ifndef lint
/*static char sccsid[] = "from: @(#)getNAME.c 5.4 (Berkeley) 1/20/91";*/
-static char rcsid[] = "$Id: getNAME.c,v 1.2 1997/01/15 23:40:59 millert Exp $";
+static char rcsid[] = "$Id: getNAME.c,v 1.3 1997/01/17 07:12:01 millert Exp $";
#endif /* not lint */
/*
register char *cp, *dp;
char *sp, *sep;
- cp = index(line, '-');
+ cp = strchr(line, '-');
if (cp == 0)
return;
sp = cp + 1;
while (*sp && (*sp == ' ' || *sp == '\t'))
sp++;
for (sep = "", dp = line; dp && *dp; dp = cp, sep = "\n") {
- cp = index(dp, ',');
+ cp = strchr(dp, ',');
if (cp) {
register char *tp;
#ifndef lint
/*static char sccsid[] = "from: @(#)mail.local.c 5.6 (Berkeley) 6/19/91";*/
-static char rcsid[] = "$Id: mail.local.c,v 1.10 1997/01/15 23:41:01 millert Exp $";
+static char rcsid[] = "$Id: mail.local.c,v 1.11 1997/01/17 07:12:03 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
}
/* If message not newline terminated, need an extra. */
- if (!index(line, '\n'))
+ if (!strchr(line, '\n'))
(void)putc('\n', fp);
/* Output a newline; note, empty messages are allowed. */
(void)putc('\n', fp);
#ifndef lint
/*static char sccsid[] = "from: @(#)rexecd.c 5.12 (Berkeley) 2/25/91";*/
-static char rcsid[] = "$Id: rexecd.c,v 1.5 1996/12/22 03:41:16 tholo Exp $";
+static char rcsid[] = "$Id: rexecd.c,v 1.6 1997/01/17 07:12:06 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
strncat(shell, pwd->pw_shell, sizeof(shell)-7);
strncat(username, pwd->pw_name, sizeof(username)-6);
- cp = rindex(pwd->pw_shell, '/');
+ cp = strrchr(pwd->pw_shell, '/');
if (cp)
cp++;
else
#ifndef lint
/* from: static char sccsid[] = "@(#)rlogind.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: rlogind.c,v 1.12 1997/01/15 23:41:02 millert Exp $";
+static char *rcsid = "$Id: rlogind.c,v 1.13 1997/01/17 07:12:08 millert Exp $";
#endif /* not lint */
/*
setup_term(fd)
int fd;
{
- register char *cp = index(term+ENVSIZE, '/');
+ register char *cp = strchr(term+ENVSIZE, '/');
char *speed;
struct termios tt;
if (cp) {
*cp++ = '\0';
speed = cp;
- cp = index(speed, '/');
+ cp = strchr(speed, '/');
if (cp)
*cp++ = '\0';
cfsetspeed(&tt, atoi(speed));
if (cp) {
*cp++ = '\0';
speed = cp;
- cp = index(speed, '/');
+ cp = strchr(speed, '/');
if (cp)
*cp++ = '\0';
tcgetattr(fd, &tt);
}
strcpy(buf, fs->fs_mntops);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
- if (cp = index(opt, '='))
+ if (cp = strchr(opt, '='))
*cp++ = '\0';
if (strcmp(opt, usrname) == 0)
break;
setflags(s)
char *s;
{
- char *p, *index();
+ char *p;
for (; isspace(*s); ++s);
if (*s == '\n' || *s == '\0')
return (0);
- if ((p = index(s, '\n')) != NULL)
+ if ((p = strchr(s, '\n')) != NULL)
*p = '\0';
if (!strcmp(s, "R_CURSOR")) return (R_CURSOR);
if (!strcmp(s, "R_FIRST")) return (R_FIRST);
static BTREEINFO ib;
static HASHINFO ih;
static RECNOINFO rh;
- char *eq, *index();
+ char *eq;
- if ((eq = index(s, '=')) == NULL)
+ if ((eq = strchr(s, '=')) == NULL)
err("%s: illegal structure set statement", s);
*eq++ = '\0';
if (!isdigit(*eq))
struct stat sb;
void *p;
int fd;
- char *np, *index();
+ char *np;
for (; isspace(*name); ++name);
- if ((np = index(name, '\n')) != NULL)
+ if ((np = strchr(name, '\n')) != NULL)
*np = '\0';
if ((fd = open(name, O_RDONLY, 0)) < 0 ||
fstat(fd, &sb))
#if !defined(__SVR4) && !defined(__GNUC__)
#include <strings.h>
#endif
-#if !defined(__SVR4) && defined(__GNUC__)
-extern char *index();
-#endif
#include <sys/types.h>
#include <sys/param.h>
#include <sys/file.h>
#ifndef lint
static char sccsid[] = "@(#)ipf.c 1.23 6/5/96 (C) 1993-1995 Darren Reed";
-static char rcsid[] = "$Id: ipf.c,v 1.7 1996/10/08 07:33:31 niklas Exp $";
+static char rcsid[] = "$Id: ipf.c,v 1.8 1997/01/17 07:12:16 millert Exp $";
#endif
#if SOLARIS
/*
* treat both CR and LF as EOL
*/
- if ((s = index(line, '\n')))
+ if ((s = strchr(line, '\n')))
*s = '\0';
- if ((s = index(line, '\r')))
+ if ((s = strchr(line, '\r')))
*s = '\0';
/*
* # is comment marker, everything after is a ignored
*/
- if ((s = index(line, '#')))
+ if ((s = strchr(line, '#')))
*s = '\0';
if (!*line)
flag = 0;
- if (index(opt, 'p')) {
+ if (strchr(opt, 'p')) {
flag |= FF_LOGPASS;
if (opts & OPT_VERBOSE)
printf("set log flag: pass\n");
}
- if (index(opt, 'm') && (*opt == 'n' || *opt == 'N')) {
+ if (strchr(opt, 'm') && (*opt == 'n' || *opt == 'N')) {
flag |= FF_LOGNOMATCH;
if (opts & OPT_VERBOSE)
printf("set log flag: nomatch\n");
}
- if (index(opt, 'b') || index(opt, 'd')) {
+ if (strchr(opt, 'b') || strchr(opt, 'd')) {
flag |= FF_LOGBLOCK;
if (opts & OPT_VERBOSE)
printf("set log flag: block\n");
#ifndef lint
static char sccsid[] ="@(#)parse.c 1.44 6/5/96 (C) 1993-1996 Darren Reed";
-static char rcsid[] = "$Id: parse.c,v 1.7 1996/10/08 07:33:32 niklas Exp $";
+static char rcsid[] = "$Id: parse.c,v 1.8 1997/01/17 07:12:18 millert Exp $";
#endif
extern struct ipopt_names ionames[], secclass[];
int r = 0;
char *s;
- s = index(to, ':');
+ s = strchr(to, ':');
fdp->fd_ifp = NULL;
if (s) {
*s++ = '\0';
/*
* is it possibly hostname/num ?
*/
- if ((s = index(**seg, '/'))) {
+ if ((s = strchr(**seg, '/'))) {
*s++ = '\0';
if (!isdigit(*s))
return -1;
- if (index(s, '.'))
+ if (strchr(s, '.'))
*msk = inet_addr(s);
- if (!index(s, '.') && !index(s, 'x')) {
+ if (!strchr(s, '.') && !strchr(s, 'x')) {
/*
* set x most significant bits
*/
fp = &tcpfm;
continue;
}
- if (!(t = index(flagset, *s))) {
+ if (!(t = strchr(flagset, *s))) {
(void)fprintf(stderr, "unknown flag (%c)\n", *s);
return 0;
}
-/* $OpenBSD: reboot.c,v 1.5 1997/01/15 23:41:38 millert Exp $ */
+/* $OpenBSD: reboot.c,v 1.6 1997/01/17 07:12:20 millert Exp $ */
/* $NetBSD: reboot.c,v 1.8 1995/10/05 05:36:22 mycroft Exp $ */
/*
#if 0
static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: reboot.c,v 1.5 1997/01/15 23:41:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: reboot.c,v 1.6 1997/01/17 07:12:20 millert Exp $";
#endif
#endif /* not lint */
char *p, *user;
/* Get our name */
- p = rindex(*argv, '/');
+ p = strrchr(*argv, '/');
if(p == NULL) p = *argv;
else p++;
-/* $OpenBSD: parms.c,v 1.3 1996/10/02 06:51:45 mickey Exp $ */
+/* $OpenBSD: parms.c,v 1.4 1997/01/17 07:12:22 millert Exp $ */
/*
* Copyright (c) 1983, 1993
/* Detect and separate "1.2.3.4/24"
*/
- if (0 != (mname = rindex(name,'/'))) {
+ if (0 != (mname = strrchr(name,'/'))) {
i = (int)(mname - name);
if (i > sizeof(hname)-1) /* name too long */
return 0;
-/* $OpenBSD: rtquery.c,v 1.4 1997/01/15 23:41:11 millert Exp $ */
+/* $OpenBSD: rtquery.c,v 1.5 1997/01/17 07:12:25 millert Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
/* Detect and separate "1.2.3.4/24"
*/
- if (0 != (mname = rindex(name,'/'))) {
+ if (0 != (mname = strrchr(name,'/'))) {
i = (int)(mname - name);
if (i > sizeof(hname)-1) /* name too long */
return 0;
-/* $OpenBSD: binpatch.c,v 1.3 1997/01/15 23:41:49 millert Exp $ */
+/* $OpenBSD: binpatch.c,v 1.4 1997/01/17 07:12:27 millert Exp $ */
/* $NetBSD: binpatch.c,v 1.6 1995/08/18 15:28:28 chopps Exp $ */
/* Author: Markus Wild mw@eunet.ch ??? */
*/
static u_long FindAssign(char *symbol,u_long *rvalue)
{
- char *ce = rindex(symbol,'='); /* Assign symbol some number */
+ char *ce = strrchr(symbol,'='); /* Assign symbol some number */
char *cn = ce + 1; /* This should point at some number, no spaces allowed */
u_long dr = 0; /* flag for do_replace */
if (ce)
-/* $OpenBSD: compress.c,v 1.3 1997/01/15 23:42:22 millert Exp $ */
+/* $OpenBSD: compress.c,v 1.4 1997/01/17 07:12:29 millert Exp $ */
/* $NetBSD: compress.c,v 1.9 1995/03/26 09:44:38 glass Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)compress.c 8.2 (Berkeley) 1/7/94";
#else
-static char rcsid[] = "$OpenBSD: compress.c,v 1.3 1997/01/15 23:42:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: compress.c,v 1.4 1997/01/17 07:12:29 millert Exp $";
#endif
#endif /* not lint */
int bits, cat, ch;
char *p, newname[MAXPATHLEN];
- if ((p = rindex(argv[0], '/')) == NULL)
+ if ((p = strrchr(argv[0], '/')) == NULL)
p = argv[0];
else
++p;
compress(*argv, "/dev/stdout", bits);
break;
}
- if ((p = rindex(*argv, '.')) != NULL &&
+ if ((p = strrchr(*argv, '.')) != NULL &&
!strcmp(p, ".Z")) {
cwarnx("%s: name already has trailing .Z",
*argv);
break;
case DECOMPRESS:
len = strlen(*argv);
- if ((p = rindex(*argv, '.')) == NULL ||
+ if ((p = strrchr(*argv, '.')) == NULL ||
strcmp(p, ".Z")) {
if (len > sizeof(newname) - 3) {
cwarnx("%s: name too long", *argv);
-/* $OpenBSD: finger.c,v 1.5 1997/01/15 23:42:28 millert Exp $ */
+/* $OpenBSD: finger.c,v 1.6 1997/01/17 07:12:31 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/
-static char rcsid[] = "$OpenBSD: finger.c,v 1.5 1997/01/15 23:42:28 millert Exp $";
+static char rcsid[] = "$OpenBSD: finger.c,v 1.6 1997/01/17 07:12:31 millert Exp $";
#endif /* not lint */
/*
struct utmp user;
struct passwd *pw;
int dolocal, *used;
- char *index();
if (!(used = (int *)calloc((u_int)argc, (u_int)sizeof(int)))) {
(void)fprintf(stderr, "finger: out of space.\n");
/* pull out all network requests */
for (i = 0, dolocal = 0, nettail = &nethead; i < argc; i++) {
- if (!index(argv[i], '@')) {
+ if (!strchr(argv[i], '@')) {
dolocal = 1;
continue;
}
-/* $OpenBSD: net.c,v 1.2 1996/06/26 05:33:18 deraadt Exp $ */
+/* $OpenBSD: net.c,v 1.3 1997/01/17 07:12:33 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)net.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: net.c,v 1.2 1996/06/26 05:33:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: net.c,v 1.3 1997/01/17 07:12:33 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
struct servent *sp;
struct sockaddr_in sin;
int s;
- char *alist[1], *host, *rindex();
+ char *alist[1], *host;
- if (!(host = rindex(name, '@')))
+ if (!(host = strrchr(name, '@')))
return;
*host++ = NULL;
if (inet_aton(host, &sin.sin_addr) == 0) {
-/* $OpenBSD: fmt.c,v 1.2 1996/06/26 05:33:21 deraadt Exp $ */
+/* $OpenBSD: fmt.c,v 1.3 1997/01/17 07:12:35 millert Exp $ */
/* $NetBSD: fmt.c,v 1.4 1995/09/01 01:29:41 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)fmt.c 8.1 (Berkeley) 7/20/93";
#endif
-static char rcsid[] = "$OpenBSD: fmt.c,v 1.2 1996/06/26 05:33:21 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: fmt.c,v 1.3 1997/01/17 07:12:35 millert Exp $";
#endif /* not lint */
#include <stdio.h>
*/
if (*cp == '\0') {
*cp2++ = ' ';
- if (index(".:!", cp[-1]))
+ if (strchr(".:!", cp[-1]))
*cp2++ = ' ';
}
while (*cp == ' ')
-/* $OpenBSD: display.c,v 1.3 1996/06/26 05:34:17 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.4 1997/01/17 07:12:37 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)display.c 5.11 (Berkeley) 3/9/91";*/
-static char rcsid[] = "$OpenBSD: display.c,v 1.3 1996/06/26 05:34:17 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: display.c,v 1.4 1997/01/17 07:12:37 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
pr->flags = F_BPAD;
*pr->cchar = 's';
for (p1 = pr->fmt; *p1 != '%'; ++p1);
- for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
+ for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
while (*p2++ = *p1++);
}
-/* $OpenBSD: parse.c,v 1.2 1996/06/26 05:34:21 deraadt Exp $ */
+/* $OpenBSD: parse.c,v 1.3 1997/01/17 07:12:39 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)parse.c 5.6 (Berkeley) 3/9/91";*/
-static char rcsid[] = "$OpenBSD: parse.c,v 1.2 1996/06/26 05:34:21 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.3 1997/01/17 07:12:39 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
exit(1);
}
while (fgets(buf, sizeof(buf), fp)) {
- if (!(p = index(buf, '\n'))) {
+ if (!(p = strchr(buf, '\n'))) {
(void)fprintf(stderr, "hexdump: line too long.\n");
while ((ch = getchar()) != '\n' && ch != EOF);
continue;
* skip any special chars -- save precision in
* case it's a %s format.
*/
- while (index(spec + 1, *++fmt));
+ while (strchr(spec + 1, *++fmt));
if (*fmt == '.' && isdigit(*++fmt)) {
prec = atoi(fmt);
while (isdigit(*++fmt));
if (fu->bcnt) {
sokay = USEBCNT;
/* skip to conversion character */
- for (++p1; index(spec, *p1); ++p1);
+ for (++p1; strchr(spec, *p1); ++p1);
} else {
/* skip any special chars, field width */
- while (index(spec + 1, *++p1));
+ while (strchr(spec + 1, *++p1));
if (*p1 == '.' && isdigit(*++p1)) {
sokay = USEPREC;
prec = atoi(p1);
-/* $OpenBSD: fastfind.c,v 1.3 1996/10/20 00:52:54 michaels Exp $ */
+/* $OpenBSD: fastfind.c,v 1.4 1997/01/17 07:12:41 millert Exp $ */
/*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fastfind.c,v 1.3 1996/10/20 00:52:54 michaels Exp $
+ * $Id: fastfind.c,v 1.4 1997/01/17 07:12:41 millert Exp $
*/
#ifndef _LOCATE_STATISTIC_
/* find optimal (last) char for searching */
for (p = pathpart; *p != '\0'; p++)
- if (index(LOCATE_REG, *p) != NULL)
+ if (strchr(LOCATE_REG, *p) != NULL)
break;
if (*p == '\0')
-/* $OpenBSD: util.c,v 1.2 1996/10/10 09:55:08 michaels Exp $
+/* $OpenBSD: util.c,v 1.3 1997/01/17 07:12:42 millert Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: util.c,v 1.2 1996/10/10 09:55:08 michaels Exp $
+ * $Id: util.c,v 1.3 1997/01/17 07:12:42 millert Exp $
*/
/* skip trailing metacharacters */
for (; p >= name; p--)
- if (index(LOCATE_REG, *p) == NULL)
+ if (strchr(LOCATE_REG, *p) == NULL)
break;
/*
* |----< p
*/
if (p >= name &&
- (index(p, '[') != NULL || index(p, ']') != NULL)) {
+ (strchr(p, '[') != NULL || strchr(p, ']') != NULL)) {
for (p = name; *p != '\0'; p++)
if (*p == ']' || *p == '[')
break;
* '*\*[a-z]'
* |-------< p
*/
- if (p >= name && index(LOCATE_REG, *p) != NULL)
+ if (p >= name && strchr(LOCATE_REG, *p) != NULL)
p = name - 1;
}
else {
for (endmark = p; p >= name; p--)
- if (index(LOCATE_REG, *p) != NULL)
+ if (strchr(LOCATE_REG, *p) != NULL)
break;
for (++p;
(p <= endmark) && subp < (globfree + sizeof(globfree));)
-/* $OpenBSD: aux.c,v 1.2 1996/06/11 12:53:32 deraadt Exp $ */
+/* $OpenBSD: aux.c,v 1.3 1997/01/17 07:12:44 millert Exp $ */
/* $NetBSD: aux.c,v 1.4 1996/06/08 19:48:10 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: aux.c,v 1.2 1996/06/11 12:53:32 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: aux.c,v 1.3 1997/01/17 07:12:44 millert Exp $";
#endif
#endif /* not lint */
cp = skin(name1(mp, reptype));
if (reptype != 0 || charcount(cp, '!') < 2)
return(cp);
- cp2 = rindex(cp, '!');
+ cp2 = strrchr(cp, '!');
cp2--;
while (cp2 > cp && *cp2 != '!')
cp2--;
if (name == NOSTR)
return(NOSTR);
- if (index(name, '(') == NOSTR && index(name, '<') == NOSTR
- && index(name, ' ') == NOSTR)
+ if (strchr(name, '(') == NOSTR && strchr(name, '<') == NOSTR
+ && strchr(name, ' ') == NOSTR)
return(name);
gotlt = 0;
lastsp = 0;
*cp2 = '\0';
if (readline(ibuf, linebuf, LINESIZE) < 0)
return(savestr(namebuf));
- if ((cp = index(linebuf, 'F')) == NULL)
+ if ((cp = strchr(linebuf, 'F')) == NULL)
return(savestr(namebuf));
if (strncmp(cp, "From", 4) != 0)
return(savestr(namebuf));
- while ((cp = index(cp, 'r')) != NULL) {
+ while ((cp = strchr(cp, 'r')) != NULL) {
if (strncmp(cp, "remote", 6) == 0) {
- if ((cp = index(cp, 'f')) == NULL)
+ if ((cp = strchr(cp, 'f')) == NULL)
break;
if (strncmp(cp, "from", 4) != 0)
break;
- if ((cp = index(cp, ' ')) == NULL)
+ if ((cp = strchr(cp, ' ')) == NULL)
break;
cp++;
if (first) {
strcpy(namebuf, cp);
first = 0;
} else
- strcpy(rindex(namebuf, '!')+1, cp);
+ strcpy(strrchr(namebuf, '!')+1, cp);
strcat(namebuf, "!");
goto newname;
}
{
while (*s1)
- if (index(s2, *s1++))
+ if (strchr(s2, *s1++))
return 1;
return 0;
}
-/* $OpenBSD: fio.c,v 1.2 1996/06/11 12:53:39 deraadt Exp $ */
+/* $OpenBSD: fio.c,v 1.3 1997/01/17 07:12:46 millert Exp $ */
/* $NetBSD: fio.c,v 1.5 1996/06/08 19:48:22 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)fio.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: fio.c,v 1.2 1996/06/11 12:53:39 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: fio.c,v 1.3 1997/01/17 07:12:46 millert Exp $";
#endif
#endif /* not lint */
for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
;
cp[1] = '\0';
- if (index(xname, ' ') && stat(xname, &sbuf) < 0) {
+ if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) {
fprintf(stderr, "\"%s\": Ambiguous.\n", name);
return NOSTR;
}
-/* $OpenBSD: lex.c,v 1.3 1996/06/11 12:53:42 deraadt Exp $ */
+/* $OpenBSD: lex.c,v 1.4 1997/01/17 07:12:47 millert Exp $ */
/* $NetBSD: lex.c,v 1.7 1996/06/08 19:48:28 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lex.c,v 1.3 1996/06/11 12:53:42 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lex.c,v 1.4 1997/01/17 07:12:47 millert Exp $";
#endif
#endif /* not lint */
return(0);
}
cp2 = word;
- while (*cp && index(" \t0123456789$^.:/-+*'\"", *cp) == NOSTR)
+ while (*cp && strchr(" \t0123456789$^.:/-+*'\"", *cp) == NOSTR)
*cp2++ = *cp++;
*cp2 = '\0';
-/* $OpenBSD: list.c,v 1.2 1996/06/11 12:53:43 deraadt Exp $ */
+/* $OpenBSD: list.c,v 1.3 1997/01/17 07:12:49 millert Exp $ */
/* $NetBSD: list.c,v 1.4 1996/06/08 19:48:30 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)list.c 8.2 (Berkeley) 4/19/94";
#else
-static char rcsid[] = "$OpenBSD: list.c,v 1.2 1996/06/11 12:53:43 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: list.c,v 1.3 1997/01/17 07:12:49 millert Exp $";
#endif
#endif /* not lint */
* Now look, ignoring case, for the word in the string.
*/
- if (value("searchheaders") && (cp = index(str, ':'))) {
+ if (value("searchheaders") && (cp = strchr(str, ':'))) {
*cp++ = '\0';
cp2 = hfield(str, mp);
cp[-1] = ':';
-/* $OpenBSD: names.c,v 1.2 1996/06/11 12:53:45 deraadt Exp $ */
+/* $OpenBSD: names.c,v 1.3 1997/01/17 07:12:50 millert Exp $ */
/* $NetBSD: names.c,v 1.5 1996/06/08 19:48:32 christos Exp $ */
/*
#if 0
static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: names.c,v 1.2 1996/06/11 12:53:45 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: names.c,v 1.3 1997/01/17 07:12:50 millert Exp $";
#endif
#endif /* not lint */
for (cp2 = wbuf; *cp && (*cp2++ = *cp++) != '>';)
;
else
- for (cp2 = wbuf; *cp && !index(" \t,(", *cp); *cp2++ = *cp++)
+ for (cp2 = wbuf; *cp && !strchr(" \t,(", *cp); *cp2++ = *cp++)
;
*cp2 = '\0';
return cp;
-/* $OpenBSD: more.c,v 1.6 1996/10/14 15:23:54 etheisen Exp $ */
+/* $OpenBSD: more.c,v 1.7 1997/01/17 07:12:53 millert Exp $ */
/*-
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
if (nfiles > 1)
prnames++;
if (!no_intty && nfiles == 0) {
- char *rindex();
-
- p = rindex(argv[0], '/');
+ p = strrchr(argv[0], '/');
fputs("usage: ",stderr);
fputs(p ? p + 1 : argv[0],stderr);
fputs(" [-dfln] [+linenum | +/pattern] name1 name2 ...\n",stderr);
-/* $OpenBSD: if.c,v 1.9 1996/08/16 09:38:56 mickey Exp $ */
+/* $OpenBSD: if.c,v 1.10 1997/01/17 07:12:55 millert Exp $ */
/* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */
/*
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
-static char *rcsid = "$OpenBSD: if.c,v 1.9 1996/08/16 09:38:56 mickey Exp $";
+static char *rcsid = "$OpenBSD: if.c,v 1.10 1997/01/17 07:12:55 millert Exp $";
#endif
#endif /* not lint */
ifnetaddr = (u_long)ifnet.if_list.tqe_next;
if (interface != 0 && strcmp(name, interface) != 0)
continue;
- cp = index(name, '\0');
+ cp = strchr(name, '\0');
if ((ifnet.if_flags & IFF_UP) == 0)
*cp++ = '*';
*cp = '\0';
-/* $OpenBSD: inet.c,v 1.3 1996/06/26 05:37:21 deraadt Exp $ */
+/* $OpenBSD: inet.c,v 1.4 1997/01/17 07:12:57 millert Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: inet.c,v 1.3 1996/06/26 05:37:21 deraadt Exp $";
+static char *rcsid = "$OpenBSD: inet.c,v 1.4 1997/01/17 07:12:57 millert Exp $";
#endif
#endif /* not lint */
int width;
sprintf(line, "%.*s.", (Aflag && !nflag) ? 12 : 16, inetname(in));
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!nflag && port)
sp = getservbyport((int)port, proto);
if (sp || port == 0)
if (first && !nflag) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
if (cp == 0) {
hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
-/* $OpenBSD: iso.c,v 1.2 1996/06/26 05:37:21 deraadt Exp $ */
+/* $OpenBSD: iso.c,v 1.3 1997/01/17 07:12:58 millert Exp $ */
/* $NetBSD: iso.c,v 1.12 1995/10/03 21:42:38 thorpej Exp $ */
/*
#if 0
static char sccsid[] = "from: @(#)iso.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: iso.c,v 1.2 1996/06/26 05:37:21 deraadt Exp $";
+static char *rcsid = "$OpenBSD: iso.c,v 1.3 1997/01/17 07:12:58 millert Exp $";
#endif
#endif /* not lint */
int Alen = Aflag?18:22;
line = isonetname(iso);
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
ihe = (struct iso_hostent *)0;
if( islocal )
-/* $OpenBSD: route.c,v 1.6 1996/10/25 10:50:52 deraadt Exp $ */
+/* $OpenBSD: route.c,v 1.7 1997/01/17 07:13:00 millert Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: route.c,v 1.6 1996/10/25 10:50:52 deraadt Exp $";
+static char *rcsid = "$OpenBSD: route.c,v 1.7 1997/01/17 07:13:00 millert Exp $";
#endif
#endif /* not lint */
if (first) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
AF_INET);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
-/* $OpenBSD: paste.c,v 1.3 1997/01/15 23:43:02 millert Exp $ */
+/* $OpenBSD: paste.c,v 1.4 1997/01/17 07:13:02 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)paste.c 5.7 (Berkeley) 10/30/90";*/
-static char rcsid[] = "$OpenBSD: paste.c,v 1.3 1997/01/15 23:43:02 millert Exp $";
+static char rcsid[] = "$OpenBSD: paste.c,v 1.4 1997/01/17 07:13:02 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
putchar(ch);
continue;
}
- if (!(p = index(buf, '\n'))) {
+ if (!(p = strchr(buf, '\n'))) {
(void)fprintf(stderr,
"paste: %s: input line too long.\n",
lp->name);
}
if (fgets(buf, sizeof(buf), fp)) {
for (cnt = 0, dp = delim;;) {
- if (!(p = index(buf, '\n'))) {
+ if (!(p = strchr(buf, '\n'))) {
(void)fprintf(stderr,
"paste: %s: input line too long.\n",
*argv);
-/* $OpenBSD: patch.c,v 1.8 1996/09/24 04:19:28 millert Exp $ */
+/* $OpenBSD: patch.c,v 1.9 1997/01/17 07:13:04 millert Exp $ */
/* patch - a program to apply diffs to original files
*
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: patch.c,v 1.8 1996/09/24 04:19:28 millert Exp $";
+static char rcsid[] = "$OpenBSD: patch.c,v 1.9 1997/01/17 07:13:04 millert Exp $";
#endif /* not lint */
#include "INTERN.h"
Strcpy(rejname, outname);
#ifndef FLEXFILENAMES
{
- char *s = rindex(rejname,'/');
+ char *s = strrchr(rejname,'/');
if (!s)
s = rejname;
-/* $OpenBSD: printf.c,v 1.2 1996/06/26 05:37:59 deraadt Exp $ */
+/* $OpenBSD: printf.c,v 1.3 1997/01/17 07:13:06 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)printf.c 5.9 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: printf.c,v 1.2 1996/06/26 05:37:59 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: printf.c,v 1.3 1997/01/17 07:13:06 millert Exp $";
#endif /* not lint */
#include <ctype.h>
}
/* skip to field width */
- for (; index(SKIP1, *fmt); ++fmt) ;
+ for (; strchr(SKIP1, *fmt); ++fmt) ;
fieldwidth = *fmt == '*' ? getint() : 0;
/* skip to possible '.', get following precision */
- for (; index(SKIP2, *fmt); ++fmt) ;
+ for (; strchr(SKIP2, *fmt); ++fmt) ;
if (*fmt == '.')
++fmt;
precision = *fmt == '*' ? getint() : 0;
- for (; index(SKIP2, *fmt); ++fmt) ;
+ for (; strchr(SKIP2, *fmt); ++fmt) ;
if (!*fmt) {
warnx ("missing format character");
return(1);
if (!*gargv)
return(0);
- if (index(number, **gargv))
+ if (strchr(number, **gargv))
return(atoi(*gargv++));
return 0;
-/* $OpenBSD: quota.c,v 1.8 1996/10/28 04:08:21 millert Exp $ */
+/* $OpenBSD: quota.c,v 1.9 1997/01/17 07:13:08 millert Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
#ifndef lint
/*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: quota.c,v 1.8 1996/10/28 04:08:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: quota.c,v 1.9 1997/01/17 07:13:08 millert Exp $";
#endif /* not lint */
/*
}
strncpy(buf, fs->fs_mntops, sizeof buf);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
- if (cp = index(opt, '='))
+ if (cp = strchr(opt, '='))
*cp++ = '\0';
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
break;
-/* $OpenBSD: misc.c,v 1.2 1996/06/26 05:38:04 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.3 1997/01/17 07:13:11 millert Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
#ifndef lint
/*static char sccsid[] = "from: @(#)misc.c 5.2 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: misc.c,v 1.2 1996/06/26 05:38:04 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1997/01/17 07:13:11 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
{
register char *ind;
- return((ind = rindex(path, '/')) ? ind + 1 : path);
+ return((ind = strrchr(path, '/')) ? ind + 1 : path);
}
badfmt()
-/* $OpenBSD: rlogin.c,v 1.11 1997/01/15 23:43:06 millert Exp $ */
+/* $OpenBSD: rlogin.c,v 1.12 1997/01/17 07:13:13 millert Exp $ */
/* $NetBSD: rlogin.c,v 1.8 1995/10/05 09:07:22 mycroft Exp $ */
/*
#if 0
static char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: rlogin.c,v 1.11 1997/01/15 23:43:06 millert Exp $";
+static char rcsid[] = "$OpenBSD: rlogin.c,v 1.12 1997/01/17 07:13:13 millert Exp $";
#endif
#endif /* not lint */
one = 1;
host = user = NULL;
- if (p = rindex(argv[0], '/'))
+ if (p = strrchr(argv[0], '/'))
++p;
else
p = argv[0];
-/* $OpenBSD: rusers.c,v 1.4 1996/08/16 22:24:18 deraadt Exp $ */
+/* $OpenBSD: rusers.c,v 1.5 1997/01/17 07:13:15 millert Exp $ */
/*-
* Copyright (c) 1993 John Brezak
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: rusers.c,v 1.4 1996/08/16 22:24:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rusers.c,v 1.5 1997/01/17 07:13:15 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
int ch;
extern int optind;
- if (!(argv0 = rindex(argv[0], '/')))
+ if (!(argv0 = strrchr(argv[0], '/')))
argv0 = argv[0];
else
argv0++;
-/* $OpenBSD: ci.c,v 1.2 1996/06/26 05:39:38 deraadt Exp $ */
+/* $OpenBSD: ci.c,v 1.3 1997/01/17 07:13:18 millert Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
#include <ci.h>
#include <del.h>
-char *index(),*getenv(),*rindex();
+char *getenv();
extern char _argbreak;
long atol();
double atof();
/* check for redirection of output */
if (!ciexit) {
- outname = rindex (p,'>');
+ outname = strrchr (p,'>');
if (outname) {
if (outname == p || *(outname+1) == 0
|| ((*(outname-1) != ' ') && (*(outname-1) != '\t'))) {
break;
default: /* list cmds, etc. */
- equals = index (cmd,'=');
+ equals = strchr (cmd,'=');
if (equals == cmd) cmd++;
if (equals) {
*equals = '='; /* if user doesn't want extra =, kill */
equals = 0;
}
- star = index (cmd,'*');
+ star = strchr (cmd,'*');
if (star) *star = 0;
if (star && equals) { /* list vars */
printf ("\n");
}
}
else { /* chop at * */
- star = index (topic,'*');
+ star = strchr (topic,'*');
if (star) *star = 0;
}
eptr->ci_ufloat = atof (arg);
break;
case ci_tbool:
- eptr->ci_ubool = (index("yYtT",*arg) != 0);
+ eptr->ci_ubool = (strchr("yYtT",*arg) != 0);
break;
case ci_tcint:
*(eptr->ci_ucint.ci_ival) =
-/* $OpenBSD: expand.c,v 1.2 1996/06/26 05:39:40 deraadt Exp $ */
+/* $OpenBSD: expand.c,v 1.3 1997/01/17 07:13:20 millert Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
while (*pathp) pathp++;
}
}
- while (*cs == 0 || index(globchars, *cs) == 0) {
+ while (*cs == 0 || strchr(globchars, *cs) == 0) {
if (*cs == 0) {
if (lstat(path, &stb) >= 0) addone(path, "");
goto endit;
-/* $OpenBSD: stree.c,v 1.2 1996/06/26 05:39:48 deraadt Exp $ */
+/* $OpenBSD: stree.c,v 1.3 1997/01/17 07:13:21 millert Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
**********************************************************************
* HISTORY
* $Log: stree.c,v $
+ * Revision 1.3 1997/01/17 07:13:21 millert
+ * r?index -> strr?chr
+ *
* Revision 1.2 1996/06/26 05:39:48 deraadt
* rcsid
*
return (x);
(void) strncpy(buf, p, sizeof(buf)-1);
buf[MAXPATHLEN] = '\0';
- while ((p = rindex(buf, '/')) != NULL) {
+ while ((p = strrchr(buf, '/')) != NULL) {
while (p >= buf && *(p-1) == '/')
p--;
if (p == buf)
-/* $OpenBSD: disks.c,v 1.5 1996/06/26 05:40:05 deraadt Exp $ */
+/* $OpenBSD: disks.c,v 1.6 1997/01/17 07:13:23 millert Exp $ */
/* $NetBSD: disks.c,v 1.4 1996/05/10 23:16:33 thorpej Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: disks.c,v 1.5 1996/06/26 05:40:05 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: disks.c,v 1.6 1997/01/17 07:13:23 millert Exp $";
#endif /* not lint */
#include "systat.h"
{
register char *cp;
register int i;
- char *index();
- cp = index(args, '\n');
+ cp = strchr(args, '\n');
if (cp)
*cp = '\0';
for (;;) {
-/* $OpenBSD: netcmds.c,v 1.2 1996/06/26 05:40:09 deraadt Exp $ */
+/* $OpenBSD: netcmds.c,v 1.3 1997/01/17 07:13:25 millert Exp $ */
/* $NetBSD: netcmds.c,v 1.4 1995/05/21 17:14:38 mycroft Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: netcmds.c,v 1.2 1996/06/26 05:40:09 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: netcmds.c,v 1.3 1997/01/17 07:13:25 millert Exp $";
#endif /* not lint */
/*
struct servent *sp;
struct hostent *hp;
struct in_addr in;
- char *index();
- cp = index(args, '\n');
+ cp = strchr(args, '\n');
if (cp)
*cp = '\0';
for (;;args = cp) {
-/* $OpenBSD: netstat.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $ */
+/* $OpenBSD: netstat.c,v 1.6 1997/01/17 07:13:26 millert Exp $ */
/* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: netstat.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: netstat.c,v 1.6 1997/01/17 07:13:26 millert Exp $";
#endif /* not lint */
/*
char *proto;
{
struct servent *sp = 0;
- char line[80], *cp, *index();
+ char line[80], *cp;
sprintf(line, "%.*s.", 16, inetname(*in));
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
if (!nflag && port)
sp = getservbyport(port, proto);
if (sp || port == 0)
else
sprintf(cp, "%d", ntohs((u_short)port));
/* pad to full column to clear any garbage */
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
while (cp - line < 22)
*cp++ = ' ';
*cp = '\0';
-/* $OpenBSD: get_names.c,v 1.2 1996/06/26 05:40:22 deraadt Exp $ */
+/* $OpenBSD: get_names.c,v 1.3 1997/01/17 07:13:28 millert Exp $ */
/* $NetBSD: get_names.c,v 1.4 1994/12/09 02:14:16 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)get_names.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: get_names.c,v 1.2 1996/06/26 05:40:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: get_names.c,v 1.3 1997/01/17 07:13:28 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
char *getlogin();
char *ttyname();
-char *rindex();
extern CTL_MSG msg;
/*
my_machine_name = hostname;
/* check for, and strip out, the machine name of the target */
names = strdup(argv[1]);
- for (cp = names; *cp && !index("@:!.", *cp); cp++)
+ for (cp = names; *cp && !strchr("@:!.", *cp); cp++)
;
if (*cp == '\0') {
/* this is a local to local talk */
-/* $OpenBSD: main.c,v 1.3 1996/08/16 23:31:00 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.4 1997/01/17 07:13:30 millert Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: main.c,v 1.3 1996/08/16 23:31:00 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.4 1997/01/17 07:13:30 millert Exp $";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
struct cmd *getcmd();
char *tail();
-char *index();
-char *rindex();
int
main(argc, argv)
return;
}
targ = argv[argc - 1];
- if (index(argv[argc - 1], ':')) {
+ if (strchr(argv[argc - 1], ':')) {
char *cp;
struct hostent *hp;
for (n = 1; n < argc - 1; n++)
- if (index(argv[n], ':')) {
+ if (strchr(argv[n], ':')) {
putusage(argv[0]);
return;
}
cp = argv[argc - 1];
- targ = index(cp, ':');
+ targ = strchr(cp, ':');
*targ++ = 0;
hp = gethostbyname(cp);
if (hp == NULL) {
}
/* this assumes the target is a directory */
/* on a remote unix system. hmmmm. */
- cp = index(targ, '\0');
+ cp = strchr(targ, '\0');
*cp++ = '/';
for (n = 1; n < argc - 1; n++) {
strcpy(cp, tail(argv[n]));
}
if (!connected) {
for (n = 1; n < argc ; n++)
- if (index(argv[n], ':') == 0) {
+ if (strchr(argv[n], ':') == 0) {
getusage(argv[0]);
return;
}
}
for (n = 1; n < argc ; n++) {
- src = index(argv[n], ':');
+ src = strchr(argv[n], ':');
if (src == NULL)
src = argv[n];
else {
register char *s;
while (*filename) {
- s = rindex(filename, '/');
+ s = strrchr(filename, '/');
if (s == NULL)
break;
if (s[1])
-/* $OpenBSD: tftp.c,v 1.2 1996/06/26 05:40:35 deraadt Exp $ */
+/* $OpenBSD: tftp.c,v 1.3 1997/01/17 07:13:32 millert Exp $ */
/* $NetBSD: tftp.c,v 1.5 1995/04/29 05:55:25 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: tftp.c,v 1.2 1996/06/26 05:40:35 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tftp.c,v 1.3 1997/01/17 07:13:32 millert Exp $";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
{ "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR" };
register char *cp, *file;
u_short op = ntohs(tp->th_opcode);
- char *index();
if (op < RRQ || op > ERROR)
printf("%s opcode=%x ", s, op);
case WRQ:
n -= 2;
file = cp = tp->th_stuff;
- cp = index(cp, '\0');
+ cp = strchr(cp, '\0');
printf("<file=%s, mode=%s>\n", file, cp + 1);
break;
-/* $OpenBSD: courier.c,v 1.3 1996/06/26 05:40:52 deraadt Exp $ */
+/* $OpenBSD: courier.c,v 1.4 1997/01/17 07:13:34 millert Exp $ */
/* $NetBSD: courier.c,v 1.5 1995/10/29 00:49:50 pk Exp $ */
/*
#if 0
static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: courier.c,v 1.3 1996/06/26 05:40:52 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: courier.c,v 1.4 1997/01/17 07:13:34 millert Exp $";
#endif /* not lint */
/*
buf[len] = '\0';
printf("coursync: (\"%s\")\n\r", buf);
#endif
- if (index(buf, '0') ||
- (index(buf, 'O') && index(buf, 'K')))
+ if (strchr(buf, '0') ||
+ (strchr(buf, 'O') && strchr(buf, 'K')))
return(1);
}
/*
-/* $OpenBSD: hayes.c,v 1.4 1996/11/03 18:33:02 millert Exp $ */
+/* $OpenBSD: hayes.c,v 1.5 1997/01/17 07:13:36 millert Exp $ */
/* $NetBSD: hayes.c,v 1.5 1996/11/01 23:56:33 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: hayes.c,v 1.4 1996/11/03 18:33:02 millert Exp $";
+static char rcsid[] = "$OpenBSD: hayes.c,v 1.5 1997/01/17 07:13:36 millert Exp $";
#endif /* not lint */
/*
ioctl(FD, FIONREAD, &len);
if (len) {
len = read(FD, dumbuf, min(len, DUMBUFLEN));
- if (index(dumbuf, '0') ||
- (index(dumbuf, 'O') && index(dumbuf, 'K')))
+ if (strchr(dumbuf, '0') ||
+ (strchr(dumbuf, 'O') && strchr(dumbuf, 'K')))
return(1);
#ifdef DEBUG
dumbuf[len] = '\0';
-/* $OpenBSD: t3000.c,v 1.3 1996/06/26 05:40:54 deraadt Exp $ */
+/* $OpenBSD: t3000.c,v 1.4 1997/01/17 07:13:37 millert Exp $ */
/* $NetBSD: t3000.c,v 1.3 1995/10/29 00:49:57 pk Exp $ */
/*
#if 0
static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: t3000.c,v 1.3 1996/06/26 05:40:54 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: t3000.c,v 1.4 1997/01/17 07:13:37 millert Exp $";
#endif /* not lint */
/*
buf[len] = '\0';
printf("t3000_sync: (\"%s\")\n\r", buf);
#endif
- if (index(buf, '0') ||
- (index(buf, 'O') && index(buf, 'K')))
+ if (strchr(buf, '0') ||
+ (strchr(buf, 'O') && strchr(buf, 'K')))
return(1);
}
/*
-/* $OpenBSD: ventel.c,v 1.3 1996/06/26 05:40:57 deraadt Exp $ */
+/* $OpenBSD: ventel.c,v 1.4 1997/01/17 07:13:38 millert Exp $ */
/* $NetBSD: ventel.c,v 1.4 1995/10/29 00:50:04 pk Exp $ */
/*
#if 0
static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: ventel.c,v 1.3 1996/06/26 05:40:57 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ventel.c,v 1.4 1997/01/17 07:13:38 millert Exp $";
#endif /* not lint */
/*
{
register char *cp;
register int connected = 0;
- char *msg, *index(), line[80];
+ char *msg, line[80];
static int gobble(), vensync();
static void echo();
struct termios cntrl;
if (connected || timeout || !boolean(value(VERBOSE)))
return (connected);
/* call failed, parse response for user */
- cp = index(line, '\r');
+ cp = strchr(line, '\r');
if (cp)
*cp = '\0';
- for (cp = line; cp = index(cp, ' '); cp++)
+ for (cp = line; cp = strchr(cp, ' '); cp++)
if (cp[1] == ' ')
break;
if (cp) {
-/* $OpenBSD: str.c,v 1.2 1996/06/26 05:41:49 deraadt Exp $ */
+/* $OpenBSD: str.c,v 1.3 1997/01/17 07:13:40 millert Exp $ */
/* $NetBSD: str.c,v 1.7 1995/08/31 22:13:47 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-static char rcsid[] = "$OpenBSD: str.c,v 1.2 1996/06/26 05:41:49 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: str.c,v 1.3 1997/01/17 07:13:40 millert Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
default: /* "[\###*n]" or "[#*n]" */
if ((p = strpbrk(s->str + 2, "*]")) == NULL)
return (0);
- if (p[0] != '*' || index(p, ']') == NULL)
+ if (p[0] != '*' || strchr(p, ']') == NULL)
return (0);
s->str += 1;
genseq(s);
-/* $OpenBSD: map.c,v 1.2 1996/06/26 05:41:55 deraadt Exp $ */
+/* $OpenBSD: map.c,v 1.3 1997/01/17 07:13:43 millert Exp $ */
/* $NetBSD: map.c,v 1.4 1994/12/07 05:08:07 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: map.c,v 1.2 1996/06/26 05:41:55 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: map.c,v 1.3 1997/01/17 07:13:43 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
goto badmopt;
++arg;
} else { /* Optional baudrate. */
- arg = index(p = arg, ':');
+ arg = strchr(p = arg, ':');
if (arg == NULL)
goto badmopt;
*arg++ = '\0';
-/* $OpenBSD: term.c,v 1.2 1996/06/26 05:41:57 deraadt Exp $ */
+/* $OpenBSD: term.c,v 1.3 1997/01/17 07:13:44 millert Exp $ */
/* $NetBSD: term.c,v 1.6 1994/12/07 05:08:12 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: term.c,v 1.2 1996/06/26 05:41:57 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: term.c,v 1.3 1997/01/17 07:13:44 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
/* Try ttyname(3); check for dialup or other mapping. */
if (ttypath = ttyname(STDERR_FILENO)) {
- if (p = rindex(ttypath, '/'))
+ if (p = strrchr(ttypath, '/'))
++p;
else
p = ttypath;
return (dflt);
}
- if (p = index(answer, '\n'))
+ if (p = strchr(answer, '\n'))
*p = '\0';
if (answer[0])
return (answer);
-/* $OpenBSD: wrterm.c,v 1.2 1996/06/26 05:41:59 deraadt Exp $ */
+/* $OpenBSD: wrterm.c,v 1.3 1997/01/17 07:13:45 millert Exp $ */
/* $NetBSD: wrterm.c,v 1.3 1994/12/07 05:08:16 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: wrterm.c,v 1.2 1996/06/26 05:41:59 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: wrterm.c,v 1.3 1997/01/17 07:13:45 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
char *t, *sep;
/* Find the end of the terminal names. */
- if ((t = index(bp, ':')) == NULL)
+ if ((t = strchr(bp, ':')) == NULL)
err("termcap names not colon terminated");
*t++ = '\0';
-/* $OpenBSD: uudecode.c,v 1.2 1996/06/26 05:42:21 deraadt Exp $ */
+/* $OpenBSD: uudecode.c,v 1.3 1997/01/17 07:13:47 millert Exp $ */
/* $NetBSD: uudecode.c,v 1.6 1994/11/17 07:40:43 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)uudecode.c 8.2 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: uudecode.c,v 1.2 1996/06/26 05:42:21 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: uudecode.c,v 1.3 1997/01/17 07:13:47 millert Exp $";
#endif /* not lint */
/*
/* handle ~user/file format */
if (buf[0] == '~') {
- if (!(p = index(buf, '/'))) {
+ if (!(p = strchr(buf, '/'))) {
(void)fprintf(stderr, "uudecode: %s: illegal ~user.\n",
filename);
return(1);
-/* $OpenBSD: vacation.c,v 1.4 1997/01/15 23:43:31 millert Exp $ */
+/* $OpenBSD: vacation.c,v 1.5 1997/01/17 07:13:48 millert Exp $ */
/* $NetBSD: vacation.c,v 1.7 1995/04/29 05:58:27 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)vacation.c 8.2 (Berkeley) 1/26/94";
#endif
-static char rcsid[] = "$OpenBSD: vacation.c,v 1.4 1997/01/15 23:43:31 millert Exp $";
+static char rcsid[] = "$OpenBSD: vacation.c,v 1.5 1997/01/17 07:13:48 millert Exp $";
#endif /* not lint */
/*
for (p = buf + 5; *p && *p != ' '; ++p);
*p = '\0';
(void)strcpy(from, buf + 5);
- if (p = index(from, '\n'))
+ if (p = strchr(from, '\n'))
*p = '\0';
if (junkmail())
exit(0);
if (strncasecmp(buf, "Precedence", 10) ||
buf[10] != ':' && buf[10] != ' ' && buf[10] != '\t')
break;
- if (!(p = index(buf, ':')))
+ if (!(p = strchr(buf, ':')))
break;
while (*++p && isspace(*p));
if (!*p)
*
* From site!site!SENDER%site.domain%site.domain@site.domain
*/
- if (!(p = index(from, '%')))
- if (!(p = index(from, '@'))) {
- if (p = rindex(from, '!'))
+ if (!(p = strchr(from, '%')))
+ if (!(p = strchr(from, '@'))) {
+ if (p = strrchr(from, '!'))
++p;
else
p = from;
-/* $OpenBSD: who.c,v 1.2 1996/06/26 05:43:00 deraadt Exp $ */
+/* $OpenBSD: who.c,v 1.3 1997/01/17 07:13:50 millert Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: who.c,v 1.2 1996/06/26 05:43:00 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: who.c,v 1.3 1997/01/17 07:13:50 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
/* search through the utmp and find an entry for this tty */
if (p = ttyname(0)) {
/* strip any directory component */
- if (t = rindex(p, '/'))
+ if (t = strrchr(p, '/'))
p = t + 1;
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1)
if (usr.ut_name && !strcmp(usr.ut_line, p)) {
-/* $OpenBSD: lcmd1.c,v 1.3 1996/06/26 05:43:15 deraadt Exp $ */
+/* $OpenBSD: lcmd1.c,v 1.4 1997/01/17 07:13:51 millert Exp $ */
/* $NetBSD: lcmd1.c,v 1.6 1996/02/08 20:45:00 mycroft Exp $ */
/*
#if 0
static char sccsid[] = "@(#)lcmd1.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lcmd1.c,v 1.3 1996/06/26 05:43:15 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lcmd1.c,v 1.4 1997/01/17 07:13:51 millert Exp $";
#endif
#endif /* not lint */
*pp = a->v_str;
*pp = 0;
shf = *(sh = argv);
- if (*sh = rindex(shf, '/'))
+ if (*sh = strrchr(shf, '/'))
(*sh)++;
else
*sh = shf;
-/* $OpenBSD: lcmd2.c,v 1.2 1996/06/26 05:43:15 deraadt Exp $ */
+/* $OpenBSD: lcmd2.c,v 1.3 1997/01/17 07:13:52 millert Exp $ */
/* $NetBSD: lcmd2.c,v 1.7 1995/09/29 00:44:04 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)lcmd2.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lcmd2.c,v 1.2 1996/06/26 05:43:15 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lcmd2.c,v 1.3 1997/01/17 07:13:52 millert Exp $";
#endif
#endif /* not lint */
break;
}
if (default_shellfile = *default_shell)
- if (*default_shell = rindex(default_shellfile, '/'))
+ if (*default_shell = strrchr(default_shellfile, '/'))
(*default_shell)++;
else
*default_shell = default_shellfile;
-/* $OpenBSD: main.c,v 1.4 1996/06/26 05:43:17 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.5 1997/01/17 07:13:52 millert Exp $ */
/* $NetBSD: main.c,v 1.6 1996/02/08 20:45:01 mycroft Exp $ */
/*
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.4 1996/06/26 05:43:17 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.5 1997/01/17 07:13:52 millert Exp $";
#endif
#endif /* not lint */
char tflag = 0;
escapec = ESCAPEC;
- if (p = rindex(*argv, '/'))
+ if (p = strrchr(*argv, '/'))
p++;
else
p = *argv;
(void) fprintf(stderr, "Out of memory.\n");
exit(1);
}
- if (p = rindex(default_shellfile, '/'))
+ if (p = strrchr(default_shellfile, '/'))
p++;
else
p = default_shellfile;
-/* $OpenBSD: xinstall.c,v 1.10 1997/01/15 23:43:41 millert Exp $ */
+/* $OpenBSD: xinstall.c,v 1.11 1997/01/17 07:13:54 millert Exp $ */
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */
/*
#if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#endif
-static char rcsid[] = "$OpenBSD: xinstall.c,v 1.10 1997/01/15 23:43:41 millert Exp $";
+static char rcsid[] = "$OpenBSD: xinstall.c,v 1.11 1997/01/17 07:13:54 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
if (flags & DIRECTORY) {
(void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
to_name,
- (p = rindex(from_name, '/')) ? ++p : from_name);
+ (p = strrchr(from_name, '/')) ? ++p : from_name);
to_name = pathbuf;
}
devnull = 0;
#ifndef lint
/*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/
-static char yyrcsid[] = "$OpenBSD: ftp.tab.c,v 1.2 1996/04/21 23:45:32 deraadt Exp $";
+static char yyrcsid[] = "$OpenBSD: ftp.tab.c,v 1.3 1997/01/17 07:13:55 millert Exp $";
#endif
#include <stdlib.h>
#define YYBYACC 1
#ifndef lint
/*static char sccsid[] = "from: @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89";*/
-static char rcsid[] = "$Id: ftp.tab.c,v 1.2 1996/04/21 23:45:32 deraadt Exp $";
+static char rcsid[] = "$Id: ftp.tab.c,v 1.3 1997/01/17 07:13:55 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
char cbuf[512];
char *fromname;
-char *index();
#line 65 "ftp.tab.c"
#define A 257
#define B 258
if (strncasecmp(cbuf, "PASS", 4) != NULL)
setproctitle("%s: %s", proctitle, cbuf);
#endif /* SETPROCTITLE */
- if ((cp = index(cbuf, '\r'))) {
+ if ((cp = strchr(cbuf, '\r'))) {
*cp++ = '\n';
*cp = '\0';
}
#ifndef lint
/* from: static char sccsid[] = "@(#)chown.c 8.8 (Berkeley) 4/4/94"; */
-static char *rcsid = "$Id: chown.c,v 1.2 1997/01/15 23:43:52 millert Exp $";
+static char *rcsid = "$Id: chown.c,v 1.3 1997/01/17 07:13:57 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
int Hflag, Lflag, Pflag, ch, fts_options, hflag, rval;
char *cp;
- myname = (cp = rindex(*argv, '/')) ? cp + 1 : *argv;
+ myname = (cp = strrchr(*argv, '/')) ? cp + 1 : *argv;
ischown = myname[2] == 'o';
Hflag = Lflag = Pflag = hflag = 0;
-/* $OpenBSD: mkmakefile.c,v 1.2 1997/01/12 07:43:35 downsj Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.3 1997/01/17 07:13:59 millert Exp $ */
/* $NetBSD: mkmakefile.c,v 1.29 1996/06/10 02:32:26 thorpej Exp $ */
/*
{
register char *cp;
- cp = rindex(fn, '/');
+ cp = strrchr(fn, '/');
if (cp == 0)
return (fn);
return (cp+1);
-/* $OpenBSD: specfile.c,v 1.2 1997/01/12 07:43:37 downsj Exp $ */
+/* $OpenBSD: specfile.c,v 1.3 1997/01/17 07:14:00 millert Exp $ */
/* $NetBSD: specfile.c,v 1.10 1995/08/17 17:22:22 thorpej Exp $ */
#ifndef lint
case BEFORE_FILENAME: {
kf_name = ns(str);
if (strncmp(kf_name, "OPTIONS/", 8) == 0) {
- kf_name = ns(index(kf_name, '/') + 1);
+ kf_name = ns(strchr(kf_name, '/') + 1);
is_option++;
}
parse_state = BEFORE_SPEC;
-/* $OpenBSD: files.c,v 1.5 1996/08/29 03:33:05 deraadt Exp $ */
+/* $OpenBSD: files.c,v 1.6 1997/01/17 07:14:02 millert Exp $ */
/* $NetBSD: files.c,v 1.6 1996/03/17 13:18:17 cgd Exp $ */
/*
}
/* find last part of pathname, and same without trailing suffix */
- tail = rindex(path, '/');
+ tail = strrchr(path, '/');
if (tail == NULL)
tail = path;
else
tail++;
- dotp = rindex(tail, '.');
+ dotp = strrchr(tail, '.');
if (dotp == NULL || dotp[1] == 0 ||
(baselen = dotp - tail) >= sizeof(base)) {
error("invalid pathname `%s'", path);
#ifndef lint
/*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: edquota.c,v 1.13 1996/09/16 02:19:37 millert Exp $";
+static char *rcsid = "$Id: edquota.c,v 1.14 1997/01/17 07:14:04 millert Exp $";
#endif /* not lint */
/*
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
}
strcpy(buf, fs->fs_mntops);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
- if ((cp = index(opt, '=')))
+ if ((cp = strchr(opt, '=')))
*cp++ = '\0';
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
break;
#ifndef lint
static char sccsid[] = "@(#)ipft_hx.c 1.1 3/9/96 (C) 1996 Darren Reed";
-static char rcsid[] = "$Id: ipft_hx.c,v 1.2 1996/07/18 04:59:23 dm Exp $";
+static char rcsid[] = "$Id: ipft_hx.c,v 1.3 1997/01/17 07:14:06 millert Exp $";
#endif
extern int opts;
ip = (struct ip *)buf;
*ifn = NULL;
while (fgets(line, sizeof(line)-1, tfp)) {
- if ((s = index(line, '\n'))) {
+ if ((s = strchr(line, '\n'))) {
if (s == line)
return (char *)ip - buf;
*s = '\0';
}
- if ((s = index(line, '\r')))
+ if ((s = strchr(line, '\r')))
*s = '\0';
- if ((s = index(line, '#')))
+ if ((s = strchr(line, '#')))
*s = '\0';
if (!*line)
continue;
#ifndef lint
static char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed";
-static char rcsid[] = "$Id: ipft_tx.c,v 1.4 1996/07/18 04:59:24 dm Exp $";
+static char rcsid[] = "$Id: ipft_tx.c,v 1.5 1997/01/17 07:14:07 millert Exp $";
#endif
extern int opts;
ip = (struct ip *)buf;
*ifn = NULL;
while (fgets(line, sizeof(line)-1, tfp)) {
- if ((s = index(line, '\n')))
+ if ((s = strchr(line, '\n')))
*s = '\0';
- if ((s = index(line, '\r')))
+ if ((s = strchr(line, '\r')))
*s = '\0';
- if ((s = index(line, '#')))
+ if ((s = strchr(line, '#')))
*s = '\0';
if (!*line)
continue;
if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP) {
char *last;
- last = index(*cpp, ',');
+ last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no source port\n");
return 1;
if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP) {
char *last;
- last = index(*cpp, ',');
+ last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no destination port\n");
return 1;
char *s, *t;
for (s = *cpp; *s; s++)
- if ((t = index(tcp_flagset, *s)))
+ if ((t = strchr(tcp_flagset, *s)))
tcp->th_flags |= tcp_flags[t - tcp_flagset];
if (tcp->th_flags)
cpp++;
s++, i++)
if (*s && !strncasecmp(*cpp, *s, strlen(*s))) {
ic->icmp_type = i;
- if ((t = index(*cpp, ',')))
+ if ((t = strchr(*cpp, ',')))
ic->icmp_code = atoi(t+1);
cpp++;
break;
#ifndef lint
static char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-1996 Darren Reed";
-static char rcsid[] = "$Id: ipt.c,v 1.6 1996/10/08 07:33:36 niklas Exp $";
+static char rcsid[] = "$Id: ipt.c,v 1.7 1997/01/17 07:14:08 millert Exp $";
#endif
extern int fr_check();
/*
* treat both CR and LF as EOL
*/
- if ((s = index(line, '\n')))
+ if ((s = strchr(line, '\n')))
*s = '\0';
- if ((s = index(line, '\r')))
+ if ((s = strchr(line, '\r')))
*s = '\0';
/*
* # is comment marker, everything after is a ignored
*/
- if ((s = index(line, '#')))
+ if ((s = strchr(line, '#')))
*s = '\0';
if (!*line)
/* $NetBSD: spec.c,v 1.6 1995/03/07 21:12:12 cgd Exp $ */
-/* $OpenBSD: spec.c,v 1.5 1997/01/03 21:40:51 millert Exp $ */
+/* $OpenBSD: spec.c,v 1.6 1997/01/17 07:14:10 millert Exp $ */
/*-
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: spec.c,v 1.5 1997/01/03 21:40:51 millert Exp $";
+static char rcsid[] = "$OpenBSD: spec.c,v 1.6 1997/01/17 07:14:10 millert Exp $";
#endif
#endif /* not lint */
continue;
/* Find end of line. */
- if ((p = index(buf, '\n')) == NULL)
+ if ((p = strchr(buf, '\n')) == NULL)
err("line %d too long", lineno);
/* See if next line is continuation line. */
continue;
}
- if (index(p, '/'))
+ if (strchr(p, '/'))
err("slash character in file name");
if (!strcmp(p, "..")) {
-/* $OpenBSD: futil.c,v 1.2 1996/06/04 08:43:33 niklas Exp $ */
+/* $OpenBSD: futil.c,v 1.3 1997/01/17 07:14:11 millert Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: futil.c,v 1.2 1996/06/04 08:43:33 niklas Exp $";
+static const char *rcsid = "$OpenBSD: futil.c,v 1.3 1997/01/17 07:14:11 millert Exp $";
#endif
/*
else
cp1 = cp2 = dir;
while (cp2) {
- if ((cp2 = index(cp1, '/')) !=NULL )
+ if ((cp2 = strchr(cp1, '/')) !=NULL )
*cp2 = '\0';
if (fexists(dir)) {
if (!isdir(dir))
-/* $OpenBSD: perform.c,v 1.3 1996/12/29 12:18:28 graichen Exp $ */
+/* $OpenBSD: perform.c,v 1.4 1997/01/17 07:14:13 millert Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: perform.c,v 1.3 1996/12/29 12:18:28 graichen Exp $";
+static const char *rcsid = "$OpenBSD: perform.c,v 1.4 1997/01/17 07:14:13 millert Exp $";
#endif
/*
plist.head = plist.tail = NULL;
/* Break the package name into base and desired suffix (if any) */
- if ((cp = rindex(pkg, '.')) != NULL) {
+ if ((cp = strrchr(pkg, '.')) != NULL) {
suffix = cp + 1;
*cp = '\0';
}
args[nargs++] = "-c";
args[nargs++] = "-f";
args[nargs++] = tball;
- if (index(suffix, 'z')) /* Compress/gzip? */
+ if (strchr(suffix, 'z')) /* Compress/gzip? */
args[nargs++] = "-z";
if (Dereference)
args[nargs++] = "-h";
}
if (Verbose)
- if (index(suffix, 'z'))
+ if (strchr(suffix, 'z'))
printf("Creating gzip'd tar ball in '%s'\n", tball);
else
printf("Creating tar ball in '%s'\n", tball);
-/* $OpenBSD: file.c,v 1.3 1996/12/29 12:19:08 graichen Exp $ */
+/* $OpenBSD: file.c,v 1.4 1997/01/17 07:14:15 millert Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: file.c,v 1.3 1996/12/29 12:19:08 graichen Exp $";
+static const char *rcsid = "$OpenBSD: file.c,v 1.4 1997/01/17 07:14:15 millert Exp $";
#endif
/*
* compressed.
*/
if (strcmp(pkg, "-")) {
- cp = rindex(pkg, '.');
+ cp = strrchr(pkg, '.');
if (cp) {
strcpy(suffix, cp + 1);
- if (index(suffix, 'z') || index(suffix, 'Z'))
+ if (strchr(suffix, 'z') || strchr(suffix, 'Z'))
strcpy(args, "-z");
}
}
-/* $OpenBSD: plist.c,v 1.2 1996/06/04 08:43:45 niklas Exp $ */
+/* $OpenBSD: plist.c,v 1.3 1997/01/17 07:14:16 millert Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: plist.c,v 1.2 1996/06/04 08:43:45 niklas Exp $";
+static const char *rcsid = "$OpenBSD: plist.c,v 1.3 1997/01/17 07:14:16 millert Exp $";
#endif
/*
if (!nukedirs)
return 0;
while (cp2) {
- if ((cp2 = rindex(cp1, '/')) != NULL)
+ if ((cp2 = strrchr(cp1, '/')) != NULL)
*cp2 = '\0';
if (!isemptydir(dir))
return 0;
-/* $OpenBSD: str.c,v 1.2 1996/06/04 08:43:46 niklas Exp $ */
+/* $OpenBSD: str.c,v 1.3 1997/01/17 07:14:17 millert Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: str.c,v 1.2 1996/06/04 08:43:46 niklas Exp $";
+static const char *rcsid = "$OpenBSD: str.c,v 1.3 1997/01/17 07:14:17 millert Exp $";
#endif
/*
char *idx;
Boolean ret = FALSE;
- idx = rindex(str, '.');
+ idx = strrchr(str, '.');
if (idx && !strcmp(idx + 1, suff))
ret = TRUE;
return ret;
{
char *idx;
- idx = rindex(str, '.');
+ idx = strrchr(str, '.');
if (idx)
*idx = '\0'; /* Yow! Don't try this on a const! */
}
#ifndef lint
/*static char sccsid[] = "from: @(#)quotaon.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: quotaon.c,v 1.7 1996/05/04 12:28:18 deraadt Exp $";
+static char *rcsid = "$Id: quotaon.c,v 1.8 1997/01/17 07:14:19 millert Exp $";
#endif /* not lint */
/*
char **argv;
{
register struct fstab *fs;
- char *qfnp, *whoami, *rindex();
+ char *qfnp, *whoami;
long argnum, done = 0;
int i, offmode = 0, errs = 0;
extern char *optarg;
extern int optind;
int ch;
- whoami = rindex(*argv, '/') + 1;
+ whoami = strrchr(*argv, '/') + 1;
if (whoami == (char *)1)
whoami = *argv;
if (strcmp(whoami, "quotaoff") == 0)
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
}
strcpy(buf, fs->fs_mntops);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
- if (cp = index(opt, '='))
+ if (cp = strchr(opt, '='))
*cp++ = '\0';
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
break;
if (*line == '\0' || *line == '#') /* ignore comment */
continue;
- if ((cp = index(line,'#')) != NULL) /* trash comments */
+ if ((cp = strchr(line,'#')) != NULL) /* trash comments */
*cp = '\0';
cp = line; /* init `cp' */
* stripped file name and spoof the client into thinking that it
* really got what it wanted.
*/
- filename = (filename = rindex(filepath,'/'))? ++filename: filepath;
+ filename = (filename = strrchr(filepath,'/'))? ++filename: filepath;
/*
* Check that this is a valid boot file name.
#ifndef lint
/*static char sccsid[] = "from: @(#)repquota.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: repquota.c,v 1.8 1996/12/12 20:32:17 deraadt Exp $";
+static char *rcsid = "$Id: repquota.c,v 1.9 1997/01/17 07:14:24 millert Exp $";
#endif /* not lint */
/*
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
}
strcpy(buf, fs->fs_mntops);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
- if ((cp = index(opt, '=')))
+ if ((cp = strchr(opt, '=')))
*cp++ = '\0';
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
break;
* Various small changes by Theo de Raadt <deraadt@fsa.ca>
* Parser rewritten (adding YP support) by Roland McGrath <roland@frob.com>
*
- * $Id: bootparamd.c,v 1.5 1996/12/10 15:13:31 deraadt Exp $
+ * $Id: bootparamd.c,v 1.6 1997/01/17 07:14:26 millert Exp $
*/
#include <sys/types.h>
{
SVCXPRT *transp;
int i, s, pid;
- char *rindex();
struct hostent *he;
struct stat buf;
char *optstring;
bp_getfile_arg *getfile;
struct svc_req *rqstp;
{
- char *where, *index();
+ char *where;
static bp_getfile_res res;
int err;
#ifndef lint
/*static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$Id: rwhod.c,v 1.5 1996/11/01 06:53:48 deraadt Exp $";
+static char rcsid[] = "$Id: rwhod.c,v 1.6 1997/01/17 07:14:28 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
syslog(LOG_ERR, "gethostname: %m");
exit(1);
}
- if ((cp = index(myname, '.')) != NULL)
+ if ((cp = strchr(myname, '.')) != NULL)
*cp = '\0';
strncpy(mywd.wd_hostname, myname, sizeof(mywd.wd_hostname) - 1);
mywd.wd_hostname[sizeof(mywd.wd_hostname) - 1] = '\0';
if (first && !nflag) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
if (!nflag && in.s_addr != INADDR_ANY) {
hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
if (hp) {
- if ((cp = index(hp->h_name, '.')) &&
+ if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
-/* $OpenBSD: makedbm.c,v 1.5 1997/01/15 23:44:32 millert Exp $ */
+/* $OpenBSD: makedbm.c,v 1.6 1997/01/17 07:14:32 millert Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: makedbm.c,v 1.5 1997/01/15 23:44:32 millert Exp $";
+static char rcsid[] = "$OpenBSD: makedbm.c,v 1.6 1997/01/17 07:14:32 millert Exp $";
#endif
#include <stdio.h>
}
snprintf(db_outfile, sizeof(db_outfile), "%s%s", database, YPDB_SUFFIX);
- slash = rindex(database, '/');
+ slash = strrchr(database, '/');
if (slash != NULL)
slash[1] = 0; /* truncate to dir */
else