summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw/main.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-01-03 18:51:58 +0000
committered <ed@FreeBSD.org>2012-01-03 18:51:58 +0000
commite7e5b53bf16ab3b35646f0580b36fa7d7afa9678 (patch)
treeb751618c7a82d9c00cab91ea9f611585dbf14d84 /sbin/ipfw/main.c
parentd106f2fd7cf6be7617b1756d893b5b6fba5310f4 (diff)
downloadFreeBSD-src-e7e5b53bf16ab3b35646f0580b36fa7d7afa9678.zip
FreeBSD-src-e7e5b53bf16ab3b35646f0580b36fa7d7afa9678.tar.gz
Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
Diffstat (limited to 'sbin/ipfw/main.c')
-rw-r--r--sbin/ipfw/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c
index 337d545..debed4e 100644
--- a/sbin/ipfw/main.c
+++ b/sbin/ipfw/main.c
@@ -122,9 +122,9 @@ ipfw_main(int oldac, char **oldav)
break;
if (copy) {
arg[j++] = arg[i];
- copy = !index("," WHITESP, arg[i]);
+ copy = !strchr("," WHITESP, arg[i]);
} else {
- copy = !index(WHITESP, arg[i]);
+ copy = !strchr(WHITESP, arg[i]);
if (copy)
arg[j++] = arg[i];
}
@@ -141,7 +141,7 @@ ipfw_main(int oldac, char **oldav)
* processing, this is just the number of blanks plus 1.
*/
for (i = 0, ac = 1; i < l; i++)
- if (index(WHITESP, arg[i]) != NULL)
+ if (strchr(WHITESP, arg[i]) != NULL)
ac++;
/*
@@ -162,7 +162,7 @@ ipfw_main(int oldac, char **oldav)
*/
av_p = (char *)&av[ac+1];
for (ac = 1, i = j = 0; i < l; i++) {
- if (index(WHITESP, arg[i]) != NULL || i == l-1) {
+ if (strchr(WHITESP, arg[i]) != NULL || i == l-1) {
if (i == l-1)
i++;
bcopy(arg+j, av_p, i-j);
@@ -240,7 +240,7 @@ ipfw_main(int oldac, char **oldav)
" ipfw sysctl -a\n");
return 0;
}
- s = index(av[2], '=');
+ s = strchr(av[2], '=');
if (s == NULL) {
s = !strcmp(av[2], "-a") ? NULL : av[2];
sysctlbyname(s, NULL, NULL, NULL, 0);
OpenPOWER on IntegriCloud