From: Jim Meyering Date: Sun, 4 Dec 1994 21:15:46 +0000 (+0000) Subject: Use strr?chr instead of r?index. X-Git-Tag: textutils-1_12_1~413 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12042b2fa27dc803319d3bcc8f7ebd954250cbd8;p=thirdparty%2Fcoreutils.git Use strr?chr instead of r?index. --- diff --git a/src/dirname.c b/src/dirname.c index 7a0c834ea1..e4bdf26ef9 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -75,7 +75,7 @@ main (argc, argv) path = argv[1]; strip_trailing_slashes (path); - slash = rindex (path, '/'); + slash = strrchr (path, '/'); if (slash == NULL) path = (char *) "."; else diff --git a/src/echo.c b/src/echo.c index ee2402a397..2053679158 100644 --- a/src/echo.c +++ b/src/echo.c @@ -134,7 +134,7 @@ main (argc, argv) for (i = 0; temp[i]; i++) { - if (rindex (VALID_ECHO_OPTIONS, temp[i]) == 0) + if (strrchr (VALID_ECHO_OPTIONS, temp[i]) == 0) goto just_echo; } diff --git a/src/env.c b/src/env.c index 19c2a62c17..53be056398 100644 --- a/src/env.c +++ b/src/env.c @@ -166,7 +166,7 @@ main (argc, argv, envp) if (optind != argc && !strcmp (argv[optind], "-")) ++optind; - while (optind < argc && index (argv[optind], '=')) + while (optind < argc && strchr (argv[optind], '=')) putenv (argv[optind++]); /* If no program is specified, print the environment and exit. */ diff --git a/src/pathchk.c b/src/pathchk.c index a34df09295..774620f3a5 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -289,13 +289,13 @@ validate_path (path, portability) while (*slash == '/') slash++; start = slash; - slash = index (slash, '/'); + slash = strchr (slash, '/'); if (slash != NULL) *slash = '\0'; else { last_elem = 1; - slash = index (start, '\0'); + slash = strchr (start, '\0'); } if (!last_elem) diff --git a/src/printf.c b/src/printf.c index e437abe137..9e443dfd96 100644 --- a/src/printf.c +++ b/src/printf.c @@ -199,7 +199,7 @@ print_formatted (format, argc, argv) } break; } - if (index ("-+ #", *f)) + if (strchr ("-+ #", *f)) { ++f; ++direc_length; @@ -252,7 +252,7 @@ print_formatted (format, argc, argv) ++f; ++direc_length; } - if (!index ("diouxXfeEgGcs", *f)) + if (!strchr ("diouxXfeEgGcs", *f)) error (1, 0, "%%%c: invalid directive", *f); ++direc_length; if (argc > 0) @@ -310,7 +310,7 @@ print_esc (escstart) esc_value = esc_value * 8 + octtobin (*p); putchar (esc_value); } - else if (index ("\"\\abcfnrtv", *p)) + else if (strchr ("\"\\abcfnrtv", *p)) print_esc_char (*p++); else error (1, 0, "\\%c: invalid escape", *p); diff --git a/src/who.c b/src/who.c index e9e9628980..7cbe51807b 100644 --- a/src/who.c +++ b/src/who.c @@ -150,7 +150,7 @@ extract_trimmed_name (const STRUCT_UTMP *ut) /* Append a trailing space character. Some systems pad names shorter than the maximum with spaces, others pad with NULs. Remove any spaces. */ trimmed_name[sizeof (ut->ut_name)] = ' '; - p = index (trimmed_name, ' '); + p = strchr (trimmed_name, ' '); if (p != NULL) *p = '\0'; return trimmed_name;