diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-02-17 09:26:45 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-02-17 09:26:45 +0000 |
commit | 6678c3b74d0f482f635756f014a210abce824e16 (patch) | |
tree | 425d68b5e944f551aaccf6ac7c80cdcf510ccdca /libc | |
parent | 709a5fc06156b58ed864a1696a5c24cf95d74d9c (diff) |
Sync w/ glibc, no size change
Diffstat (limited to 'libc')
-rw-r--r-- | libc/unistd/getsubopt.c | 9 |
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. */ |