diff options
Diffstat (limited to 'source/common/getopt.c')
-rw-r--r-- | source/common/getopt.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/common/getopt.c b/source/common/getopt.c index f1921ee2c2cb..4bcf3dbc2821 100644 --- a/source/common/getopt.c +++ b/source/common/getopt.c @@ -197,6 +197,26 @@ AcpiGetopt( CurrentCharPtr = 1; } + /* Option has an optional argument? */ + + else if (*OptsPtr == '+') + { + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') + { + AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)]; + } + else if (++AcpiGbl_Optind >= argc) + { + AcpiGbl_Optarg = NULL; + } + else + { + AcpiGbl_Optarg = argv[AcpiGbl_Optind++]; + } + + CurrentCharPtr = 1; + } + /* Option has optional single-char arguments? */ else if (*OptsPtr == '^') |