summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/unistd/getsubopt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c
index dca8144dc..3cac432ec 100644
--- a/libc/unistd/getsubopt.c
+++ b/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. */