Changeset 17091 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Feb 24, 2009 7:55:23 PM (16 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
r13837 r17091 53 53 * Parse args 54 54 */ 55 static const RT OPTIONDEF g_aOptions[] =55 static const RTGETOPTDEF g_aOptions[] = 56 56 { 57 57 { "--interations", 'i', RTGETOPT_REQ_INT32 }, … … 65 65 bool fSpin = false; 66 66 int ch; 67 int iArg = 1; 68 RTOPTIONUNION ValueUnion; 69 while ((ch = RTGetOpt(argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), &iArg, &ValueUnion))) 67 RTGETOPTUNION ValueUnion; 68 RTGETOPTSTATE GetState; 69 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */); 70 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 70 71 { 71 72 switch (ch) … … 87 88 break; 88 89 90 case VINF_GETOPT_NOT_OPTION: 91 RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz); 92 return 1; 93 89 94 default: 90 95 if (ch < 0) … … 94 99 return 1; 95 100 } 96 }97 if (iArg < argc)98 {99 RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz);100 return 1;101 101 } 102 102 -
trunk/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp
r14303 r17091 263 263 */ 264 264 bool fVerbose = false; 265 static const RT OPTIONDEF s_aOptions[] =265 static const RTGETOPTDEF s_aOptions[] = 266 266 { 267 267 { "--verbose", 'v', RTGETOPT_REQ_NOTHING } 268 268 }; 269 int iArg = 0;270 269 int ch; 271 RTOPTIONUNION Value; 272 while ((ch = RTGetOpt(argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), &iArg, &Value))) 270 RTGETOPTUNION Value; 271 RTGETOPTSTATE GetState; 272 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0 /* fFlags*/); 273 while ((ch = RTGetOpt(&GetState, &Value))) 273 274 switch (ch) 274 275 { 275 case 'v': fVerbose = true; break; 276 default: return supSvcDisplayGetOptError("delete", ch, argc, argv, iArg, &Value); 277 } 278 if (iArg != argc) 279 return supSvcDisplayTooManyArgsError("delete", argc, argv, iArg); 276 case 'v': 277 fVerbose = true; 278 break; 279 case VINF_GETOPT_NOT_OPTION: 280 return supSvcDisplayTooManyArgsError("delete", argc, argv, iArg); 281 default: 282 return supSvcDisplayGetOptError("delete", ch, argc, argv, iArg, &Value); 283 } 280 284 281 285 /* … … 328 332 int iArg = 0; 329 333 int ch; 330 RT OPTIONUNION Value;334 RTGETOPTUNION Value; 331 335 while ((ch = RTGetOpt(argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), &iArg, &Value))) 332 336 switch (ch) … … 548 552 int ch; 549 553 int rc = 0; 550 RT OPTIONUNION Value;554 RTGETOPTUNION Value; 551 555 while ( !rc 552 556 && (ch = RTGetOpt(cArgs, papszArgs, s_aOptions, RT_ELEMENTS(s_aOptions), &iArg, &Value))) … … 646 650 int iArg = 0; 647 651 int ch; 648 RT OPTIONUNION Value;652 RTGETOPTUNION Value; 649 653 while ((ch = RTGetOpt(argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), &iArg, &Value))) 650 654 switch (ch) … … 701 705 int iArg = 0; 702 706 int ch; 703 RT OPTIONUNION Value;707 RTGETOPTUNION Value; 704 708 while ((ch = RTGetOpt(argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), &iArg, &Value))) 705 709 switch (ch)
Note:
See TracChangeset
for help on using the changeset viewer.