summaryrefslogtreecommitdiffstats
path: root/games
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 /games
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 'games')
-rw-r--r--games/fortune/fortune/fortune.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index e93b0e7..de85d09 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -683,7 +683,7 @@ all_forts(FILEDESC *fp, 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;
@@ -785,7 +785,7 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
}
}
- if ((sp = rindex(file, '/')) == NULL)
+ if ((sp = strrchr(file, '/')) == NULL)
sp = file;
else
sp++;
@@ -797,7 +797,7 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
DPRINTF(2, (stderr, "FALSE (check fortunes only)\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) {
OpenPOWER on IntegriCloud