VirtualBox

Changeset 17092 in vbox


Ignore:
Timestamp:
Feb 24, 2009 7:57:52 PM (16 years ago)
Author:
vboxsync
Message:

RTGetOpt interface changes.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/getopt.h

    r17091 r17092  
    176176 * Initialize the RTGetOpt state.
    177177 *
    178  * @returns VINF_SUCCESS, or VERR_INVALID_PARAMETER if fFlags is invalid.
     178 * The passed in argument vector may be sorted if fFlags indicates that this is
     179 * desired (to be implemented).
     180 *
     181 * @returns VINF_SUCCESS, VERR_INVALID_PARAMETER or VERR_INVALID_POINTER.
    179182 * @param   pState      The state.
    180183 *
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r17089 r17092  
    131131 ****************************************************************************/
    132132
    133 static const RTOPTIONDEF g_aOptions[]
     133static const RTGETOPTDEF g_aOptions[]
    134134    = {
    135135        { "--help",             'h', RTGETOPT_REQ_NOTHING },
     
    255255    int c;
    256256    int i = 1;
    257     RTOPTIONUNION ValueUnion;
    258     while ((c = RTGetOpt(argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), &i, &ValueUnion)))
     257    RTGETOPTUNION ValueUnion;
     258    RTGETOPTSTATE GetState;
     259    RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */);
     260    while ((c = RTGetOpt(&GetState, &ValueUnion)))
    259261    {
    260262        switch (c)
     
    324326            break;
    325327#endif
    326         }
    327     }
    328     if (i != argc)
    329     {
    330         RTStrmPrintf(g_pStdErr, "Unknown option %s\n", argv[i]);
    331         exit(1);
     328            case VINF_GETOPT_NOT_OPTION:
     329                RTStrmPrintf(g_pStdErr, "Unknown option %s\n", argv[i]);
     330            return 1;
     331        }
    332332    }
    333333
Note: See TracChangeset for help on using the changeset viewer.

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