Bladeren bron

Use strchr instead of index (BSD)

Peter S. Mazinger 19 jaren geleden
bovenliggende
commit
ea650dfc5b
2 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 1 1
      libc/misc/syslog/syslog.c
  2. 3 3
      libc/misc/ttyent/getttyent.c

+ 1 - 1
libc/misc/syslog/syslog.c

@@ -254,7 +254,7 @@ vsyslog( int pri, const char *fmt, va_list ap )
 	/* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */
 	if (LogStat & LOG_CONS &&
 	    (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
-		p = index(tbuf, '>') + 1;
+		p = strchr(tbuf, '>') + 1;
 		last_chr[0] = '\r';
 		last_chr[1] = '\n';
 		(void)write(fd, p, last_chr - p + 2);

+ 3 - 3
libc/misc/ttyent/getttyent.c

@@ -96,7 +96,7 @@ static char * skip(register char *p)
 static char * value(register char *p)
 {
 
-    return ((p = index(p, '=')) ? ++p : NULL);
+    return ((p = strchr(p, '=')) ? ++p : NULL);
 }
 
 struct ttyent * getttyent(void)
@@ -122,7 +122,7 @@ struct ttyent * getttyent(void)
 	    return (NULL);
 	}
 	/* skip lines that are too big */
-	if (!index(p, '\n')) {
+	if (!strchr(p, '\n')) {
 	    while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
 		;
 	    continue;
@@ -171,7 +171,7 @@ struct ttyent * getttyent(void)
     tty.ty_comment = p;
     if (*p == 0)
 	tty.ty_comment = 0;
-    if ((p = index(p, '\n')))
+    if ((p = strchr(p, '\n')))
 	*p = '\0';
     return (&tty);
 }