]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Use strr?chr instead of r?index.
authorJim Meyering <jim@meyering.net>
Sun, 4 Dec 1994 21:15:46 +0000 (21:15 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 4 Dec 1994 21:15:46 +0000 (21:15 +0000)
src/dirname.c
src/echo.c
src/env.c
src/pathchk.c
src/printf.c
src/who.c

index 7a0c834ea196d45529ddf9a5593c755424a737aa..e4bdf26ef9c34357bb35f2db3ec32bee2279378c 100644 (file)
@@ -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
index ee2402a39715dd129719197fe184d6866b3402cf..2053679158b1ad8d441ac4fe4c18264e982e74fb 100644 (file)
@@ -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;
        }
 
index 19c2a62c17670d080d9227310c986f01437a9803..53be056398f4636d77d902a7b3f211defc17261f 100644 (file)
--- 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. */
index a34df09295369a62de1dd122a256d409818017e6..774620f3a519ca776e707fb78505f91cebfec8ac 100644 (file)
@@ -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)
index e437abe137bab3d17ffc43d02a96a095bb57aa0c..9e443dfd96aaee5419515c86c9a2ed384a150e62 100644 (file)
@@ -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);
index e9e9628980b4ea3b37a4ed24bd7547905f734e4c..7cbe51807b2002abec279bb90d49695d9b685604 100644 (file)
--- 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;