VirtualBox

Changeset 40598 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Mar 23, 2012 6:08:59 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77010
Message:

getopt: Added RTGETOPT_REQ_BOOL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/getopt.cpp

    r39032 r40598  
    320320        case RTGETOPT_REQ_STRING:
    321321            pValueUnion->psz = pszValue;
     322            break;
     323
     324        case RTGETOPT_REQ_BOOL:
     325            if (   !RTStrICmp(pszValue, "true")
     326                || !RTStrICmp(pszValue, "t")
     327                || !RTStrICmp(pszValue, "yes")
     328                || !RTStrICmp(pszValue, "y")
     329                || !RTStrICmp(pszValue, "enabled")
     330                || !RTStrICmp(pszValue, "enable")
     331                || !RTStrICmp(pszValue, "en")
     332                || !RTStrICmp(pszValue, "e")
     333                || !RTStrICmp(pszValue, "on")
     334                || !RTStrCmp(pszValue, "1")
     335                )
     336                pValueUnion->f = true;
     337            else if (   !RTStrICmp(pszValue, "false")
     338                     || !RTStrICmp(pszValue, "f")
     339                     || !RTStrICmp(pszValue, "no")
     340                     || !RTStrICmp(pszValue, "n")
     341                     || !RTStrICmp(pszValue, "disabled")
     342                     || !RTStrICmp(pszValue, "disable")
     343                     || !RTStrICmp(pszValue, "dis")
     344                     || !RTStrICmp(pszValue, "d")
     345                     || !RTStrICmp(pszValue, "off")
     346                     || !RTStrCmp(pszValue, "0")
     347                     )
     348                pValueUnion->f = false;
     349            else
     350            {
     351                pValueUnion->psz = pszValue;
     352                return VERR_GETOPT_UNKNOWN_OPTION;
     353            }
    322354            break;
    323355
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette