From e7e5b53bf16ab3b35646f0580b36fa7d7afa9678 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 3 Jan 2012 18:51:58 +0000 Subject: 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. --- games/fortune/fortune/fortune.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'games') 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) { -- cgit v1.1