summaryrefslogtreecommitdiffstats
path: root/gcc/protoize.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-20 13:11:38 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-20 13:11:38 +0000
commit22bd04e0688a3737ad14fcd93b79e5eec9c0ff2e (patch)
treea5c1277b2489ed619b408b287e3425dd9537a16c /gcc/protoize.c
parent85b34d4d1486523f8c47045ef688f667df31d352 (diff)
downloadppe42-gcc-22bd04e0688a3737ad14fcd93b79e5eec9c0ff2e.tar.gz
ppe42-gcc-22bd04e0688a3737ad14fcd93b79e5eec9c0ff2e.zip
Switch to strrchr if available instead of rindex
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19341 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/protoize.c')
-rw-r--r--gcc/protoize.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 699bfe683ec..754d6c23ce8 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -74,6 +74,16 @@ Boston, MA 02111-1307, USA. */
#include <setjmp.h>
#include "gansidecl.h"
+/* Some systems like Linux don't declare rindex if _POSIX_SOURCE is declared,
+ but it normally does declare it. This means that configure thinks we don't
+ need to declare it. Favor using strrchr if it is available. */
+
+#ifndef HAVE_STRRCHR
+#ifdef HAVE_RINDEX
+#define strrchr rindex
+#endif
+#endif
+
/* Include getopt.h for the sake of getopt_long.
We don't need the declaration of getopt, and it could conflict
with something from a system header file, so effectively nullify that. */
@@ -897,7 +907,7 @@ file_could_be_converted (const char *path)
char *dir_last_slash;
strcpy (dir_name, path);
- dir_last_slash = rindex (dir_name, '/');
+ dir_last_slash = strrchr (dir_name, '/');
if (dir_last_slash)
*dir_last_slash = '\0';
else
@@ -931,7 +941,7 @@ file_normally_convertible (const char *path)
char *dir_last_slash;
strcpy (dir_name, path);
- dir_last_slash = rindex (dir_name, '/');
+ dir_last_slash = strrchr (dir_name, '/');
if (dir_last_slash)
*dir_last_slash = '\0';
else
@@ -2370,7 +2380,7 @@ start_over: ;
char *dir_end;
aux_info_relocated_name = xmalloc (base_len + (p-invocation_filename));
strcpy (aux_info_relocated_name, base_source_filename);
- dir_end = rindex (aux_info_relocated_name, '/');
+ dir_end = strrchr (aux_info_relocated_name, '/');
if (dir_end)
dir_end++;
else
@@ -4575,7 +4585,7 @@ main (argc, argv)
int c;
const char *params = "";
- pname = rindex (argv[0], '/');
+ pname = strrchr (argv[0], '/');
pname = pname ? pname+1 : argv[0];
cwd_buffer = getpwd ();
OpenPOWER on IntegriCloud