summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-01-17 07:14:33 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-01-17 07:14:33 +0000
commit3e150a880447536a0af58c395e5a857635e985d3 (patch)
tree867c3504f60ee9bfd2fa5db3dd66d5b3a1649ecd
parent8e78a24e2e89c03ac53bd758a1781c925fe7ab71 (diff)
r?index -> strr?chr
-rw-r--r--games/arithmetic/arithmetic.c4
-rw-r--r--games/atc/log.c6
-rw-r--r--games/atc/update.c7
-rw-r--r--games/bcd/bcd.c3
-rw-r--r--games/boggle/mkdict/mkdict.c2
-rw-r--r--games/cribbage/instr.c2
-rw-r--r--games/fortune/fortune/fortune.c6
-rw-r--r--games/hack/hack.c4
-rw-r--r--games/hack/hack.cmd.c4
-rw-r--r--games/hack/hack.do_name.c2
-rw-r--r--games/hack/hack.do_wear.c4
-rw-r--r--games/hack/hack.dog.c4
-rw-r--r--games/hack/hack.eat.c6
-rw-r--r--games/hack/hack.end.c10
-rw-r--r--games/hack/hack.fight.c10
-rw-r--r--games/hack/hack.invent.c22
-rw-r--r--games/hack/hack.lev.c4
-rw-r--r--games/hack/hack.main.c2
-rw-r--r--games/hack/hack.makemon.c11
-rw-r--r--games/hack/hack.mhitu.c4
-rw-r--r--games/hack/hack.mklev.c2
-rw-r--r--games/hack/hack.mkobj.c2
-rw-r--r--games/hack/hack.mon.c32
-rw-r--r--games/hack/hack.objnam.c10
-rw-r--r--games/hack/hack.options.c8
-rw-r--r--games/hack/hack.pager.c8
-rw-r--r--games/hack/hack.read.c8
-rw-r--r--games/hack/hack.rip.c2
-rw-r--r--games/hack/hack.rumors.c5
-rw-r--r--games/hack/hack.shk.c4
-rw-r--r--games/hack/hack.topl.c4
-rw-r--r--games/hack/hack.trap.c4
-rw-r--r--games/hack/hack.tty.c2
-rw-r--r--games/hack/hack.u_init.c10
-rw-r--r--games/hack/hack.unix.c12
-rw-r--r--games/hack/hack.zap.c10
-rw-r--r--games/hangman/playgame.c2
-rw-r--r--games/pig/pig.c4
-rw-r--r--games/robots/main.c2
-rw-r--r--games/sail/main.c2
-rw-r--r--kerberosIV/kdb/krb_lib.c10
-rw-r--r--kerberosIV/krb/get_in_tkt.c8
-rw-r--r--lib/libkvm.old/kvm.c4
-rw-r--r--lib/libkvm/kvm.c6
-rw-r--r--libexec/getNAME/getNAME.c6
-rw-r--r--libexec/mail.local/mail.local.c4
-rw-r--r--libexec/rexecd/rexecd.c4
-rw-r--r--libexec/rlogind/rlogind.c8
-rw-r--r--libexec/rpc.rquotad/rquotad.c2
-rw-r--r--regress/lib/libc/db/dbtest.c12
-rw-r--r--sbin/ipf/ipf.c17
-rw-r--r--sbin/ipf/parse.c12
-rw-r--r--sbin/reboot/reboot.c6
-rw-r--r--sbin/routed/parms.c4
-rw-r--r--sbin/routed/rtquery/rtquery.c4
-rw-r--r--sys/arch/amiga/stand/binpatch/binpatch.c4
-rw-r--r--usr.bin/compress/compress.c10
-rw-r--r--usr.bin/finger/finger.c7
-rw-r--r--usr.bin/finger/net.c8
-rw-r--r--usr.bin/fmt/fmt.c6
-rw-r--r--usr.bin/hexdump/display.c6
-rw-r--r--usr.bin/hexdump/parse.c12
-rw-r--r--usr.bin/locate/locate/fastfind.c6
-rw-r--r--usr.bin/locate/locate/util.c12
-rw-r--r--usr.bin/mail/aux.c22
-rw-r--r--usr.bin/mail/fio.c6
-rw-r--r--usr.bin/mail/lex.c6
-rw-r--r--usr.bin/mail/list.c6
-rw-r--r--usr.bin/mail/names.c6
-rw-r--r--usr.bin/more/more.c6
-rw-r--r--usr.bin/netstat/if.c6
-rw-r--r--usr.bin/netstat/inet.c10
-rw-r--r--usr.bin/netstat/iso.c6
-rw-r--r--usr.bin/netstat/route.c8
-rw-r--r--usr.bin/paste/paste.c8
-rw-r--r--usr.bin/patch/patch.c6
-rw-r--r--usr.bin/printf/printf.c12
-rw-r--r--usr.bin/quota/quota.c6
-rw-r--r--usr.bin/ranlib/misc.c6
-rw-r--r--usr.bin/rlogin/rlogin.c6
-rw-r--r--usr.bin/rusers/rusers.c6
-rw-r--r--usr.bin/sup/src/ci.c14
-rw-r--r--usr.bin/sup/src/expand.c4
-rw-r--r--usr.bin/sup/src/stree.c7
-rw-r--r--usr.bin/systat/disks.c7
-rw-r--r--usr.bin/systat/netcmds.c7
-rw-r--r--usr.bin/systat/netstat.c10
-rw-r--r--usr.bin/talk/get_names.c7
-rw-r--r--usr.bin/tftp/main.c20
-rw-r--r--usr.bin/tftp/tftp.c7
-rw-r--r--usr.bin/tip/aculib/courier.c8
-rw-r--r--usr.bin/tip/aculib/hayes.c8
-rw-r--r--usr.bin/tip/aculib/t3000.c8
-rw-r--r--usr.bin/tip/aculib/ventel.c10
-rw-r--r--usr.bin/tr/str.c6
-rw-r--r--usr.bin/tset/map.c6
-rw-r--r--usr.bin/tset/term.c8
-rw-r--r--usr.bin/tset/wrterm.c6
-rw-r--r--usr.bin/uudecode/uudecode.c6
-rw-r--r--usr.bin/vacation/vacation.c14
-rw-r--r--usr.bin/who/who.c6
-rw-r--r--usr.bin/window/lcmd1.c6
-rw-r--r--usr.bin/window/lcmd2.c6
-rw-r--r--usr.bin/window/main.c8
-rw-r--r--usr.bin/xinstall/xinstall.c6
-rw-r--r--usr.bin/yacc/test/ftp.tab.c7
-rw-r--r--usr.sbin/chown/chown.c4
-rw-r--r--usr.sbin/config.old/mkmakefile.c4
-rw-r--r--usr.sbin/config.old/specfile.c4
-rw-r--r--usr.sbin/config/files.c6
-rw-r--r--usr.sbin/edquota/edquota.c6
-rw-r--r--usr.sbin/ipftest/ipft_hx.c8
-rw-r--r--usr.sbin/ipftest/ipft_tx.c16
-rw-r--r--usr.sbin/ipftest/ipt.c8
-rw-r--r--usr.sbin/mtree/spec.c8
-rw-r--r--usr.sbin/pkg_install/add/futil.c6
-rw-r--r--usr.sbin/pkg_install/create/perform.c10
-rw-r--r--usr.sbin/pkg_install/lib/file.c8
-rw-r--r--usr.sbin/pkg_install/lib/plist.c6
-rw-r--r--usr.sbin/pkg_install/lib/str.c8
-rw-r--r--usr.sbin/quotaon/quotaon.c10
-rw-r--r--usr.sbin/rbootd/parseconf.c2
-rw-r--r--usr.sbin/rbootd/rmpproto.c2
-rw-r--r--usr.sbin/repquota/repquota.c6
-rw-r--r--usr.sbin/rpc.bootparamd/bootparamd.c5
-rw-r--r--usr.sbin/rwhod/rwhod.c4
-rw-r--r--usr.sbin/traceroute/traceroute.c4
-rw-r--r--usr.sbin/ypserv/makedbm/makedbm.c6
128 files changed, 444 insertions, 459 deletions
diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c
index 0f2f85db86d..8cd72060abc 100644
--- a/games/arithmetic/arithmetic.c
+++ b/games/arithmetic/arithmetic.c
@@ -117,7 +117,7 @@ main(argc, argv)
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);
@@ -365,7 +365,7 @@ opnum(op)
{
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);
diff --git a/games/atc/log.c b/games/atc/log.c
index 76e878d84ca..4b84798d46a 100644
--- a/games/atc/log.c
+++ b/games/atc/log.c
@@ -99,7 +99,7 @@ log_score(list_em)
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;
@@ -160,7 +160,7 @@ log_score(list_em)
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);
@@ -240,7 +240,7 @@ log_score(list_em)
"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,
diff --git a/games/atc/update.c b/games/atc/update.c
index 9fdc32b170a..cff7dcd6946 100644
--- a/games/atc/update.c
+++ b/games/atc/update.c
@@ -224,7 +224,6 @@ command(pp)
PLANE *pp;
{
static char buf[50], *bp, *comm_start;
- char *index();
buf[0] = '\0';
bp = buf;
@@ -232,7 +231,7 @@ command(pp)
(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)
@@ -240,11 +239,11 @@ command(pp)
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, "---------");
diff --git a/games/bcd/bcd.c b/games/bcd/bcd.c
index 869467fccb7..9835a921f94 100644
--- a/games/bcd/bcd.c
+++ b/games/bcd/bcd.c
@@ -155,10 +155,9 @@ printcard(str)
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)
diff --git a/games/boggle/mkdict/mkdict.c b/games/boggle/mkdict/mkdict.c
index f60d9097a2f..c0f3948a3db 100644
--- a/games/boggle/mkdict/mkdict.c
+++ b/games/boggle/mkdict/mkdict.c
@@ -83,7 +83,7 @@ main(argc, argv)
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')
diff --git a/games/cribbage/instr.c b/games/cribbage/instr.c
index de6944bd234..39209440245 100644
--- a/games/cribbage/instr.c
+++ b/games/cribbage/instr.c
@@ -76,7 +76,7 @@ instructions()
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);
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index 636f246b280..6c596b59725 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -665,7 +665,7 @@ char *offensive;
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;
@@ -766,7 +766,7 @@ int check_for_offend;
return FALSE;
}
- if ((sp = rindex(file, '/')) == NULL)
+ if ((sp = strrchr(file, '/')) == NULL)
sp = file;
else
sp++;
@@ -774,7 +774,7 @@ int check_for_offend;
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) {
diff --git a/games/hack/hack.c b/games/hack/hack.c
index 5261e183b33..e18c9686a13 100644
--- a/games/hack/hack.c
+++ b/games/hack/hack.c
@@ -380,7 +380,7 @@ pickup(all)
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;
@@ -571,7 +571,7 @@ register struct monst *mtmp;
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);
diff --git a/games/hack/hack.cmd.c b/games/hack/hack.cmd.c
index 0af29895588..64457125f5d 100644
--- a/games/hack/hack.cmd.c
+++ b/games/hack/hack.cmd.c
@@ -234,7 +234,7 @@ char sym;
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];
@@ -249,7 +249,7 @@ boolean s;
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);
}
diff --git a/games/hack/hack.do_name.c b/games/hack/hack.do_name.c
index c50d45cd13f..93e73b40da6 100644
--- a/games/hack/hack.do_name.c
+++ b/games/hack/hack.do_name.c
@@ -170,7 +170,7 @@ register struct obj *obj;
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')
diff --git a/games/hack/hack.do_wear.c b/games/hack/hack.do_wear.c
index 2084b630201..169dffd68bb 100644
--- a/games/hack/hack.do_wear.c
+++ b/games/hack/hack.do_wear.c
@@ -53,7 +53,7 @@ doremring() {
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':
@@ -198,7 +198,7 @@ dowearring() {
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':
diff --git a/games/hack/hack.dog.c b/games/hack/hack.dog.c
index d9192a4c7c5..80b2f08f4ea 100644
--- a/games/hack/hack.dog.c
+++ b/games/hack/hack.dog.c
@@ -164,7 +164,7 @@ int info[9];
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;
@@ -398,7 +398,7 @@ register struct obj *obj;
#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);
diff --git a/games/hack/hack.eat.c b/games/hack/hack.eat.c
index 7745f63feb2..05f140a07e4 100644
--- a/games/hack/hack.eat.c
+++ b/games/hack/hack.eat.c
@@ -360,7 +360,7 @@ newuhs(incr) boolean incr; {
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 */
@@ -373,7 +373,7 @@ register tp = 0;
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){
@@ -381,7 +381,7 @@ register tp = 0;
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");
diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c
index 20b77e4f689..067d576dce5 100644
--- a/games/hack/hack.end.c
+++ b/games/hack/hack.end.c
@@ -95,11 +95,11 @@ register char *st1;
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
@@ -426,7 +426,7 @@ char linebuf[BUFSZ];
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) {
@@ -538,7 +538,7 @@ prscore(argc,argv) int argc; char **argv; {
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;
@@ -638,7 +638,7 @@ prscore(argc,argv) int argc; char **argv; {
.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;
diff --git a/games/hack/hack.fight.c b/games/hack/hack.fight.c
index 92d11c2ea4a..0bee9ca238d 100644
--- a/games/hack/hack.fight.c
+++ b/games/hack/hack.fight.c
@@ -20,7 +20,7 @@ register struct permonst *pa = magr->data, *pd = mdef->data;
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){
@@ -88,7 +88,7 @@ register struct permonst *pd = mdef->data;
/* 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);
@@ -151,7 +151,7 @@ register thrown;
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);
@@ -194,7 +194,7 @@ register thrown;
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;
@@ -304,7 +304,7 @@ register struct monst *mtmp;
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;
diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c
index 3cc42763a1d..00f8b2124c5 100644
--- a/games/hack/hack.invent.c
+++ b/games/hack/hack.invent.c
@@ -321,7 +321,7 @@ register char *let,*word;
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 */
@@ -383,7 +383,7 @@ register char *let,*word;
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);
@@ -426,7 +426,7 @@ register char *let,*word;
}
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);
}
@@ -469,7 +469,7 @@ xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */
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;
}
@@ -501,8 +501,8 @@ xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */
} 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;
}
@@ -536,7 +536,7 @@ register int cnt = 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));
@@ -623,7 +623,7 @@ register char *lets;
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;
}
@@ -652,7 +652,7 @@ dotypeinv () /* free after Robert Viduya */
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;
}
@@ -667,7 +667,7 @@ dotypeinv () /* free after Robert Viduya */
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];
@@ -777,7 +777,7 @@ merged(otmp,obj,lose) register struct obj *otmp, *obj; {
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;
diff --git a/games/hack/hack.lev.c b/games/hack/hack.lev.c
index e15d39ee0fd..8b65b87cfeb 100644
--- a/games/hack/hack.lev.c
+++ b/games/hack/hack.lev.c
@@ -199,7 +199,7 @@ xchar lev;
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;
}
@@ -210,7 +210,7 @@ xchar lev;
}
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
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
index 58501936082..4772ae29bca 100644
--- a/games/hack/hack.main.c
+++ b/games/hack/hack.main.c
@@ -236,7 +236,7 @@ char *argv[];
register char *gp = genocided;
while(pm < mons+CMNUM+2){
- if(!index(sfoo, pm->mlet))
+ if(!strchr(sfoo, pm->mlet))
*gp++ = pm->mlet;
pm++;
}
diff --git a/games/hack/hack.makemon.c b/games/hack/hack.makemon.c
index f7fc0ecbe55..fbe58dbf466 100644
--- a/games/hack/hack.makemon.c
+++ b/games/hack/hack.makemon.c
@@ -8,7 +8,6 @@ static char rcsid[] = "$NetBSD: hack.makemon.c,v 1.3 1995/03/23 08:30:38 cgd Exp
#include "hack.h"
extern char fut_geno[];
-extern char *index();
extern struct obj *mkobj_at();
struct monst zeromonst;
@@ -31,18 +30,18 @@ register struct permonst *ptr;
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;
}
@@ -87,7 +86,7 @@ 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
diff --git a/games/hack/hack.mhitu.c b/games/hack/hack.mhitu.c
index 430bfa42204..1ac2ce4176b 100644
--- a/games/hack/hack.mhitu.c
+++ b/games/hack/hack.mhitu.c
@@ -63,11 +63,11 @@ register struct monst *mtmp;
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 &&
diff --git a/games/hack/hack.mklev.c b/games/hack/hack.mklev.c
index 5e8c7b51f04..623bd0074d6 100644
--- a/games/hack/hack.mklev.c
+++ b/games/hack/hack.mklev.c
@@ -679,7 +679,7 @@ register struct mkroom *croom;
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;
diff --git a/games/hack/hack.mkobj.c b/games/hack/hack.mkobj.c
index d4e37fd7928..2231c0e45d0 100644
--- a/games/hack/hack.mkobj.c
+++ b/games/hack/hack.mkobj.c
@@ -63,7 +63,7 @@ register otyp;
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;
diff --git a/games/hack/hack.mon.c b/games/hack/hack.mon.c
index 56dedce6d32..de75086e630 100644
--- a/games/hack/hack.mon.c
+++ b/games/hack/hack.mon.c
@@ -170,7 +170,7 @@ register struct monst *mtmp;
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++;
@@ -182,8 +182,8 @@ register struct monst *mtmp;
/* 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);
@@ -196,7 +196,7 @@ register struct monst *mtmp;
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);
}
@@ -219,7 +219,7 @@ register struct monst *mtmp;
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
@@ -229,7 +229,7 @@ register struct monst *mtmp;
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') */
@@ -299,7 +299,7 @@ register struct monst *mtmp;
}
/* 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) &&
@@ -316,7 +316,7 @@ not_special:
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;
@@ -344,8 +344,8 @@ not_special:
}
/* 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 */
@@ -384,7 +384,7 @@ not_special:
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;
@@ -687,7 +687,7 @@ register struct monst *mtmp;
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);
}
@@ -700,9 +700,9 @@ register struct monst *mtmp;
/* 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;
@@ -753,11 +753,11 @@ register struct monst *mtmp;
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);
diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c
index 2ab2f2ae43e..991385b6e35 100644
--- a/games/hack/hack.objnam.c
+++ b/games/hack/hack.objnam.c
@@ -231,7 +231,7 @@ register int pl = (obj->quan != 1);
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");
@@ -286,7 +286,7 @@ register char *bp = xname(obj);
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);
@@ -296,7 +296,7 @@ register char *bp = xname(obj);
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);
@@ -375,7 +375,7 @@ char *un, *dn, *an;
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;
@@ -524,7 +524,7 @@ typfnd:
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;
diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c
index 361b94230ec..081f2b43d6e 100644
--- a/games/hack/hack.options.c
+++ b/games/hack/hack.options.c
@@ -35,11 +35,11 @@ boolean from_env;
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;
@@ -106,7 +106,7 @@ boolean from_env;
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';
@@ -115,7 +115,7 @@ boolean from_env;
/* 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) {
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c
index 7bbffd86cb5..13382aceda4 100644
--- a/games/hack/hack.pager.c
+++ b/games/hack/hack.pager.c
@@ -36,7 +36,7 @@ dowhatis()
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' */
@@ -82,7 +82,7 @@ int strip; /* nr of chars to be stripped from each line (0 or 1) */
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)) {
@@ -286,9 +286,9 @@ dohelp()
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);
}
diff --git a/games/hack/hack.read.c b/games/hack/hack.read.c
index 7fbbf8a7e33..4aae8b5246b 100644
--- a/games/hack/hack.read.c
+++ b/games/hack/hack.read.c
@@ -195,9 +195,9 @@ doread() {
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.");
@@ -398,7 +398,7 @@ doread() {
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);
@@ -532,7 +532,7 @@ register char ch;
/*
* can't genocide certain monsters
*/
- if (index("12 &:", ch))
+ if (strchr("12 &:", ch))
return FALSE;
if (ch == pm_eel.mlet)
diff --git a/games/hack/hack.rip.c b/games/hack/hack.rip.c
index ced3a27b465..46cfd7eac96 100644
--- a/games/hack/hack.rip.c
+++ b/games/hack/hack.rip.c
@@ -39,7 +39,7 @@ outrip(){
(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);
{
diff --git a/games/hack/hack.rumors.c b/games/hack/hack.rumors.c
index 0ace09e2600..7dff7de2387 100644
--- a/games/hack/hack.rumors.c
+++ b/games/hack/hack.rumors.c
@@ -10,7 +10,6 @@ static char rcsid[] = "$NetBSD: hack.rumors.c,v 1.3 1995/03/23 08:31:24 cgd Exp
#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;
@@ -29,7 +28,7 @@ skipline(rumf) register FILE *rumf; {
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);
}
}
@@ -37,7 +36,7 @@ outline(rumf) register FILE *rumf; {
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);
}
diff --git a/games/hack/hack.shk.c b/games/hack/hack.shk.c
index a3adc7b8358..ab4e3f81017 100644
--- a/games/hack/hack.shk.c
+++ b/games/hack/hack.shk.c
@@ -608,7 +608,7 @@ register struct bill_x *bp;
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;
}
@@ -985,7 +985,7 @@ online(x,y) {
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
diff --git a/games/hack/hack.topl.c b/games/hack/hack.topl.c
index 89b8c8937e4..4316228164f 100644
--- a/games/hack/hack.topl.c
+++ b/games/hack/hack.topl.c
@@ -34,7 +34,7 @@ doredotopl(){
redotoplin() {
home();
- if(index(toplines, '\n')) cl_end();
+ if(strchr(toplines, '\n')) cl_end();
putstr(toplines);
cl_end();
tlx = curx;
@@ -129,7 +129,7 @@ register char *line,*arg1,*arg2,*arg3,*arg4,*arg5,*arg6;
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(); /* %% */
diff --git a/games/hack/hack.trap.c b/games/hack/hack.trap.c
index dbcb12140a4..edf876f39a2 100644
--- a/games/hack/hack.trap.c
+++ b/games/hack/hack.trap.c
@@ -160,7 +160,7 @@ mintrap(mtmp) register struct monst *mtmp; {
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));
@@ -172,7 +172,7 @@ mintrap(mtmp) register struct monst *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));
diff --git a/games/hack/hack.tty.c b/games/hack/hack.tty.c
index 727fea0d239..2b5cc04b595 100644
--- a/games/hack/hack.tty.c
+++ b/games/hack/hack.tty.c
@@ -216,7 +216,7 @@ register int c;
while((c = readchar()) != '\n') {
if(flags.cbreak) {
if(c == ' ') break;
- if(s && index(s,c)) {
+ if(s && strchr(s,c)) {
morc = c;
break;
}
diff --git a/games/hack/hack.u_init.c b/games/hack/hack.u_init.c
index f61899d0bf1..2abb2cdb436 100644
--- a/games/hack/hack.u_init.c
+++ b/games/hack/hack.u_init.c
@@ -117,12 +117,12 @@ extern char readchar();
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;
}
@@ -321,7 +321,7 @@ register char *ep = getenv("INVENT");
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;
@@ -343,7 +343,7 @@ register int type;
plnamesuffix() {
register char *p;
- if(p = rindex(plname, '-')) {
+ if(p = strrchr(plname, '-')) {
*p = 0;
pl_character[0] = p[1];
pl_character[1] = 0;
@@ -360,7 +360,7 @@ char pc;
/* so that rolesyms[] is defined */
register char *cp;
- if(cp = index(rolesyms, pc))
+ if(cp = strchr(rolesyms, pc))
return(cp - rolesyms);
return(-1);
}
diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c
index eb67a3d4d1b..f038795a7e0 100644
--- a/games/hack/hack.unix.c
+++ b/games/hack/hack.unix.c
@@ -19,7 +19,7 @@ static char rcsid[] = "$NetBSD: hack.unix.c,v 1.4 1996/02/06 22:47:25 jtc Exp $"
#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>
@@ -100,7 +100,7 @@ gethdate(name) char *name; {
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) */
@@ -114,11 +114,11 @@ gethdate(name) char *name; {
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);
@@ -134,7 +134,7 @@ char filename[MAXPATHLEN+1];
path = np + 1;
}
error("Cannot get status of %s.",
- (np = rindex(name, '/')) ? np+1 : name);
+ (np = strrchr(name, '/')) ? np+1 : name);
}
uptodate(fd) {
@@ -429,6 +429,6 @@ register char *s;
{
register char *lp;
- while((lp = index(s, '.')) || (lp = index(s, '/')))
+ while((lp = strchr(s, '.')) || (lp = strchr(s, '/')))
*lp = '_';
}
diff --git a/games/hack/hack.zap.c b/games/hack/hack.zap.c
index a282dc0e5b7..8b1c6318cfa 100644
--- a/games/hack/hack.zap.c
+++ b/games/hack/hack.zap.c
@@ -44,7 +44,7 @@ register struct obj *otmp;
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;
@@ -557,20 +557,20 @@ register type;
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;
}
diff --git a/games/hangman/playgame.c b/games/hangman/playgame.c
index 5a591520d71..f6eed3ac68b 100644
--- a/games/hangman/playgame.c
+++ b/games/hangman/playgame.c
@@ -56,7 +56,7 @@ playgame()
bp = Guessed;
while (bp < &Guessed[26])
*bp++ = FALSE;
- while (Errors < MAXERRS && index(Known, '-') != NULL) {
+ while (Errors < MAXERRS && strchr(Known, '-') != NULL) {
prword();
prdata();
prman();
diff --git a/games/pig/pig.c b/games/pig/pig.c
index 9ff54390c0d..89230a673af 100644
--- a/games/pig/pig.c
+++ b/games/pig/pig.c
@@ -109,7 +109,7 @@ pigout(buf, len)
* 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;
}
@@ -119,7 +119,7 @@ pigout(buf, len)
* 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'))
diff --git a/games/robots/main.c b/games/robots/main.c
index c55725b53f3..215e962e7b5 100644
--- a/games/robots/main.c
+++ b/games/robots/main.c
@@ -76,7 +76,7 @@ char **av;
else {
Scorefile = av[0];
# ifdef FANCY
- sp = rindex(Scorefile, '/');
+ sp = strrchr(Scorefile, '/');
if (sp == NULL)
sp = Scorefile;
if (strcmp(sp, "pattern_roll") == 0)
diff --git a/games/sail/main.c b/games/sail/main.c
index 9f8b0f4624d..3d32adbe96b 100644
--- a/games/sail/main.c
+++ b/games/sail/main.c
@@ -59,7 +59,7 @@ main(argc, argv)
(void) srand(getpid());
issetuid = getuid() != geteuid();
- if (p = rindex(*argv, '/'))
+ if (p = strrchr(*argv, '/'))
p++;
else
p = *argv;
diff --git a/kerberosIV/kdb/krb_lib.c b/kerberosIV/kdb/krb_lib.c
index 7763e455cf2..83167a16dd4 100644
--- a/kerberosIV/kdb/krb_lib.c
+++ b/kerberosIV/kdb/krb_lib.c
@@ -1,4 +1,4 @@
-/* $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
@@ -108,8 +108,8 @@ kerb_get_principal(name, inst, principal, max, more)
* 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) {
@@ -214,8 +214,8 @@ kerb_get_dba(name, inst, dba, max, more)
*/
wild = 0;
- if (index(name, '*') || index(name, '?') ||
- index(inst, '*') || index(inst, '?'))
+ if (strchr(name, '*') || strchr(name, '?') ||
+ strchr(inst, '*') || strchr(inst, '?'))
wild = 1;
if (!wild) {
diff --git a/kerberosIV/krb/get_in_tkt.c b/kerberosIV/krb/get_in_tkt.c
index 55624978669..55855750468 100644
--- a/kerberosIV/krb/get_in_tkt.c
+++ b/kerberosIV/krb/get_in_tkt.c
@@ -150,7 +150,7 @@ krb_get_pw_in_tkt(user, instance, realm, service, sinstance, life, password)
#ifdef NOENCRYPTION
/*
* $Source: /cvs/OpenBSD/src/kerberosIV/krb/Attic/get_in_tkt.c,v $
- * $Author: tholo $
+ * $Author: millert $
*
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* of Technology.
@@ -165,7 +165,7 @@ krb_get_pw_in_tkt(user, instance, realm, service, sinstance, life, password)
#ifndef lint
static char rcsid_read_password_c[] =
-"Bones$Header: /cvs/OpenBSD/src/kerberosIV/krb/Attic/get_in_tkt.c,v 1.2 1996/02/05 10:06:40 tholo Exp $";
+"Bones$Header: /cvs/OpenBSD/src/kerberosIV/krb/Attic/get_in_tkt.c,v 1.3 1997/01/17 07:11:54 millert Exp $";
#endif /* lint */
#include <des.h>
@@ -251,7 +251,7 @@ placebo_read_pw_string(s,max,prompt,verify)
clearerr(stdin);
continue;
}
- if ((ptr = index(s, '\n')))
+ if ((ptr = strchr(s, '\n')))
*ptr = '\0';
if (verify) {
printf("\nVerifying, please re-enter %s",prompt);
@@ -260,7 +260,7 @@ placebo_read_pw_string(s,max,prompt,verify)
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");
diff --git a/lib/libkvm.old/kvm.c b/lib/libkvm.old/kvm.c
index 90e61885c34..3848a606289 100644
--- a/lib/libkvm.old/kvm.c
+++ b/lib/libkvm.old/kvm.c
@@ -1,4 +1,4 @@
-/* $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 $ */
@@ -363,7 +363,7 @@ kvm_dbopen(kd, uf)
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);
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index bafe6eeefb4..d18e12b4441 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -42,7 +42,7 @@
#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 */
@@ -712,7 +712,7 @@ kvm_dbopen(kd, uf)
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);
diff --git a/libexec/getNAME/getNAME.c b/libexec/getNAME/getNAME.c
index 5148e6ad1c6..c6a859ee85b 100644
--- a/libexec/getNAME/getNAME.c
+++ b/libexec/getNAME/getNAME.c
@@ -39,7 +39,7 @@ char copyright[] =
#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 */
/*
@@ -181,7 +181,7 @@ split(line, name)
register char *cp, *dp;
char *sp, *sep;
- cp = index(line, '-');
+ cp = strchr(line, '-');
if (cp == 0)
return;
sp = cp + 1;
@@ -191,7 +191,7 @@ split(line, name)
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;
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c
index a24cab92a71..4218c5f1da6 100644
--- a/libexec/mail.local/mail.local.c
+++ b/libexec/mail.local/mail.local.c
@@ -39,7 +39,7 @@ char copyright[] =
#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>
@@ -209,7 +209,7 @@ store(from)
}
/* 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);
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index 8a013840d52..cebbe44d5ba 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -39,7 +39,7 @@ char copyright[] =
#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>
@@ -239,7 +239,7 @@ doit(f, fromp)
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
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index a2b49d11e3d..e6c735449fe 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -39,7 +39,7 @@ static char copyright[] =
#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 */
/*
@@ -609,7 +609,7 @@ void
setup_term(fd)
int fd;
{
- register char *cp = index(term+ENVSIZE, '/');
+ register char *cp = strchr(term+ENVSIZE, '/');
char *speed;
struct termios tt;
@@ -618,7 +618,7 @@ setup_term(fd)
if (cp) {
*cp++ = '\0';
speed = cp;
- cp = index(speed, '/');
+ cp = strchr(speed, '/');
if (cp)
*cp++ = '\0';
cfsetspeed(&tt, atoi(speed));
@@ -632,7 +632,7 @@ setup_term(fd)
if (cp) {
*cp++ = '\0';
speed = cp;
- cp = index(speed, '/');
+ cp = strchr(speed, '/');
if (cp)
*cp++ = '\0';
tcgetattr(fd, &tt);
diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c
index cc7aaf9ebce..315ed9a9fdb 100644
--- a/libexec/rpc.rquotad/rquotad.c
+++ b/libexec/rpc.rquotad/rquotad.c
@@ -313,7 +313,7 @@ hasquota(fs, qfnamep)
}
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;
diff --git a/regress/lib/libc/db/dbtest.c b/regress/lib/libc/db/dbtest.c
index ac9eaa48fdc..9ef76f7f347 100644
--- a/regress/lib/libc/db/dbtest.c
+++ b/regress/lib/libc/db/dbtest.c
@@ -530,12 +530,12 @@ u_int
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);
@@ -592,9 +592,9 @@ setinfo(type, s)
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))
@@ -688,10 +688,10 @@ rfile(name, lenp)
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))
diff --git a/sbin/ipf/ipf.c b/sbin/ipf/ipf.c
index 89508c72535..2025449699e 100644
--- a/sbin/ipf/ipf.c
+++ b/sbin/ipf/ipf.c
@@ -13,9 +13,6 @@
#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>
@@ -37,7 +34,7 @@ extern char *index();
#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
@@ -180,14 +177,14 @@ char *name, *file;
/*
* 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)
@@ -251,17 +248,17 @@ char *opt;
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");
diff --git a/sbin/ipf/parse.c b/sbin/ipf/parse.c
index 7e9cf1ef551..19e093bf390 100644
--- a/sbin/ipf/parse.c
+++ b/sbin/ipf/parse.c
@@ -34,7 +34,7 @@
#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[];
@@ -423,7 +423,7 @@ char *to;
int r = 0;
char *s;
- s = index(to, ':');
+ s = strchr(to, ':');
fdp->fd_ifp = NULL;
if (s) {
*s++ = '\0';
@@ -465,13 +465,13 @@ u_char *cp;
/*
* 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
*/
@@ -651,7 +651,7 @@ u_char *mask;
fp = &tcpfm;
continue;
}
- if (!(t = index(flagset, *s))) {
+ if (!(t = strchr(flagset, *s))) {
(void)fprintf(stderr, "unknown flag (%c)\n", *s);
return 0;
}
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 1b2fe05b1b3..99eb7889b89 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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 */
@@ -74,7 +74,7 @@ main(argc, argv)
char *p, *user;
/* Get our name */
- p = rindex(*argv, '/');
+ p = strrchr(*argv, '/');
if(p == NULL) p = *argv;
else p++;
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index 2620c9b3ff5..7e632ebea6c 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -1,4 +1,4 @@
-/* $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
@@ -559,7 +559,7 @@ getnet(char *name,
/* 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;
diff --git a/sbin/routed/rtquery/rtquery.c b/sbin/routed/rtquery/rtquery.c
index 289947ff122..5d9273486cd 100644
--- a/sbin/routed/rtquery/rtquery.c
+++ b/sbin/routed/rtquery/rtquery.c
@@ -1,4 +1,4 @@
-/* $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
@@ -616,7 +616,7 @@ getnet(char *name,
/* 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;
diff --git a/sys/arch/amiga/stand/binpatch/binpatch.c b/sys/arch/amiga/stand/binpatch/binpatch.c
index 60d04a0dc94..4b123971d57 100644
--- a/sys/arch/amiga/stand/binpatch/binpatch.c
+++ b/sys/arch/amiga/stand/binpatch/binpatch.c
@@ -1,4 +1,4 @@
-/* $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 ??? */
@@ -398,7 +398,7 @@ static void FindOffset(char *symbol,u_long *index)
*/
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)
diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c
index 565532d286c..0f48dcbaf42 100644
--- a/usr.bin/compress/compress.c
+++ b/usr.bin/compress/compress.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#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 */
@@ -87,7 +87,7 @@ main(argc, argv)
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;
@@ -147,7 +147,7 @@ main(argc, argv)
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);
@@ -166,7 +166,7 @@ main(argc, 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);
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 6a4350536f7..0cdaf6a1f42 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -48,7 +48,7 @@ char copyright[] =
#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 */
/*
@@ -188,7 +188,6 @@ userlist(argc, argv)
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");
@@ -197,7 +196,7 @@ userlist(argc, argv)
/* 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;
}
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index 4064dc86711..bba31a796cc 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -38,7 +38,7 @@
#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>
@@ -60,9 +60,9 @@ netfinger(name)
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) {
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index 599dffc652f..86e5d453f6c 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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>
@@ -288,7 +288,7 @@ split(line)
*/
if (*cp == '\0') {
*cp2++ = ' ';
- if (index(".:!", cp[-1]))
+ if (strchr(".:!", cp[-1]))
*cp2++ = ' ';
}
while (*cp == ' ')
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index b8b0bf996ac..b6a237cfe76 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -35,7 +35,7 @@
#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>
@@ -201,7 +201,7 @@ bpad(pr)
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++);
}
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
index 10281f47d65..18d11309caa 100644
--- a/usr.bin/hexdump/parse.c
+++ b/usr.bin/hexdump/parse.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -35,7 +35,7 @@
#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>
@@ -61,7 +61,7 @@ addfile(name)
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;
@@ -171,7 +171,7 @@ size(fs)
* 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));
@@ -243,10 +243,10 @@ rewrite(fs)
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);
diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
index a014f3ab551..f915bc9cc52 100644
--- a/usr.bin/locate/locate/fastfind.c
+++ b/usr.bin/locate/locate/fastfind.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -36,7 +36,7 @@
* 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_
@@ -172,7 +172,7 @@ fastfind
/* 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')
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index ce4c3ad90fc..95ff600c75f 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -1,4 +1,4 @@
-/* $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
@@ -35,7 +35,7 @@
* 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 $
*/
@@ -162,7 +162,7 @@ patprep(name)
/* skip trailing metacharacters */
for (; p >= name; p--)
- if (index(LOCATE_REG, *p) == NULL)
+ if (strchr(LOCATE_REG, *p) == NULL)
break;
/*
@@ -172,7 +172,7 @@ patprep(name)
* |----< 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;
@@ -183,7 +183,7 @@ patprep(name)
* '*\*[a-z]'
* |-------< p
*/
- if (p >= name && index(LOCATE_REG, *p) != NULL)
+ if (p >= name && strchr(LOCATE_REG, *p) != NULL)
p = name - 1;
}
@@ -193,7 +193,7 @@ patprep(name)
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));)
diff --git a/usr.bin/mail/aux.c b/usr.bin/mail/aux.c
index 66bf4e73a7e..287edc12897 100644
--- a/usr.bin/mail/aux.c
+++ b/usr.bin/mail/aux.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -414,7 +414,7 @@ nameof(mp, reptype)
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--;
@@ -466,8 +466,8 @@ skin(name)
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;
@@ -592,24 +592,24 @@ newname:
*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;
}
@@ -644,7 +644,7 @@ anyof(s1, s2)
{
while (*s1)
- if (index(s2, *s1++))
+ if (strchr(s2, *s1++))
return 1;
return 0;
}
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c
index 1813bdc09ff..80e0bdbe7d5 100644
--- a/usr.bin/mail/fio.c
+++ b/usr.bin/mail/fio.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -398,7 +398,7 @@ expand(name)
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;
}
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c
index 36dccc59a13..d1be3133e98 100644
--- a/usr.bin/mail/lex.c
+++ b/usr.bin/mail/lex.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -282,7 +282,7 @@ execute(linebuf, contxt)
return(0);
}
cp2 = word;
- while (*cp && index(" \t0123456789$^.:/-+*'\"", *cp) == NOSTR)
+ while (*cp && strchr(" \t0123456789$^.:/-+*'\"", *cp) == NOSTR)
*cp2++ = *cp++;
*cp2 = '\0';
diff --git a/usr.bin/mail/list.c b/usr.bin/mail/list.c
index dea57d67666..ddae30f7b84 100644
--- a/usr.bin/mail/list.c
+++ b/usr.bin/mail/list.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -705,7 +705,7 @@ matchsubj(str, mesg)
* 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] = ':';
diff --git a/usr.bin/mail/names.c b/usr.bin/mail/names.c
index 7a8a8153715..5378dfd6698 100644
--- a/usr.bin/mail/names.c
+++ b/usr.bin/mail/names.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -204,7 +204,7 @@ yankword(ap, wbuf)
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;
diff --git a/usr.bin/more/more.c b/usr.bin/more/more.c
index 7c14add7f6a..a53ee5563d8 100644
--- a/usr.bin/more/more.c
+++ b/usr.bin/more/more.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -201,9 +201,7 @@ char *argv[];
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);
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index d827d215c27..12d1be9dee4 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -136,7 +136,7 @@ intpr(interval, ifnetaddr)
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';
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index bc33664379a..7b5873666ec 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -434,7 +434,7 @@ inetprint(in, port, proto)
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)
@@ -464,7 +464,7 @@ inetname(inp)
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;
@@ -482,7 +482,7 @@ inetname(inp)
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;
diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c
index 7e0a76bd907..6f5d6af88ef 100644
--- a/usr.bin/netstat/iso.c
+++ b/usr.bin/netstat/iso.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -419,7 +419,7 @@ isonetprint(iso, sufx, sufxlen, islocal)
int Alen = Aflag?18:22;
line = isonetname(iso);
- cp = index(line, '\0');
+ cp = strchr(line, '\0');
ihe = (struct iso_hostent *)0;
if( islocal )
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 387b4e9ffce..e0645de89fc 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
@@ -497,7 +497,7 @@ routename(in)
if (first) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ (cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
domain[0] = 0;
@@ -507,7 +507,7 @@ routename(in)
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;
diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c
index 514227f4d4a..a63f6159c35 100644
--- a/usr.bin/paste/paste.c
+++ b/usr.bin/paste/paste.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -44,7 +44,7 @@ char copyright[] =
#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>
@@ -149,7 +149,7 @@ parallel(argv)
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);
@@ -192,7 +192,7 @@ sequential(argv)
}
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);
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index be4b7f4ac61..2c438db0789 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $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
*
@@ -9,7 +9,7 @@
*/
#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"
@@ -301,7 +301,7 @@ char **argv;
Strcpy(rejname, outname);
#ifndef FLEXFILENAMES
{
- char *s = rindex(rejname,'/');
+ char *s = strrchr(rejname,'/');
if (!s)
s = rejname;
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index 027397207a9..006ceba0518 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -43,7 +43,7 @@ char copyright[] =
#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>
@@ -190,16 +190,16 @@ main(argc, argv)
}
/* 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);
@@ -446,7 +446,7 @@ getint()
if (!*gargv)
return(0);
- if (index(number, **gargv))
+ if (strchr(number, **gargv))
return(atoi(*gargv++));
return 0;
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index 666c78454e7..617f7f14f7f 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -1,4 +1,4 @@
-/* $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
@@ -44,7 +44,7 @@ static char copyright[] =
#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 */
/*
@@ -507,7 +507,7 @@ ufshasquota(fs, type, qfnamep)
}
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;
diff --git a/usr.bin/ranlib/misc.c b/usr.bin/ranlib/misc.c
index c688af4aaec..01370e93a59 100644
--- a/usr.bin/ranlib/misc.c
+++ b/usr.bin/ranlib/misc.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -38,7 +38,7 @@
#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>
@@ -101,7 +101,7 @@ rname(path)
{
register char *ind;
- return((ind = rindex(path, '/')) ? ind + 1 : path);
+ return((ind = strrchr(path, '/')) ? ind + 1 : path);
}
badfmt()
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
index 51e72d9d2fb..b02d50b3de8 100644
--- a/usr.bin/rlogin/rlogin.c
+++ b/usr.bin/rlogin/rlogin.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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 */
@@ -164,7 +164,7 @@ main(argc, argv)
one = 1;
host = user = NULL;
- if (p = rindex(argv[0], '/'))
+ if (p = strrchr(argv[0], '/'))
++p;
else
p = argv[0];
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
index dd34d13ce94..3a2d9ca8a51 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -1,4 +1,4 @@
-/* $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
@@ -29,7 +29,7 @@
*/
#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>
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
int ch;
extern int optind;
- if (!(argv0 = rindex(argv[0], '/')))
+ if (!(argv0 = strrchr(argv[0], '/')))
argv0 = argv[0];
else
argv0++;
diff --git a/usr.bin/sup/src/ci.c b/usr.bin/sup/src/ci.c
index 772f36dc384..ed5acd2db75 100644
--- a/usr.bin/sup/src/ci.c
+++ b/usr.bin/sup/src/ci.c
@@ -1,4 +1,4 @@
-/* $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
@@ -145,7 +145,7 @@
#include <ci.h>
#include <del.h>
-char *index(),*getenv(),*rindex();
+char *getenv();
extern char _argbreak;
long atol();
double atof();
@@ -295,7 +295,7 @@ char *cmdfpath; /* search list for command files */
/* 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'))) {
@@ -383,7 +383,7 @@ char *cmdfpath; /* search list for command files */
break;
default: /* list cmds, etc. */
- equals = index (cmd,'=');
+ equals = strchr (cmd,'=');
if (equals == cmd) cmd++;
if (equals) {
@@ -397,7 +397,7 @@ char *cmdfpath; /* search list for command files */
*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");
@@ -555,7 +555,7 @@ char *topic,*helppath;
}
}
else { /* chop at * */
- star = index (topic,'*');
+ star = strchr (topic,'*');
if (star) *star = 0;
}
@@ -787,7 +787,7 @@ char *arg;
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) =
diff --git a/usr.bin/sup/src/expand.c b/usr.bin/sup/src/expand.c
index 9716d914a76..a379567c395 100644
--- a/usr.bin/sup/src/expand.c
+++ b/usr.bin/sup/src/expand.c
@@ -1,4 +1,4 @@
-/* $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
@@ -134,7 +134,7 @@ static void glob(as)
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;
diff --git a/usr.bin/sup/src/stree.c b/usr.bin/sup/src/stree.c
index eadb38f3582..0e2287d9e79 100644
--- a/usr.bin/sup/src/stree.c
+++ b/usr.bin/sup/src/stree.c
@@ -1,4 +1,4 @@
-/* $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
@@ -30,6 +30,9 @@
**********************************************************************
* 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
*
@@ -277,7 +280,7 @@ char *p;
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)
diff --git a/usr.bin/systat/disks.c b/usr.bin/systat/disks.c
index c5e564debc5..ca43095f3bc 100644
--- a/usr.bin/systat/disks.c
+++ b/usr.bin/systat/disks.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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"
@@ -76,9 +76,8 @@ dkselect(args, truefalse, selections)
{
register char *cp;
register int i;
- char *index();
- cp = index(args, '\n');
+ cp = strchr(args, '\n');
if (cp)
*cp = '\0';
for (;;) {
diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c
index e362dd508a9..32ad7266690 100644
--- a/usr.bin/systat/netcmds.c
+++ b/usr.bin/systat/netcmds.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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 */
/*
@@ -132,9 +132,8 @@ changeitems(args, onoff)
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) {
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c
index bccc93f97b6..d51730c4e38 100644
--- a/usr.bin/systat/netstat.c
+++ b/usr.bin/systat/netstat.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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 */
/*
@@ -385,10 +385,10 @@ inetprint(in, port, proto)
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)
@@ -396,7 +396,7 @@ inetprint(in, port, proto)
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';
diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c
index 6a1ec23ae05..f4c0e8efb2b 100644
--- a/usr.bin/talk/get_names.c
+++ b/usr.bin/talk/get_names.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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>
@@ -50,7 +50,6 @@ static char rcsid[] = "$OpenBSD: get_names.c,v 1.2 1996/06/26 05:40:22 deraadt E
char *getlogin();
char *ttyname();
-char *rindex();
extern CTL_MSG msg;
/*
@@ -88,7 +87,7 @@ get_names(argc, argv)
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 */
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 1c484c0fd45..b70dfde2a98 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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> */
@@ -152,8 +152,6 @@ struct cmd cmdtab[] = {
struct cmd *getcmd();
char *tail();
-char *index();
-char *rindex();
int
main(argc, argv)
@@ -340,17 +338,17 @@ put(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) {
@@ -383,7 +381,7 @@ put(argc, argv)
}
/* 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]));
@@ -435,13 +433,13 @@ get(argc, argv)
}
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 {
@@ -583,7 +581,7 @@ tail(filename)
register char *s;
while (*filename) {
- s = rindex(filename, '/');
+ s = strrchr(filename, '/');
if (s == NULL)
break;
if (s[1])
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index d813f9bc55b..faa33f7f892 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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> */
@@ -383,7 +383,6 @@ tpacket(s, tp, n)
{ "#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);
@@ -395,7 +394,7 @@ tpacket(s, tp, n)
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;
diff --git a/usr.bin/tip/aculib/courier.c b/usr.bin/tip/aculib/courier.c
index 1b3949c43ca..36b64b9e8c3 100644
--- a/usr.bin/tip/aculib/courier.c
+++ b/usr.bin/tip/aculib/courier.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
/*
@@ -280,8 +280,8 @@ coursync()
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);
}
/*
diff --git a/usr.bin/tip/aculib/hayes.c b/usr.bin/tip/aculib/hayes.c
index ad3329bd6cb..d5b28f33859 100644
--- a/usr.bin/tip/aculib/hayes.c
+++ b/usr.bin/tip/aculib/hayes.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
/*
@@ -304,8 +304,8 @@ hay_sync()
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';
diff --git a/usr.bin/tip/aculib/t3000.c b/usr.bin/tip/aculib/t3000.c
index ae704882457..57a3a10fb1f 100644
--- a/usr.bin/tip/aculib/t3000.c
+++ b/usr.bin/tip/aculib/t3000.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
/*
@@ -298,8 +298,8 @@ if (len == 0) len = 1;
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);
}
/*
diff --git a/usr.bin/tip/aculib/ventel.c b/usr.bin/tip/aculib/ventel.c
index e46498006af..a885710ce52 100644
--- a/usr.bin/tip/aculib/ventel.c
+++ b/usr.bin/tip/aculib/ventel.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -38,7 +38,7 @@
#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 */
/*
@@ -71,7 +71,7 @@ ven_dialer(num, acu)
{
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;
@@ -115,10 +115,10 @@ ven_dialer(num, acu)
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) {
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
index 89da12674bb..a4121f0ad3a 100644
--- a/usr.bin/tr/str.c
+++ b/usr.bin/tr/str.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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>
@@ -141,7 +141,7 @@ bracket(s)
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);
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index 6b8e1b7f649..bbe63ddd2c0 100644
--- a/usr.bin/tset/map.c
+++ b/usr.bin/tset/map.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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>
@@ -136,7 +136,7 @@ next: if (*arg == ':') {
goto badmopt;
++arg;
} else { /* Optional baudrate. */
- arg = index(p = arg, ':');
+ arg = strchr(p = arg, ':');
if (arg == NULL)
goto badmopt;
*arg++ = '\0';
diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c
index a773f92fd24..e1c0f0bf2da 100644
--- a/usr.bin/tset/term.c
+++ b/usr.bin/tset/term.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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>
@@ -78,7 +78,7 @@ get_termcap_entry(userarg, tcapbufp)
/* 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;
@@ -151,7 +151,7 @@ askuser(dflt)
return (dflt);
}
- if (p = index(answer, '\n'))
+ if (p = strchr(answer, '\n'))
*p = '\0';
if (answer[0])
return (answer);
diff --git a/usr.bin/tset/wrterm.c b/usr.bin/tset/wrterm.c
index 9fb1b10854e..be06c172545 100644
--- a/usr.bin/tset/wrterm.c
+++ b/usr.bin/tset/wrterm.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -38,7 +38,7 @@
#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>
@@ -60,7 +60,7 @@ wrtermcap(bp)
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';
diff --git a/usr.bin/uudecode/uudecode.c b/usr.bin/uudecode/uudecode.c
index 8225aff90c0..5b6d750dc4f 100644
--- a/usr.bin/uudecode/uudecode.c
+++ b/usr.bin/uudecode/uudecode.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -42,7 +42,7 @@ char copyright[] =
#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 */
/*
@@ -119,7 +119,7 @@ decode()
/* 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);
diff --git a/usr.bin/vacation/vacation.c b/usr.bin/vacation/vacation.c
index b04d24a4fe4..e9ccc2a6063 100644
--- a/usr.bin/vacation/vacation.c
+++ b/usr.bin/vacation/vacation.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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 */
/*
@@ -216,7 +216,7 @@ readheaders()
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);
@@ -227,7 +227,7 @@ readheaders()
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)
@@ -305,9 +305,9 @@ junkmail()
*
* 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;
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index a5537513eb9..cf32afd62fb 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#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>
@@ -148,7 +148,7 @@ who_am_i(ufp)
/* 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)) {
diff --git a/usr.bin/window/lcmd1.c b/usr.bin/window/lcmd1.c
index 0b7d1110ebd..4618724713a 100644
--- a/usr.bin/window/lcmd1.c
+++ b/usr.bin/window/lcmd1.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -41,7 +41,7 @@
#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 */
@@ -109,7 +109,7 @@ register struct value *a;
*pp = a->v_str;
*pp = 0;
shf = *(sh = argv);
- if (*sh = rindex(shf, '/'))
+ if (*sh = strrchr(shf, '/'))
(*sh)++;
else
*sh = shf;
diff --git a/usr.bin/window/lcmd2.c b/usr.bin/window/lcmd2.c
index 6b7d8a22afb..6a012bbcd97 100644
--- a/usr.bin/window/lcmd2.c
+++ b/usr.bin/window/lcmd2.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -41,7 +41,7 @@
#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 */
@@ -285,7 +285,7 @@ l_def_shell(v, a)
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;
diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c
index 4f2303676bd..422a5ef0390 100644
--- a/usr.bin/window/main.c
+++ b/usr.bin/window/main.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -47,7 +47,7 @@ char copyright[] =
#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 */
@@ -72,7 +72,7 @@ char **argv;
char tflag = 0;
escapec = ESCAPEC;
- if (p = rindex(*argv, '/'))
+ if (p = strrchr(*argv, '/'))
p++;
else
p = *argv;
@@ -118,7 +118,7 @@ char **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;
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 05fb9f3ba61..309eff38bf5 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#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>
@@ -228,7 +228,7 @@ install(from_name, to_name, fset, flags)
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;
diff --git a/usr.bin/yacc/test/ftp.tab.c b/usr.bin/yacc/test/ftp.tab.c
index 177b1f9ea5b..071970fe365 100644
--- a/usr.bin/yacc/test/ftp.tab.c
+++ b/usr.bin/yacc/test/ftp.tab.c
@@ -1,6 +1,6 @@
#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
@@ -16,7 +16,7 @@ static char yyrcsid[] = "$OpenBSD: ftp.tab.c,v 1.2 1996/04/21 23:45:32 deraadt E
#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>
@@ -60,7 +60,6 @@ static int cmd_bytesz;
char cbuf[512];
char *fromname;
-char *index();
#line 65 "ftp.tab.c"
#define A 257
#define B 258
@@ -586,7 +585,7 @@ yylex()
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';
}
diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c
index 3c437c24f37..f227b174959 100644
--- a/usr.sbin/chown/chown.c
+++ b/usr.sbin/chown/chown.c
@@ -39,7 +39,7 @@ static char copyright[] =
#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>
@@ -78,7 +78,7 @@ main(argc, argv)
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;
diff --git a/usr.sbin/config.old/mkmakefile.c b/usr.sbin/config.old/mkmakefile.c
index c99a1be47ed..18924797021 100644
--- a/usr.sbin/config.old/mkmakefile.c
+++ b/usr.sbin/config.old/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -358,7 +358,7 @@ tail(fn)
{
register char *cp;
- cp = rindex(fn, '/');
+ cp = strrchr(fn, '/');
if (cp == 0)
return (fn);
return (cp+1);
diff --git a/usr.sbin/config.old/specfile.c b/usr.sbin/config.old/specfile.c
index 01a150c2eaf..b7224b7224c 100644
--- a/usr.sbin/config.old/specfile.c
+++ b/usr.sbin/config.old/specfile.c
@@ -1,4 +1,4 @@
-/* $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
@@ -433,7 +433,7 @@ read_file(filename, fatal_on_open, override)
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;
diff --git a/usr.sbin/config/files.c b/usr.sbin/config/files.c
index 0dc14a154a4..8d7eda6a391 100644
--- a/usr.sbin/config/files.c
+++ b/usr.sbin/config/files.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -123,12 +123,12 @@ addfile(path, optx, flags, rule)
}
/* 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);
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index b1e2af1c6c3..1373a6bcd9a 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -42,7 +42,7 @@ static char copyright[] =
#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 */
/*
@@ -730,7 +730,7 @@ hasquota(fs, type, qfnamep)
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
@@ -741,7 +741,7 @@ hasquota(fs, type, qfnamep)
}
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;
diff --git a/usr.sbin/ipftest/ipft_hx.c b/usr.sbin/ipftest/ipft_hx.c
index 46c795778cf..454a8f93fbc 100644
--- a/usr.sbin/ipftest/ipft_hx.c
+++ b/usr.sbin/ipftest/ipft_hx.c
@@ -39,7 +39,7 @@
#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;
@@ -93,14 +93,14 @@ int cnt, *dir;
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;
diff --git a/usr.sbin/ipftest/ipft_tx.c b/usr.sbin/ipftest/ipft_tx.c
index af71291e8c8..39c53c43d75 100644
--- a/usr.sbin/ipftest/ipft_tx.c
+++ b/usr.sbin/ipftest/ipft_tx.c
@@ -39,7 +39,7 @@
#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;
@@ -177,11 +177,11 @@ int cnt, *dir;
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;
@@ -264,7 +264,7 @@ int *out;
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;
@@ -280,7 +280,7 @@ int *out;
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;
@@ -296,7 +296,7 @@ int *out;
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++;
@@ -310,7 +310,7 @@ int *out;
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;
diff --git a/usr.sbin/ipftest/ipt.c b/usr.sbin/ipftest/ipt.c
index 584ea41e8cf..4fc23c0f6eb 100644
--- a/usr.sbin/ipftest/ipt.c
+++ b/usr.sbin/ipftest/ipt.c
@@ -41,7 +41,7 @@
#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();
@@ -131,14 +131,14 @@ char *argv[];
/*
* 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)
diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c
index 70f1cb5246e..f2604766257 100644
--- a/usr.sbin/mtree/spec.c
+++ b/usr.sbin/mtree/spec.c
@@ -1,5 +1,5 @@
/* $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
@@ -38,7 +38,7 @@
#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 */
@@ -78,7 +78,7 @@ spec()
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. */
@@ -123,7 +123,7 @@ spec()
continue;
}
- if (index(p, '/'))
+ if (strchr(p, '/'))
err("slash character in file name");
if (!strcmp(p, "..")) {
diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c
index 333032ade08..1d1afddc21b 100644
--- a/usr.sbin/pkg_install/add/futil.c
+++ b/usr.sbin/pkg_install/add/futil.c
@@ -1,7 +1,7 @@
-/* $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
/*
@@ -42,7 +42,7 @@ make_hierarchy(char *dir)
else
cp1 = cp2 = dir;
while (cp2) {
- if ((cp2 = index(cp1, '/')) !=NULL )
+ if ((cp2 = strchr(cp1, '/')) !=NULL )
*cp2 = '\0';
if (fexists(dir)) {
if (!isdir(dir))
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 2eac5e98bad..83ceae813a2 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -1,7 +1,7 @@
-/* $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
/*
@@ -62,7 +62,7 @@ pkg_perform(char **pkgs)
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';
}
@@ -205,7 +205,7 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
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";
@@ -219,7 +219,7 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
}
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);
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 1434d6feb4b..219dc8aed70 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -1,7 +1,7 @@
-/* $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
/*
@@ -440,10 +440,10 @@ unpack(char *pkg, char *flist)
* 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");
}
}
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c
index 5cbc7aa25d7..b901fc28cdf 100644
--- a/usr.sbin/pkg_install/lib/plist.c
+++ b/usr.sbin/pkg_install/lib/plist.c
@@ -1,6 +1,6 @@
-/* $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
/*
@@ -430,7 +430,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs)
if (!nukedirs)
return 0;
while (cp2) {
- if ((cp2 = rindex(cp1, '/')) != NULL)
+ if ((cp2 = strrchr(cp1, '/')) != NULL)
*cp2 = '\0';
if (!isemptydir(dir))
return 0;
diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c
index faaf3ba7579..899fa6003cf 100644
--- a/usr.sbin/pkg_install/lib/str.c
+++ b/usr.sbin/pkg_install/lib/str.c
@@ -1,7 +1,7 @@
-/* $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
/*
@@ -84,7 +84,7 @@ suffix(char *str, char *suff)
char *idx;
Boolean ret = FALSE;
- idx = rindex(str, '.');
+ idx = strrchr(str, '.');
if (idx && !strcmp(idx + 1, suff))
ret = TRUE;
return ret;
@@ -96,7 +96,7 @@ nuke_suffix(char *str)
{
char *idx;
- idx = rindex(str, '.');
+ idx = strrchr(str, '.');
if (idx)
*idx = '\0'; /* Yow! Don't try this on a const! */
}
diff --git a/usr.sbin/quotaon/quotaon.c b/usr.sbin/quotaon/quotaon.c
index c9622ac30e1..8091b32ac7c 100644
--- a/usr.sbin/quotaon/quotaon.c
+++ b/usr.sbin/quotaon/quotaon.c
@@ -42,7 +42,7 @@ static char copyright[] =
#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 */
/*
@@ -69,14 +69,14 @@ main(argc, argv)
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)
@@ -206,7 +206,7 @@ hasquota(fs, type, qfnamep)
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
@@ -217,7 +217,7 @@ hasquota(fs, type, qfnamep)
}
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;
diff --git a/usr.sbin/rbootd/parseconf.c b/usr.sbin/rbootd/parseconf.c
index e96e9275d73..5293098f724 100644
--- a/usr.sbin/rbootd/parseconf.c
+++ b/usr.sbin/rbootd/parseconf.c
@@ -130,7 +130,7 @@ ParseConfig()
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' */
diff --git a/usr.sbin/rbootd/rmpproto.c b/usr.sbin/rbootd/rmpproto.c
index 83e2ebe74d9..13581b4dcc8 100644
--- a/usr.sbin/rbootd/rmpproto.c
+++ b/usr.sbin/rbootd/rmpproto.c
@@ -341,7 +341,7 @@ SendBootRepl(req, rconn, filelist)
* 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.
diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c
index e3fcdb3d51f..07a5504d04c 100644
--- a/usr.sbin/repquota/repquota.c
+++ b/usr.sbin/repquota/repquota.c
@@ -42,7 +42,7 @@ static char copyright[] =
#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 */
/*
@@ -280,7 +280,7 @@ hasquota(fs, type, qfnamep)
char **qfnamep;
{
register char *opt;
- char *cp, *index(), *strtok();
+ char *cp;
static char initname, usrname[100], grpname[100];
static char buf[BUFSIZ];
@@ -291,7 +291,7 @@ hasquota(fs, type, qfnamep)
}
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;
diff --git a/usr.sbin/rpc.bootparamd/bootparamd.c b/usr.sbin/rpc.bootparamd/bootparamd.c
index b92c72966b6..8a6fc90fa5f 100644
--- a/usr.sbin/rpc.bootparamd/bootparamd.c
+++ b/usr.sbin/rpc.bootparamd/bootparamd.c
@@ -6,7 +6,7 @@
* 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>
@@ -64,7 +64,6 @@ main(argc, argv)
{
SVCXPRT *transp;
int i, s, pid;
- char *rindex();
struct hostent *he;
struct stat buf;
char *optstring;
@@ -204,7 +203,7 @@ bootparamproc_getfile_1_svc(getfile, rqstp)
bp_getfile_arg *getfile;
struct svc_req *rqstp;
{
- char *where, *index();
+ char *where;
static bp_getfile_res res;
int err;
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index 7f2db8784f1..bbc3add8796 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -39,7 +39,7 @@ static char copyright[] =
#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>
@@ -145,7 +145,7 @@ main(argc, argv)
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';
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index b52183a7cc7..91752c46c2e 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -817,7 +817,7 @@ inetname(in)
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;
@@ -826,7 +826,7 @@ inetname(in)
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;
diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c
index a3f025be54e..2a80257c9c0 100644
--- a/usr.sbin/ypserv/makedbm/makedbm.c
+++ b/usr.sbin/ypserv/makedbm/makedbm.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -32,7 +32,7 @@
*/
#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>
@@ -208,7 +208,7 @@ create_database(infile,database,
}
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