diff options
author | Ed Schouten <ed@FreeBSD.org> | 2012-01-03 18:51:58 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2012-01-03 18:51:58 +0000 |
commit | b3608ae18f1e5598bed81d0a10dd585a5080c40d (patch) | |
tree | b751618c7a82d9c00cab91ea9f611585dbf14d84 /usr.bin/tset | |
parent | 69ee3e2f52eb8cba6e103cd1de3f91a7ffe1ddc7 (diff) | |
download | src-test2-b3608ae18f1e5598bed81d0a10dd585a5080c40d.tar.gz src-test2-b3608ae18f1e5598bed81d0a10dd585a5080c40d.zip |
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.
Notes
Notes:
svn path=/head/; revision=229403
Diffstat (limited to 'usr.bin/tset')
-rw-r--r-- | usr.bin/tset/map.c | 2 | ||||
-rw-r--r-- | usr.bin/tset/term.c | 4 | ||||
-rw-r--r-- | usr.bin/tset/wrterm.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c index 18ee135b785c..8de594fecdd6 100644 --- a/usr.bin/tset/map.c +++ b/usr.bin/tset/map.c @@ -132,7 +132,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 7082e5f2dea0..544e9288bb28 100644 --- a/usr.bin/tset/term.c +++ b/usr.bin/tset/term.c @@ -74,7 +74,7 @@ get_termcap_entry(char *userarg, char **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; @@ -146,7 +146,7 @@ askuser(const char *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 e258e16b656c..77751fa30a21 100644 --- a/usr.bin/tset/wrterm.c +++ b/usr.bin/tset/wrterm.c @@ -56,7 +56,7 @@ wrtermcap(char *bp) char *t, *sep; /* Find the end of the terminal names. */ - if ((t = index(bp, ':')) == NULL) + if ((t = strchr(bp, ':')) == NULL) errx(1, "termcap names not colon terminated"); *t++ = '\0'; |