From 17b6171971dc09440bf50b49ed8aad333d24a1da Mon Sep 17 00:00:00 2001 From: Eirik Nygaard Date: Mon, 30 Aug 2004 19:27:22 +0000 Subject: [PATCH] Use strchr instead of index, and strrchr instead of rindex because the str*chr functions are standard compliant. index() and rindex() do the same thing as repectively strchr() and strrchr() do. Submitted by: Douwe Kiela --- bin/ln/ln.c | 4 ++-- bin/rm/rm.c | 4 ++-- bin/test/test.c | 4 ++-- sbin/disklabel/disklabel.c | 8 ++++---- sbin/dump/main.c | 4 ++-- sbin/quotacheck/quotacheck.c | 4 ++-- sbin/reboot/reboot.c | 4 ++-- usr.sbin/chown/chown.c | 4 ++-- usr.sbin/config/mkmakefile.c | 4 ++-- usr.sbin/diskpart/diskpart.c | 4 ++-- usr.sbin/edquota/edquota.c | 4 ++-- usr.sbin/inetd/inetd.c | 6 +++--- usr.sbin/mtree/spec.c | 6 +++--- usr.sbin/newsyslog/newsyslog.c | 10 +++++----- usr.sbin/quotaon/quotaon.c | 6 +++--- usr.sbin/repquota/repquota.c | 4 ++-- usr.sbin/route6d/route6d.c | 8 ++++---- usr.sbin/rtprio/rtprio.c | 4 ++-- usr.sbin/rwhod/rwhod.c | 4 ++-- usr.sbin/traceroute6/traceroute6.c | 6 +++--- usr.sbin/vnconfig/vnconfig.c | 4 ++-- 21 files changed, 53 insertions(+), 53 deletions(-) diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 22cd1c070f..e9209f1bbb 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1987, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)ln.c 8.2 (Berkeley) 3/31/94 * $FreeBSD: src/bin/ln/ln.c,v 1.15.2.4 2002/07/12 07:34:38 tjr Exp $ - * $DragonFly: src/bin/ln/ln.c,v 1.3 2004/03/19 17:17:46 cpressey Exp $ + * $DragonFly: src/bin/ln/ln.c,v 1.4 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -71,7 +71,7 @@ main(int argc, char *argv[]) * "link", for which the functionality provided is greatly * simplified. */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 287ec4f1f9..35090d3252 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1990, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)rm.c 8.5 (Berkeley) 4/18/94 * $FreeBSD: src/bin/rm/rm.c,v 1.29.2.5 2002/07/12 07:25:48 tjr Exp $ - * $DragonFly: src/bin/rm/rm.c,v 1.2 2003/06/17 04:22:50 dillon Exp $ + * $DragonFly: src/bin/rm/rm.c,v 1.3 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -78,7 +78,7 @@ main(int argc, char *argv[]) * "unlink", for which the functionality provided is greatly * simplified. */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; diff --git a/bin/test/test.c b/bin/test/test.c index 5038e20104..5c019fe44e 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -10,7 +10,7 @@ * This program is in the Public Domain. * * $FreeBSD: src/bin/test/test.c,v 1.29.2.7 2002/09/10 09:10:57 maxim Exp $ - * $DragonFly: src/bin/test/test.c,v 1.5 2004/03/19 17:17:45 cpressey Exp $ + * $DragonFly: src/bin/test/test.c,v 1.6 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -197,7 +197,7 @@ main(int argc, char **argv) int res; char *p; - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else p++; diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 089b4c281f..7a29d2bde0 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -37,7 +37,7 @@ * @(#)disklabel.c 1.2 (Symmetric) 11/28/85 * @(#)disklabel.c 8.2 (Berkeley) 1/7/94 * $FreeBSD: src/sbin/disklabel/disklabel.c,v 1.28.2.15 2003/01/24 16:18:16 des Exp $ - * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.5 2004/03/04 01:38:01 dillon Exp $ + * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.6 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -598,7 +598,7 @@ makebootarea(char *boot, struct disklabel *dp, int f) */ if (!xxboot || !bootxx) { dkbasename = np; - if ((p = rindex(dkname, '/')) == NULL) + if ((p = strrchr(dkname, '/')) == NULL) p = dkname; else p++; @@ -948,12 +948,12 @@ getasciilabel(FILE *f, struct disklabel *lp) lp->d_sbsize = SBSIZE; /* XXX */ while (fgets(line, sizeof(line) - 1, f)) { lineno++; - if ((cp = index(line,'\n')) != 0) + if ((cp = strchr(line,'\n')) != 0) *cp = '\0'; cp = skip(line); if (cp == NULL) continue; - tp = index(cp, ':'); + tp = strchr(cp, ':'); if (tp == NULL) { fprintf(stderr, "line %d: syntax error\n", lineno); errors++; diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 42de4b2bd3..7d9fbfa7af 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1980, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)main.c 8.6 (Berkeley) 5/1/95 * $FreeBSD: src/sbin/dump/main.c,v 1.20.2.9 2003/01/25 18:54:59 dillon Exp $ - * $DragonFly: src/sbin/dump/main.c,v 1.6 2004/02/04 17:39:59 joerg Exp $ + * $DragonFly: src/sbin/dump/main.c,v 1.7 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -259,7 +259,7 @@ main(int argc, char **argv) tape = strchr(host, ':'); *tape++ = '\0'; #ifdef RDUMP - if (index(tape, '\n')) { + if (strchr(tape, '\n')) { (void)fprintf(stderr, "invalid characters in tape\n"); exit(X_STARTUP); } diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c index 4b0dec4b01..e594be3937 100644 --- a/sbin/quotacheck/quotacheck.c +++ b/sbin/quotacheck/quotacheck.c @@ -36,7 +36,7 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)quotacheck.c 8.3 (Berkeley) 1/29/94 * $FreeBSD: src/sbin/quotacheck/quotacheck.c,v 1.11 1999/08/28 00:14:01 peter Exp $ - * $DragonFly: src/sbin/quotacheck/quotacheck.c,v 1.5 2003/11/01 17:16:01 drhodus Exp $ + * $DragonFly: src/sbin/quotacheck/quotacheck.c,v 1.6 2004/08/30 19:27:21 eirikn Exp $ */ /* @@ -436,7 +436,7 @@ hasquota(register struct fstab *fs, int type, char **qfnamep) } strcpy(buf, fs->fs_mntops); for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) { - if ((cp = index(opt, '=')) != NULL) + if ((cp = strchr(opt, '=')) != NULL) *cp++ = '\0'; if (type == USRQUOTA && strcmp(opt, usrname) == 0) break; diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index a399635236..71bf496796 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1980, 1986, 1993 The Regents of the University of California. All rights reserved. * @(#)reboot.c 8.1 (Berkeley) 6/5/93 * $FreeBSD: src/sbin/reboot/reboot.c,v 1.9.2.4 2002/04/28 22:50:00 wes Exp $ - * $DragonFly: src/sbin/reboot/reboot.c,v 1.3 2003/09/28 14:39:21 hmp Exp $ + * $DragonFly: src/sbin/reboot/reboot.c,v 1.4 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -65,7 +65,7 @@ main(int argc, char *argv[]) char *kernel, *p; const char *user; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + if (strstr((p = strrchr(*argv, '/')) ? p + 1 : *argv, "halt")) { dohalt = 1; howto = RB_HALT; } else diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c index 516292d81b..d5d3696f28 100644 --- a/usr.sbin/chown/chown.c +++ b/usr.sbin/chown/chown.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1988, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)chown.c 8.8 (Berkeley) 4/4/94 * $FreeBSD: src/usr.sbin/chown/chown.c,v 1.15.2.3 2002/08/07 21:24:33 schweikh Exp $ - * $DragonFly: src/usr.sbin/chown/chown.c,v 1.4 2003/11/15 23:33:35 eirikn Exp $ + * $DragonFly: src/usr.sbin/chown/chown.c,v 1.5 2004/08/30 19:27:21 eirikn Exp $ */ #include @@ -70,7 +70,7 @@ main(int argc, char **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 = vflag = 0; diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 2a69bcb76b..86084f964b 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -32,7 +32,7 @@ * * @(#)mkmakefile.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkmakefile.c,v 1.51.2.3 2001/01/23 00:09:32 peter Exp $ - * $DragonFly: src/usr.sbin/config/mkmakefile.c,v 1.11 2004/03/08 06:13:17 dillon Exp $ + * $DragonFly: src/usr.sbin/config/mkmakefile.c,v 1.12 2004/08/30 19:27:21 eirikn Exp $ */ /* @@ -659,7 +659,7 @@ tail(char *fn) { char *cp; - cp = rindex(fn, '/'); + cp = strrchr(fn, '/'); if (cp == 0) return(fn); return(cp + 1); diff --git a/usr.sbin/diskpart/diskpart.c b/usr.sbin/diskpart/diskpart.c index 76f1797768..f855bac256 100644 --- a/usr.sbin/diskpart/diskpart.c +++ b/usr.sbin/diskpart/diskpart.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1983, 1988, 1993 The Regents of the University of California. All rights reserved. * @(#)diskpart.c 8.3 (Berkeley) 11/30/94 * $FreeBSD: src/usr.sbin/diskpart/diskpart.c,v 1.11.2.2 2002/12/04 16:24:08 roam Exp $ - * $DragonFly: src/usr.sbin/diskpart/Attic/diskpart.c,v 1.5 2004/03/20 17:46:47 cpressey Exp $ + * $DragonFly: src/usr.sbin/diskpart/Attic/diskpart.c,v 1.6 2004/08/30 19:27:21 eirikn Exp $ */ /* @@ -399,7 +399,7 @@ promptfordisk(char *name) fprintf(stderr, "%s: unrecognized controller type\n", buf); fprintf(stderr, "use one of:\n"); for (tp = dktypenames; *tp; tp++) - if (index(*tp, ' ') == 0) + if (strchr(*tp, ' ') == 0) fprintf(stderr, "\t%s\n", *tp); } gettype: diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index eda5f41316..565fa181f5 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -36,7 +36,7 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)edquota.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/edquota/edquota.c,v 1.9.2.6 2002/10/31 22:38:43 iedowse Exp $ - * $DragonFly: src/usr.sbin/edquota/edquota.c,v 1.6 2004/03/15 18:10:26 dillon Exp $ + * $DragonFly: src/usr.sbin/edquota/edquota.c,v 1.7 2004/08/30 19:27:21 eirikn Exp $ */ /* @@ -792,7 +792,7 @@ hasquota(struct fstab *fs, int type, char **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/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 2697cee105..82083fa93b 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1983, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)from: inetd.c 8.4 (Berkeley) 4/13/94 * $FreeBSD: src/usr.sbin/inetd/inetd.c,v 1.80.2.11 2003/04/05 13:39:18 dwmalone Exp $ - * $DragonFly: src/usr.sbin/inetd/inetd.c,v 1.5 2004/03/20 17:46:48 cpressey Exp $ + * $DragonFly: src/usr.sbin/inetd/inetd.c,v 1.6 2004/08/30 19:27:21 eirikn Exp $ */ /* @@ -1684,7 +1684,7 @@ more: sep->se_rpc_lowvers = 0; memcpy(&sep->se_ctrladdr4, bind_sa4, sizeof(sep->se_ctrladdr4)); - if ((versp = rindex(sep->se_service, '/'))) { + if ((versp = strrchr(sep->se_service, '/'))) { *versp++ = '\0'; switch (sscanf(versp, "%u-%u", &sep->se_rpc_lowvers, @@ -1851,7 +1851,7 @@ more: } else sep->se_group = NULL; sep->se_server = newstr(sskip(&cp)); - if ((sep->se_server_name = rindex(sep->se_server, '/'))) + if ((sep->se_server_name = strrchr(sep->se_server, '/'))) sep->se_server_name++; if (strcmp(sep->se_server, "internal") == 0) { struct biltin *bi; diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c index 11b8f13320..c991caccfd 100644 --- a/usr.sbin/mtree/spec.c +++ b/usr.sbin/mtree/spec.c @@ -32,7 +32,7 @@ * * @(#)spec.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/mtree/spec.c,v 1.13.2.1 2000/06/28 02:33:17 joe Exp $ - * $DragonFly: src/usr.sbin/mtree/spec.c,v 1.5 2004/03/15 16:24:22 dillon Exp $ + * $DragonFly: src/usr.sbin/mtree/spec.c,v 1.6 2004/08/30 19:27:22 eirikn Exp $ */ #include @@ -73,7 +73,7 @@ spec(void) continue; /* Find end of line. */ - if ((p = index(buf, '\n')) == NULL) + if ((p = strchr(buf, '\n')) == NULL) errx(1, "line %d too long", lineno); /* See if next line is continuation line. */ @@ -118,7 +118,7 @@ spec(void) continue; } - if (index(p, '/')) + if (strchr(p, '/')) errx(1, "line %d: slash character in file name", lineno); diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index d105a93057..5824f9d7c8 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -17,7 +17,7 @@ * warranty. * * $FreeBSD: src/usr.sbin/newsyslog/newsyslog.c,v 1.25.2.21 2003/05/12 23:41:29 gad Exp $ - * $DragonFly: src/usr.sbin/newsyslog/newsyslog.c,v 1.2 2003/06/17 04:29:57 dillon Exp $ + * $DragonFly: src/usr.sbin/newsyslog/newsyslog.c,v 1.3 2004/08/30 19:27:22 eirikn Exp $ */ /* @@ -1186,7 +1186,7 @@ dotrim(const struct conf_entry *ent, char *log, int numdays, int flags) } else { /* relative */ /* get directory part of logfile */ strlcpy(dirpart, log, sizeof(dirpart)); - if ((p = rindex(dirpart, '/')) == NULL) + if ((p = strrchr(dirpart, '/')) == NULL) dirpart[0] = '\0'; else *(p + 1) = '\0'; @@ -1198,7 +1198,7 @@ dotrim(const struct conf_entry *ent, char *log, int numdays, int flags) createdir(ent, dirpart); /* get filename part of logfile */ - if ((p = rindex(log, '/')) == NULL) + if ((p = strrchr(log, '/')) == NULL) strlcpy(namepart, log, sizeof(namepart)); else strlcpy(namepart, p + 1, sizeof(namepart)); @@ -1480,7 +1480,7 @@ age_old_log(char *file) } else { /* relative */ /* get directory part of logfile */ strlcpy(tmp, file, sizeof(tmp)); - if ((p = rindex(tmp, '/')) == NULL) + if ((p = strrchr(tmp, '/')) == NULL) tmp[0] = '\0'; else *(p + 1) = '\0'; @@ -1490,7 +1490,7 @@ age_old_log(char *file) strlcat(tmp, "/", sizeof(tmp)); /* get filename part of logfile */ - if ((p = rindex(file, '/')) == NULL) + if ((p = strrchr(file, '/')) == NULL) strlcat(tmp, file, sizeof(tmp)); else strlcat(tmp, p + 1, sizeof(tmp)); diff --git a/usr.sbin/quotaon/quotaon.c b/usr.sbin/quotaon/quotaon.c index 4b5e432744..f81bfde94c 100644 --- a/usr.sbin/quotaon/quotaon.c +++ b/usr.sbin/quotaon/quotaon.c @@ -36,7 +36,7 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)quotaon.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/quotaon/quotaon.c,v 1.4.2.1 2001/07/19 05:17:06 kris Exp $ - * $DragonFly: src/usr.sbin/quotaon/quotaon.c,v 1.5 2004/03/21 22:41:24 cpressey Exp $ + * $DragonFly: src/usr.sbin/quotaon/quotaon.c,v 1.6 2004/08/30 19:27:22 eirikn Exp $ */ /* @@ -75,7 +75,7 @@ main(int argc, char **argv) long argnum, done = 0; int i, offmode = 0, errs = 0; - whoami = rindex(*argv, '/') + 1; + whoami = strrchr(*argv, '/') + 1; if (whoami == (char *)1) whoami = *argv; if (strcmp(whoami, "quotaoff") == 0) @@ -204,7 +204,7 @@ hasquota(struct fstab *fs, int type, char **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/repquota/repquota.c b/usr.sbin/repquota/repquota.c index 176c880e4e..c90f701f88 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -36,7 +36,7 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)repquota.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/repquota/repquota.c,v 1.9.2.2 2002/03/15 22:18:25 mikeh Exp $ - * $DragonFly: src/usr.sbin/repquota/repquota.c,v 1.5 2004/03/21 22:41:24 cpressey Exp $ + * $DragonFly: src/usr.sbin/repquota/repquota.c,v 1.6 2004/08/30 19:27:22 eirikn Exp $ */ /* @@ -287,7 +287,7 @@ hasquota(struct fstab *fs, int type, char **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/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 2557e6539c..cb6da8fd0e 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/usr.sbin/route6d/route6d.c,v 1.2.2.5 2001/07/03 11:02:09 ume Exp $ */ -/* $DragonFly: src/usr.sbin/route6d/route6d.c,v 1.5 2004/02/10 02:59:43 rob Exp $ */ +/* $DragonFly: src/usr.sbin/route6d/route6d.c,v 1.6 2004/08/30 19:27:22 eirikn Exp $ */ /* $KAME: route6d.c,v 1.64 2001/05/08 04:36:37 itojun Exp $ */ /* @@ -3006,11 +3006,11 @@ filterconfig() iflp = ap; goto ifonly; } - if ((p = index(ap, ',')) != NULL) { + if ((p = strchr(ap, ',')) != NULL) { *p++ = '\0'; iflp = p; } - if ((p = index(ap, '/')) == NULL) { + if ((p = strchr(ap, '/')) == NULL) { fatal("no prefixlen specified for '%s'", ap); /*NOTREACHED*/ } @@ -3031,7 +3031,7 @@ ifonly: /* parse the interface listing portion */ while (iflp) { ifname = iflp; - if ((iflp = index(iflp, ',')) != NULL) + if ((iflp = strchr(iflp, ',')) != NULL) *iflp++ = '\0'; ifcp = ifc_find(ifname); if (ifcp == NULL) { diff --git a/usr.sbin/rtprio/rtprio.c b/usr.sbin/rtprio/rtprio.c index 552bc1dd55..5045eeece0 100644 --- a/usr.sbin/rtprio/rtprio.c +++ b/usr.sbin/rtprio/rtprio.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/rtprio/rtprio.c,v 1.8.2.1 2001/01/29 08:07:26 kuriyama Exp $ - * $DragonFly: src/usr.sbin/rtprio/rtprio.c,v 1.2 2003/06/17 04:30:03 dillon Exp $ + * $DragonFly: src/usr.sbin/rtprio/rtprio.c,v 1.3 2004/08/30 19:27:22 eirikn Exp $ */ #include @@ -58,7 +58,7 @@ main(argc, argv) struct rtprio rtp; /* find basename */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index 740eb1fd80..b4bed6d712 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)rwhod.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/rwhod/rwhod.c,v 1.13.2.2 2000/12/23 15:28:12 iedowse Exp $ - * $DragonFly: src/usr.sbin/rwhod/rwhod.c,v 1.4 2004/03/13 21:07:24 eirikn Exp $ + * $DragonFly: src/usr.sbin/rwhod/rwhod.c,v 1.5 2004/08/30 19:27:22 eirikn Exp $ */ #include @@ -220,7 +220,7 @@ main(int argc, char *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/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 7b95ef9a46..7496260b93 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -31,7 +31,7 @@ * @(#) Copyright (c) 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)traceroute.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/traceroute6/traceroute6.c,v 1.4.2.4 2001/07/03 11:02:18 ume Exp $ - * $DragonFly: src/usr.sbin/traceroute6/traceroute6.c,v 1.4 2004/03/30 01:14:22 cpressey Exp $ + * $DragonFly: src/usr.sbin/traceroute6/traceroute6.c,v 1.5 2004/08/30 19:27:22 eirikn Exp $ */ /*- @@ -1295,7 +1295,7 @@ inetname(struct sockaddr *sa) if (first && !nflag) { first = 0; if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (cp = index(domain, '.'))) + (cp = strchr(domain, '.'))) (void) strlcpy(domain, cp + 1, sizeof(domain)); else domain[0] = 0; @@ -1304,7 +1304,7 @@ inetname(struct sockaddr *sa) if (!nflag) { if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, NI_NAMEREQD) == 0) { - if ((cp = index(line, '.')) && + if ((cp = strchr(line, '.')) && !strcmp(cp + 1, domain)) *cp = 0; cp = line; diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c index dce8d49315..0243e61d04 100644 --- a/usr.sbin/vnconfig/vnconfig.c +++ b/usr.sbin/vnconfig/vnconfig.c @@ -39,7 +39,7 @@ * * @(#)vnconfig.c 8.1 (Berkeley) 12/15/93 * $FreeBSD: src/usr.sbin/vnconfig/vnconfig.c,v 1.13.2.7 2003/06/02 09:10:27 maxim Exp $ - * $DragonFly: src/usr.sbin/vnconfig/vnconfig.c,v 1.7 2004/07/20 03:35:27 hmp Exp $ + * $DragonFly: src/usr.sbin/vnconfig/vnconfig.c,v 1.8 2004/08/30 19:27:22 eirikn Exp $ */ #include @@ -583,7 +583,7 @@ rawdevice(char *dev) rawbuf = malloc(len + 2); strcpy(rawbuf, dev); if (stat(rawbuf, &sb) != 0 || !S_ISCHR(sb.st_mode)) { - dp = rindex(rawbuf, '/'); + dp = strrchr(rawbuf, '/'); if (dp) { for (ep = &rawbuf[len]; ep > dp; --ep) *(ep+1) = *ep; -- 2.41.0