Browse Source

Sync w/ glibc, no size change

Peter S. Mazinger 19 years ago
parent
commit
6678c3b74d
1 changed files with 5 additions and 4 deletions
  1. 5 4
      libc/unistd/getsubopt.c

+ 5 - 4
libc/unistd/getsubopt.c

@@ -1,5 +1,5 @@
 /* Parse comma separate list into words.
-   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -22,7 +22,7 @@
 #include <string.h>
 
 libc_hidden_proto(memchr)
-libc_hidden_proto(memcmp)
+libc_hidden_proto(strncmp)
 libc_hidden_proto(strchrnul)
 
 /* Parse comma separated suboption from *OPTIONP and match against
@@ -31,7 +31,8 @@ libc_hidden_proto(strchrnul)
    not part of TOKENS return in *VALUEP beginning of unknown
    suboption.  On exit *OPTIONP is set to the beginning of the next
    token or at the terminating NUL character.  */
-int getsubopt(char **optionp, char *const *tokens, char **valuep)
+int
+getsubopt (char **optionp, char *const *tokens, char **valuep)
 {
   char *endp, *vstart;
   int cnt;
@@ -50,7 +51,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep)
   /* Try to match the characters between *OPTIONP and VSTART against
      one of the TOKENS.  */
   for (cnt = 0; tokens[cnt] != NULL; ++cnt)
-    if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0
+    if (strncmp (*optionp, tokens[cnt], vstart - *optionp) == 0
 	&& tokens[cnt][vstart - *optionp] == '\0')
       {
 	/* We found the current option in TOKENS.  */