Changeset 26517 in vbox for trunk/src/VBox
- Timestamp:
- Feb 14, 2010 9:39:00 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57688
- Location:
- trunk/src/VBox
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
r20864 r26517 684 684 { "--xmit-test", 'x', RTGETOPT_REQ_NOTHING }, 685 685 { "--ping-test", 'P', RTGETOPT_REQ_NOTHING }, 686 { "--help", 'h', RTGETOPT_REQ_NOTHING },687 { "--?", '?', RTGETOPT_REQ_NOTHING },688 686 }; 689 687 … … 805 803 break; 806 804 807 case '?':808 805 case 'h': 809 806 RTPrintf("syntax: tstIntNet-1 <options>\n" … … 818 815 return 1; 819 816 820 case VINF_GETOPT_NOT_OPTION:821 RTPrintf(" tstIntNetR0: invalid argument: %s\n", Value.psz);822 return 1;817 case 'V': 818 RTPrintf("$Revision$\n"); 819 return 0; 823 820 824 821 default: 825 if (RT_SUCCESS(ch)) 826 RTPrintf("tstIntNetR0: invalid argument (%#x): %s\n", ch, Value.psz); 827 else if (Value.pDef) 828 RTPrintf("tstIntNetR0: invalid argument: %Rrc - %s\n", ch, Value.pDef->pszLong); 829 else 830 RTPrintf("tstIntNetR0: invalid argument: %Rrc - %s\n", ch, argv[iArg]); 831 return 1; 822 return RTGetOptPrintError(ch, &Value); 832 823 } 833 824 -
trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp
r26296 r26517 412 412 RTGETOPTUNION Value; 413 413 RTGETOPTSTATE GetState; 414 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0 /* fFlags */);414 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 415 415 while ((ch = RTGetOpt(&GetState, &Value))) 416 416 switch (ch) … … 424 424 break; 425 425 426 case VINF_GETOPT_NOT_OPTION:427 RTPrintf("tstIntNetR0: invalid argument: %s\n", Value.psz);428 return 1;429 430 426 default: 431 RTPrintf("tstIntNetR0: invalid argument: %s\n", Value.psz); 432 return 1; 427 return RTGetOptPrintError(ch, &Value); 433 428 } 434 429 -
trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp
r24011 r26517 823 823 { "--address", 'a', RTGETOPT_REQ_UINT64 }, 824 824 { "--cpumode", 'c', RTGETOPT_REQ_UINT32 }, 825 { "--help", 'h', RTGETOPT_REQ_NOTHING },826 825 { "--bytes", 'b', RTGETOPT_REQ_INT64 }, 827 826 { "--listing", 'l', RTGETOPT_REQ_NOTHING }, … … 836 835 RTGETOPTUNION ValueUnion; 837 836 RTGETOPTSTATE GetState; 838 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */); 839 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 837 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST); 838 while ( (ch = RTGetOpt(&GetState, &ValueUnion)) 839 && ch != VINF_GETOPT_NOT_OPTION) 840 840 { 841 841 switch (ch) … … 914 914 break; 915 915 916 case VINF_GETOPT_NOT_OPTION: 917 break; 916 case 'V': 917 RTPrintf("$Revision: $\n"); 918 return 0; 918 919 919 920 default: 920 RTStrmPrintf(g_pStdErr, "%s: syntax error: %Rrc\n", argv0, ch); 921 return 1; 921 return RTGetOptPrintError(ch, &ValueUnion); 922 922 } 923 923 } -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r26439 r26517 39 39 # include <VBox/vrdpapi.h> 40 40 #endif 41 #include <iprt/buildconfig.h> 41 42 #include <iprt/ctype.h> 42 43 #include <iprt/initterm.h> … … 681 682 { "--capture", 'c', 0 }, 682 683 { "--width", 'w', RTGETOPT_REQ_UINT32 }, 683 { "--height", 'h', RTGETOPT_REQ_UINT32 }, 684 { "--height", 'h', RTGETOPT_REQ_UINT32 }, /* great choice of short option! */ 684 685 { "--bitrate", 'r', RTGETOPT_REQ_UINT32 }, 685 686 { "--filename", 'f', RTGETOPT_REQ_STRING }, … … 746 747 ulFrameWidth = ValueUnion.u32; 747 748 break; 748 case 'h':749 ulFrameHeight = ValueUnion.u32;750 break;751 749 case 'r': 752 750 ulBitRate = ValueUnion.u32; … … 756 754 break; 757 755 #endif /* VBOX_FFMPEG defined */ 758 case VINF_GETOPT_NOT_OPTION: 759 RTPrintf("Invalid parameter '%s'\n\n", ValueUnion.psz); 756 case 'h': 757 #ifdef VBOX_FFMPEG 758 if ((GetState.pDef->fFlags & RTGETOPT_REQ_MASK) != RTGETOPT_REQ_NOTHING) 759 { 760 ulFrameHeight = ValueUnion.u32; 761 break; 762 } 763 #endif 760 764 show_usage(); 761 return -1;765 return 0; 762 766 case OPT_COMMENT: 763 767 /* nothing to do */ 764 768 break; 769 case 'V': 770 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 771 return 0; 765 772 default: 766 if (ch > 0) 767 { 768 if (RT_C_IS_PRINT(ch)) 769 RTPrintf("Invalid option -%c\n\n", ch); 770 else 771 RTPrintf("Invalid option case %i\n\n", ch); 772 } 773 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 774 RTPrintf("Unknown option: %s\n\n", ValueUnion.psz); 775 else if (ValueUnion.pDef) 776 RTPrintf("%s: %Rrs\n\n", ValueUnion.pDef->pszLong, ch); 777 else 778 RTPrintf("Error: %Rrs\n\n", ch); 773 ch = RTGetOptPrintError(ch, &ValueUnion); 779 774 show_usage(); 780 return -1;775 return ch; 781 776 } 782 777 } … … 786 781 { 787 782 LogError("VBoxHeadless: ERROR: please specify an even frame width between 512 and 2048", 0); 788 return -1;783 return 1; 789 784 } 790 785 if (ulFrameHeight < 384 || ulFrameHeight > 1536 || ulFrameHeight % 2) 791 786 { 792 787 LogError("VBoxHeadless: ERROR: please specify an even frame height between 384 and 1536", 0); 793 return -1;788 return 1; 794 789 } 795 790 if (ulBitRate < 300000 || ulBitRate > 1000000) 796 791 { 797 792 LogError("VBoxHeadless: ERROR: please specify an even bitrate between 300000 and 1000000", 0); 798 return -1;793 return 1; 799 794 } 800 795 /* Make sure we only have %d or %u (or none) in the file name specified */ … … 803 798 { 804 799 LogError("VBoxHeadless: ERROR: Only %%d and %%u are allowed in the capture file name.", -1); 805 return -1;800 return 1; 806 801 } 807 802 /* And no more than one % in the name */ … … 809 804 { 810 805 LogError("VBoxHeadless: ERROR: Only one format modifier is allowed in the capture file name.", -1); 811 return -1;806 return 1; 812 807 } 813 808 RTStrPrintf(&pszMPEGFile[0], RTPATH_MAX, pszFileNameParam, RTProcSelf()); … … 817 812 { 818 813 show_usage(); 819 return -1;814 return 1; 820 815 } 821 816 … … 826 821 { 827 822 RTPrintf("VBoxHeadless: ERROR: failed to initialize COM!\n"); 828 return rc;823 return 1; 829 824 } 830 825 … … 1172 1167 LogFlow(("VBoxHeadless FINISHED.\n")); 1173 1168 1174 return rc;1169 return FAILED(rc) ? 1 : 0; 1175 1170 } 1176 1171 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r26371 r26517 883 883 }; 884 884 RTGETOPTSTATE GetOptState; 885 RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTeleportOptions, RT_ELEMENTS(s_aTeleportOptions), 2, 0 /*fFlags*/);885 RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTeleportOptions, RT_ELEMENTS(s_aTeleportOptions), 2, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 886 886 int ch; 887 887 RTGETOPTUNION Value; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
r26163 r26517 107 107 a->argv, 108 108 g_aDHCPIPOptions, 109 enmCode != OP_REMOVE ? RT_ELEMENTS(g_aDHCPIPOptions) : 4, /* we use only --netname and --ifname for remove*/109 enmCode != OP_REMOVE ? RT_ELEMENTS(g_aDHCPIPOptions) : 4, /* we use only --netname and --ifname for remove*/ 110 110 index, 111 0 /* fFlags */);111 RTGETOPTINIT_FLAGS_NO_STD_OPTS); 112 112 while ((c = RTGetOpt(&GetState, &ValueUnion))) 113 113 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r26163 r26517 187 187 RTGETOPTSTATE GetState; 188 188 // start at 0 because main() has hacked both the argc and argv given to us 189 RTGetOptInit(&GetState, a->argc, a->argv, g_aCreateHardDiskOptions, RT_ELEMENTS(g_aCreateHardDiskOptions), 0, 0 /* fFlags */); 189 RTGetOptInit(&GetState, a->argc, a->argv, g_aCreateHardDiskOptions, RT_ELEMENTS(g_aCreateHardDiskOptions), 190 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 190 191 while ((c = RTGetOpt(&GetState, &ValueUnion))) 191 192 { … … 365 366 RTGETOPTSTATE GetState; 366 367 // start at 0 because main() has hacked both the argc and argv given to us 367 RTGetOptInit(&GetState, a->argc, a->argv, g_aModifyHardDiskOptions, RT_ELEMENTS(g_aModifyHardDiskOptions), 0, 0 /* fFlags */); 368 RTGetOptInit(&GetState, a->argc, a->argv, g_aModifyHardDiskOptions, RT_ELEMENTS(g_aModifyHardDiskOptions), 369 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 368 370 while ((c = RTGetOpt(&GetState, &ValueUnion))) 369 371 { … … 532 534 RTGETOPTSTATE GetState; 533 535 // start at 0 because main() has hacked both the argc and argv given to us 534 RTGetOptInit(&GetState, a->argc, a->argv, g_aCloneHardDiskOptions, RT_ELEMENTS(g_aCloneHardDiskOptions), 0, 0 /* fFlags */); 536 RTGetOptInit(&GetState, a->argc, a->argv, g_aCloneHardDiskOptions, RT_ELEMENTS(g_aCloneHardDiskOptions), 537 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 535 538 while ((c = RTGetOpt(&GetState, &ValueUnion))) 536 539 { … … 751 754 RTGETOPTSTATE GetState; 752 755 // start at 0 because main() has hacked both the argc and argv given to us 753 RTGetOptInit(&GetState, argc, argv, g_aConvertFromRawHardDiskOptions, RT_ELEMENTS(g_aConvertFromRawHardDiskOptions), 0, 0 /* fFlags */); 756 RTGetOptInit(&GetState, argc, argv, g_aConvertFromRawHardDiskOptions, RT_ELEMENTS(g_aConvertFromRawHardDiskOptions), 757 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 754 758 while ((c = RTGetOpt(&GetState, &ValueUnion))) 755 759 { … … 943 947 RTGETOPTSTATE GetState; 944 948 // start at 0 because main() has hacked both the argc and argv given to us 945 RTGetOptInit(&GetState, a->argc, a->argv, g_aAddiSCSIDiskOptions, RT_ELEMENTS(g_aAddiSCSIDiskOptions), 0, 0 /* fFlags */); 949 RTGetOptInit(&GetState, a->argc, a->argv, g_aAddiSCSIDiskOptions, RT_ELEMENTS(g_aAddiSCSIDiskOptions), 950 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 946 951 while ((c = RTGetOpt(&GetState, &ValueUnion))) 947 952 { … … 1104 1109 RTGETOPTSTATE GetState; 1105 1110 // start at 0 because main() has hacked both the argc and argv given to us 1106 RTGetOptInit(&GetState, a->argc, a->argv, g_aShowHardDiskInfoOptions, RT_ELEMENTS(g_aShowHardDiskInfoOptions), 0, 0 /* fFlags */); 1111 RTGetOptInit(&GetState, a->argc, a->argv, g_aShowHardDiskInfoOptions, RT_ELEMENTS(g_aShowHardDiskInfoOptions), 1112 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 1107 1113 while ((c = RTGetOpt(&GetState, &ValueUnion))) 1108 1114 { … … 1310 1316 RTGETOPTSTATE GetState; 1311 1317 // start at 0 because main() has hacked both the argc and argv given to us 1312 RTGetOptInit(&GetState, a->argc, a->argv, g_aOpenMediumOptions, RT_ELEMENTS(g_aOpenMediumOptions), 0, 0 /* fFlags */); 1318 RTGetOptInit(&GetState, a->argc, a->argv, g_aOpenMediumOptions, RT_ELEMENTS(g_aOpenMediumOptions), 1319 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 1313 1320 while ((c = RTGetOpt(&GetState, &ValueUnion))) 1314 1321 { … … 1485 1492 RTGETOPTSTATE GetState; 1486 1493 // start at 0 because main() has hacked both the argc and argv given to us 1487 RTGetOptInit(&GetState, a->argc, a->argv, g_aCloseMediumOptions, RT_ELEMENTS(g_aCloseMediumOptions), 0, 0 /* fFlags */); 1494 RTGetOptInit(&GetState, a->argc, a->argv, g_aCloseMediumOptions, RT_ELEMENTS(g_aCloseMediumOptions), 1495 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 1488 1496 while ((c = RTGetOpt(&GetState, &ValueUnion))) 1489 1497 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp
r24879 r26517 173 173 RT_ELEMENTS(g_aHostOnlyIPOptions), 174 174 index, 175 0 /* fFlags */);175 RTGETOPTINIT_FLAGS_NO_STD_OPTS); 176 176 while ((c = RTGetOpt(&GetState, &ValueUnion))) 177 177 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r25165 r26517 129 129 RTGETOPTSTATE GetState; 130 130 // start at 0 because main() has hacked both the argc and argv given to us 131 RTGetOptInit(&GetState, arg->argc, arg->argv, g_aImportApplianceOptions, RT_ELEMENTS(g_aImportApplianceOptions), 0, 0 /* fFlags */); 131 RTGetOptInit(&GetState, arg->argc, arg->argv, g_aImportApplianceOptions, RT_ELEMENTS(g_aImportApplianceOptions), 132 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 132 133 while ((c = RTGetOpt(&GetState, &ValueUnion))) 133 134 { … … 742 743 // start at 0 because main() has hacked both the argc and argv given to us 743 744 RTGetOptInit(&GetState, a->argc, a->argv, g_aExportOptions, 744 RT_ELEMENTS(g_aExportOptions), 0, 0 /* fFlags */);745 RT_ELEMENTS(g_aExportOptions), 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 745 746 746 747 Utf8Str strProductUrl; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r26294 r26517 1965 1965 RTGETOPTSTATE GetState; 1966 1966 // start at 0 because main() has hacked both the argc and argv given to us 1967 RTGetOptInit(&GetState, a->argc, a->argv, g_aShowVMInfoOptions, RT_ELEMENTS(g_aShowVMInfoOptions), 0, 0 /* fFlags */); 1967 RTGetOptInit(&GetState, a->argc, a->argv, g_aShowVMInfoOptions, RT_ELEMENTS(g_aShowVMInfoOptions), 1968 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 1968 1969 while ((c = RTGetOpt(&GetState, &ValueUnion))) 1969 1970 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r25019 r26517 126 126 RTGETOPTUNION ValueUnion; 127 127 RTGETOPTSTATE GetState; 128 RTGetOptInit(&GetState, a->argc, a->argv, g_aListOptions, RT_ELEMENTS(g_aListOptions), 0, 0 /* fFlags */); 128 RTGetOptInit(&GetState, a->argc, a->argv, g_aListOptions, RT_ELEMENTS(g_aListOptions), 129 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 129 130 while ((c = RTGetOpt(&GetState, &ValueUnion))) 130 131 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r26323 r26517 115 115 RTGETOPTSTATE GetState; 116 116 // start at 0 because main() has hacked both the argc and argv given to us 117 RTGetOptInit(&GetState, a->argc, a->argv, g_aUnregisterVMOptions, RT_ELEMENTS(g_aUnregisterVMOptions), 0, 0 /* fFlags */); 117 RTGetOptInit(&GetState, a->argc, a->argv, g_aUnregisterVMOptions, RT_ELEMENTS(g_aUnregisterVMOptions), 118 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 118 119 while ((c = RTGetOpt(&GetState, &ValueUnion))) 119 120 { … … 285 286 RTGETOPTSTATE GetState; 286 287 // start at 0 because main() has hacked both the argc and argv given to us 287 RTGetOptInit(&GetState, a->argc, a->argv, s_aStartVMOptions, RT_ELEMENTS(s_aStartVMOptions), 0, 0 /* fFlags */); 288 RTGetOptInit(&GetState, a->argc, a->argv, s_aStartVMOptions, RT_ELEMENTS(s_aStartVMOptions), 289 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 288 290 while ((c = RTGetOpt(&GetState, &ValueUnion))) 289 291 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r26294 r26517 269 269 270 270 RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions, 271 RT_ELEMENTS(g_aModifyVMOptions), 1, 0 /* fFlags */);271 RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 272 272 273 273 while ( SUCCEEDED (rc) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r26163 r26517 279 279 }; 280 280 RTGETOPTSTATE GetOptState; 281 RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTakeOptions, RT_ELEMENTS(s_aTakeOptions), 3, 0 /*fFlags*/); 281 RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTakeOptions, RT_ELEMENTS(s_aTakeOptions), 282 3, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 282 283 int ch; 283 284 RTGETOPTUNION Value; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r25676 r26517 83 83 84 84 RTGetOptInit(&GetState, a->argc, a->argv, g_aStorageAttachOptions, 85 RT_ELEMENTS(g_aStorageAttachOptions), 1, 0 /* fFlags */);85 RT_ELEMENTS(g_aStorageAttachOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 86 86 87 87 while ( SUCCEEDED(rc) … … 679 679 680 680 RTGetOptInit (&GetState, a->argc, a->argv, g_aStorageControllerOptions, 681 RT_ELEMENTS(g_aStorageControllerOptions), 1, 0 /* fFlags */);681 RT_ELEMENTS(g_aStorageControllerOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 682 682 683 683 while ( SUCCEEDED(rc) -
trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp
r26498 r26517 33 33 *******************************************************************************/ 34 34 #include <VBox/sup.h> 35 #include <iprt/buildconfig.h> 35 36 #include <iprt/initterm.h> 36 37 #include <iprt/getopt.h> … … 79 80 { "--what", 'o', RTGETOPT_REQ_STRING }, 80 81 { "--which", 'l', RTGETOPT_REQ_STRING }, 81 { "--help", 'h', 0 },82 82 }; 83 83 … … 141 141 return usage(); 142 142 143 case 'V': 144 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 145 return 0; 146 143 147 case VINF_GETOPT_NOT_OPTION: 144 148 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: Unexpected argument '%s'.\n", Val.psz); … … 146 150 147 151 default: 148 if (ch > 0) 149 { 150 if (RT_C_IS_GRAPH(ch)) 151 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: -%c\n", ch); 152 else 153 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: %i\n", ch); 154 } 155 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 156 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unknown option: %s\n", Val.psz); 157 else if (Val.pDef) 158 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %s: %Rrs\n", Val.pDef->pszLong, ch); 159 else 160 RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %Rrs\n", ch); 161 return 1; 152 return RTGetOptPrintError(ch, &Val); 162 153 } 163 154 } -
trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
r22077 r26517 66 66 RTGETOPTUNION ValueUnion; 67 67 RTGETOPTSTATE GetState; 68 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */);68 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 69 69 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 70 70 { … … 87 87 break; 88 88 89 case VINF_GETOPT_NOT_OPTION:90 RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz);91 return 1;92 93 89 default: 94 if (ch < 0) 95 RTPrintf("tstGIP-2: %Rrc: %s\n", ch, ValueUnion.psz); 96 else 97 RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz); 98 return 1; 90 return RTGetOptPrintError(ch, &ValueUnion); 99 91 } 100 92 } -
trunk/src/VBox/HostDrivers/Support/testcase/tstSupLoadModule.cpp
r26498 r26517 61 61 static const RTGETOPTDEF s_aOptions[] = 62 62 { 63 { "--help", 'h', 0 }63 { "--help", 'h', RTGETOPT_REQ_NOTHING } /* (dummy entry) */ 64 64 }; 65 65 … … 96 96 return 1; 97 97 98 case 'V': 99 RTPrintf("$Revision$\n"); 100 return 0; 101 98 102 default: 99 103 return RTGetOptPrintError(ch, &ValueUnion); -
trunk/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp
r22077 r26517 270 270 RTGETOPTUNION Value; 271 271 RTGETOPTSTATE GetState; 272 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0 /* fFlags*/);272 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 273 273 while ((ch = RTGetOpt(&GetState, &Value))) 274 274 switch (ch) -
trunk/src/VBox/Main/generic/OpenGLTestApp.cpp
r26098 r26517 232 232 { "--log", 'l', RTGETOPT_REQ_STRING }, 233 233 #endif 234 { "--help", 'h', RTGETOPT_REQ_NOTHING },235 234 }; 236 235 … … 307 306 break; 308 307 308 case 'V': 309 RTPrintf("$Revision: $\n"); 310 return 0; 311 309 312 case VERR_GETOPT_UNKNOWN_OPTION: 310 313 case VINF_GETOPT_NOT_OPTION: … … 312 315 313 316 default: 317 /* complain? RTGetOptPrintError(rc, &Val); */ 314 318 break; 315 319 } 316 320 317 if (rc)321 if (rc) 318 322 break; 319 323 } -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r26450 r26517 32 32 #include <VBox/version.h> 33 33 34 #include <iprt/buildconfig.h> 34 35 #include <iprt/thread.h> 35 36 #include <iprt/rand.h> … … 143 144 static const RTGETOPTDEF g_aOptions[] 144 145 = { 145 { "--help", 'h', RTGETOPT_REQ_NOTHING }, 146 { "--help", 'h', RTGETOPT_REQ_NOTHING }, /* for DisplayHelp() */ 146 147 #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) 147 148 { "--background", 'b', RTGETOPT_REQ_NOTHING }, … … 588 589 RTGETOPTUNION ValueUnion; 589 590 RTGETOPTSTATE GetState; 590 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags*/);591 RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /*fFlags*/); 591 592 while ((c = RTGetOpt(&GetState, &ValueUnion))) 592 593 { … … 629 630 case 'h': 630 631 DisplayHelp(); 631 exit(0); 632 break; 632 return 0; 633 633 634 634 case 'v': … … 641 641 break; 642 642 #endif 643 case VINF_GETOPT_NOT_OPTION:644 RT StrmPrintf(g_pStdErr, "unhandled parameter: %s\n", ValueUnion.psz);645 return 1;643 case 'V': 644 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 645 return 0; 646 646 647 647 default: 648 if (c > 0) 649 { 650 if (RT_C_IS_GRAPH(c)) 651 RTStrmPrintf(g_pStdErr, "unhandled option: -%c", c); 652 else 653 RTStrmPrintf(g_pStdErr, "unhandled option: %i", c); 654 } 655 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 656 RTStrmPrintf(g_pStdErr, "unknown option: %s", ValueUnion.psz); 657 else if (ValueUnion.pDef) 658 RTStrmPrintf(g_pStdErr, "%s: %Rrs", ValueUnion.pDef->pszLong, c); 659 else 660 RTStrmPrintf(g_pStdErr, "%Rrs", c); 661 exit(1); 662 break; 648 rc = RTGetOptPrintError(c, &ValueUnion); 649 return rc; 663 650 } 664 651 } -
trunk/src/VBox/Main/xpcom/server.cpp
r26186 r26517 39 39 #include <VBox/version.h> 40 40 41 #include <iprt/buildconfig.h> 41 42 #include <iprt/initterm.h> 42 43 #include <iprt/critsect.h> … … 798 799 } 799 800 801 case 'h': 802 { 803 RTPrintf("no help\n"); 804 return 1; 805 } 806 807 case 'V': 808 { 809 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 810 return 0; 811 } 812 800 813 default: 801 814 return RTGetOptPrintError(vrc, &ValueUnion); -
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r25771 r26517 710 710 { "--upper-ip", 'u', RTGETOPT_REQ_IPV4ADDR }, 711 711 { "--netmask", 'm', RTGETOPT_REQ_IPV4ADDR }, 712 713 { "--help", 'h', RTGETOPT_REQ_NOTHING },714 { "--version ", 'V', RTGETOPT_REQ_NOTHING },715 712 }; 716 713 717 714 RTGETOPTSTATE State; 718 int rc = RTGetOptInit(&State, argc, argv, &s_aOptionDefs[0], RT_ELEMENTS(s_aOptionDefs), 0, 0 );715 int rc = RTGetOptInit(&State, argc, argv, &s_aOptionDefs[0], RT_ELEMENTS(s_aOptionDefs), 0, 0 /*fFlags*/); 719 716 AssertRCReturn(rc, 49); 720 717 … … 833 830 return 1; 834 831 835 case VERR_GETOPT_UNKNOWN_OPTION:836 case VINF_GETOPT_NOT_OPTION:837 RTPrintf("Unknown option '%s'. Use --help for more information.\n", Val.psz);838 return 1;839 840 832 default: 841 break; 833 rc = RTGetOptPrintError(rc, &Val); 834 RTPrintf("Use --help for more information.\n"); 835 return rc; 842 836 } 843 837 } -
trunk/src/VBox/Runtime/testcase/tstHandleTable.cpp
r17093 r26517 460 460 { "--max", 'm', RTGETOPT_REQ_UINT32 }, 461 461 { "--threads", 't', RTGETOPT_REQ_UINT32 }, 462 { "--help", 'h', RTGETOPT_REQ_NOTHING },463 { "--?", '?', RTGETOPT_REQ_NOTHING },464 462 }; 465 463 … … 489 487 break; 490 488 491 case '?':492 489 case 'h': 493 490 RTPrintf("syntax: tstHandleTable [-b <base>] [-m <max>] [-t <threads>]\n"); 494 491 return 1; 495 492 496 case VINF_GETOPT_NOT_OPTION:497 RTPrintf(" tstHandleTable: unexpected non-option: %s\n", Value.psz);498 break;493 case 'V': 494 RTPrintf("$Revision: $\n"); 495 return 0; 499 496 500 497 default: 501 if (RT_SUCCESS(ch)) 502 RTPrintf("tstHandleTable: invalid argument (%#x): %s\n", ch, Value.psz); 503 else 504 RTPrintf("tstHandleTable: invalid argument: %Rrc - \n", ch, Value.pDef->pszLong); 505 return 1; 498 return RTGetOptPrintError(ch, &Value); 506 499 } 507 500 -
trunk/src/VBox/Runtime/testcase/tstRTCritSect.cpp
r25766 r26517 47 47 #include <iprt/mem.h> 48 48 #include <iprt/semaphore.h> 49 #include <iprt/stream.h> 49 50 #include <iprt/string.h> 50 51 #include <iprt/test.h> … … 495 496 return 1; 496 497 497 case VINF_GETOPT_NOT_OPTION:498 RT TestIFailed("%Rrs\n", ch);499 return RTTestSummaryAndDestroy(hTest);498 case 'V': 499 RTPrintf("$Revision: $\n"); 500 return 0; 500 501 501 502 default: 502 if (ch > 0) 503 { 504 if (RT_C_IS_GRAPH(ch)) 505 RTTestIFailed("unhandled option: -%c\n", ch); 506 else 507 RTTestIFailed("unhandled option: %i\n", ch); 508 } 509 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 510 RTTestIFailed("unknown option: %s\n", ValueUnion.psz); 511 else if (ValueUnion.pDef) 512 RTTestIFailed("%s: %Rrs\n", ValueUnion.pDef->pszLong, ch); 513 else 514 RTTestIFailed("%Rrs\n", ch); 515 return RTTestSummaryAndDestroy(hTest); 503 return RTGetOptPrintError(ch, &ValueUnion); 516 504 } 517 505 } -
trunk/src/VBox/Runtime/testcase/tstRTDigest.cpp
r23507 r26517 300 300 301 301 default: 302 if (ch > 0) 303 { 304 if (RT_C_IS_GRAPH(ch)) 305 Error("unhandled option: -%c\n", ch); 306 else 307 Error("unhandled option: %i\n", ch); 308 } 309 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 310 Error("unknown option: %s\n", ValueUnion.psz); 311 else if (ValueUnion.pDef) 312 Error("%s: %Rrs\n", ValueUnion.pDef->pszLong, ch); 313 else 314 Error("%Rrs\n", ch); 315 return 1; 302 return RTGetOptPrintError(ch, &ValueUnion); 316 303 } 317 304 } -
trunk/src/VBox/Runtime/testcase/tstTSC.cpp
r25000 r26517 420 420 { "--duration", 'd', RTGETOPT_REQ_UINT32 }, 421 421 { "--calc-frequency", 'f', RTGETOPT_REQ_NOTHING }, 422 { "--help", 'h', RTGETOPT_REQ_NOTHING }423 422 }; 424 423 int iArg = 1; … … 430 429 switch (ch) 431 430 { 432 case 'd': cMsDuration = Value.u32; break; 433 case 'f': fCalcFrequency = true; break; 431 case 'd': cMsDuration = Value.u32; 432 break; 433 434 case 'f': fCalcFrequency = true; 435 break; 436 434 437 case 'h': 435 438 RTPrintf("usage: tstTSC\n" … … 437 440 return 1; 438 441 439 case VINF_GETOPT_NOT_OPTION:440 RT StrmPrintf(g_pStdErr, "tstTSC: too many arguments\n");441 break;442 case 'V': 443 RTPrintf("$Revision: $\n"); 444 return 0; 442 445 443 446 default: 444 RTStrmPrintf(g_pStdErr, "tstTSC: Unknown arg or error (ch=%d)\n", ch); 445 return 1; 447 return RTGetOptPrintError(ch, &Value); 446 448 } 447 449 -
trunk/src/VBox/VMM/testcase/tstCompressionBenchmark.cpp
r23513 r26517 26 26 #include <iprt/asm.h> 27 27 #include <iprt/assert.h> 28 #include <iprt/buildconfig.h> 28 29 #include <iprt/crc.h> 29 30 #include <iprt/ctype.h> … … 248 249 { "--page-file", 'f', RTGETOPT_REQ_STRING }, 249 250 { "--offset", 'o', RTGETOPT_REQ_UINT64 }, 250 { "--help", 'h', RTGETOPT_REQ_NOTHING },251 251 }; 252 252 … … 315 315 return 0; 316 316 317 case 'V': 318 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 319 return 0; 320 317 321 default: 318 if (rc == VINF_GETOPT_NOT_OPTION) 319 Error("unknown argument: %s\n", Val.psz); 320 else if (rc > 0) 321 { 322 if (RT_C_IS_GRAPH(rc)) 323 Error("unhandled option: -%c\n", rc); 324 else 325 Error("unhandled option: %d\n", rc); 326 } 327 else if (rc == VERR_GETOPT_UNKNOWN_OPTION) 328 Error("unknown option: %s\n", Val.psz); 329 else if (Val.pDef) 330 Error("%s: %Rrs\n", Val.pDef->pszLong, rc); 331 else 332 Error("%Rrs\n", rc); 333 return 1; 322 return RTGetOptPrintError(rc, &Val); 334 323 } 335 324 } -
trunk/src/VBox/VMM/testcase/tstVMM.cpp
r26153 r26517 205 205 { "--cpus", 'c', RTGETOPT_REQ_UINT8 }, 206 206 { "--test", 't', RTGETOPT_REQ_STRING }, 207 { "--help", 'h', 0 },208 207 }; 209 208 enum … … 241 240 return 1; 242 241 243 case VINF_GETOPT_NOT_OPTION:244 RTPrintf(" tstVMM: syntax error: non option '%s'\n", ValueUnion.psz);245 break;242 case 'V': 243 RTPrintf("$Revision: $\n"); 244 return 0; 246 245 247 246 default: 248 if (ch > 0) 249 { 250 if (RT_C_IS_GRAPH(ch)) 251 RTPrintf("tstVMM: unhandled option: -%c\n", ch); 252 else 253 RTPrintf("tstVMM: unhandled option: %i\n", ch); 254 } 255 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 256 RTPrintf("tstVMM: unknown option: %s\n", ValueUnion.psz); 257 else if (ValueUnion.pDef) 258 RTPrintf("tstVMM: %s: %Rrs\n", ValueUnion.pDef->pszLong, ch); 259 else 260 RTPrintf("tstVMM: %Rrs\n", ch); 261 return 1; 247 return RTGetOptPrintError(ch, &ValueUnion); 262 248 } 263 249 }
Note:
See TracChangeset
for help on using the changeset viewer.