You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/12/02 08:56:32 UTC
[incubator-nuttx] branch master updated: unistd/getopt: remove
count of arguments limits
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 11617fe unistd/getopt: remove count of arguments limits
11617fe is described below
commit 11617fe5ab8dd8e3ba7f9367e54c9524792d0a1e
Author: dongjiuzhu <do...@xiaomi.com>
AuthorDate: Tue Dec 1 11:20:54 2020 +0800
unistd/getopt: remove count of arguments limits
For commands without "-" arguments, ex:"ls", we should always let
optind = 1 after getopt is called in order to get what follows
correctly.
Change-Id: Iac3cfbadd27fb96e47070c4e3198229306299b6b
Signed-off-by: dongjiuzhu <do...@xiaomi.com>
---
libs/libc/unistd/lib_getopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/libc/unistd/lib_getopt.c b/libs/libc/unistd/lib_getopt.c
index 4600a71..82c0976 100644
--- a/libs/libc/unistd/lib_getopt.c
+++ b/libs/libc/unistd/lib_getopt.c
@@ -134,7 +134,7 @@ int getopt(int argc, FAR char * const argv[], FAR const char *optstring)
/* Verify input parameters. */
- if (argv != NULL && optstring != NULL && argc > 1)
+ if (argv != NULL && optstring != NULL)
{
FAR char *optchar;
int noarg_ret = '?';