From 6678c3b74d0f482f635756f014a210abce824e16 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 17 Feb 2006 09:26:45 +0000 Subject: Sync w/ glibc, no size change --- libc/unistd/getsubopt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libc/unistd/getsubopt.c') 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 , 1996. @@ -22,7 +22,7 @@ #include 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. */ -- cgit v1.2.3