- Timestamp:
- Mar 20, 2009 11:04:44 AM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
r18072 r18108 1 /* $Id : VBoxManageDHCPServer.cpp 44622 2009-03-17 13:48:59Z misha$ */1 /* $Id$ */ 2 2 /** @file 3 3 * VBoxManage - Implementation of dhcpserver command. … … 43 43 #include <iprt/net.h> 44 44 #include <iprt/getopt.h> 45 #include <iprt/ctype.h> 45 46 46 47 #include <VBox/log.h> … … 58 59 } OPCODE; 59 60 60 enum enOptionCodes 61 { 62 NETNAME = 1000, 63 IFNAME, 64 IP, 65 NETMASK, 66 LOWERIP, 67 UPPERIP, 68 ENABLE, 69 DISABLE 70 }; 71 72 static const RTGETOPTDEF g_aListOptions[] 61 static const RTGETOPTDEF g_aDHCPIPOptions[] 73 62 = { 74 { "-netname", NETNAME, RTGETOPT_REQ_STRING }, 75 { "-ifname", IFNAME, RTGETOPT_REQ_STRING }, 76 { "-ip", IP, RTGETOPT_REQ_STRING }, 77 { "-netmask", NETMASK, RTGETOPT_REQ_STRING }, 78 { "-lowerip", LOWERIP, RTGETOPT_REQ_STRING }, 79 { "-upperip", UPPERIP, RTGETOPT_REQ_STRING }, 80 { "-enable", ENABLE, RTGETOPT_REQ_NOTHING }, 81 { "-disable", DISABLE, RTGETOPT_REQ_NOTHING } 63 { "--netname", 'n', RTGETOPT_REQ_STRING }, 64 { "-netname", 'n', RTGETOPT_REQ_STRING }, // deprecated (if removed check below) 65 { "--ifname", 'i', RTGETOPT_REQ_STRING }, 66 { "-ifname", 'i', RTGETOPT_REQ_STRING }, // deprecated 67 { "--ip", 'a', RTGETOPT_REQ_STRING }, 68 { "-ip", 'a', RTGETOPT_REQ_STRING }, // deprecated 69 { "--netmask", 'm', RTGETOPT_REQ_STRING }, 70 { "-netmask", 'm', RTGETOPT_REQ_STRING }, // deprecated 71 { "--lowerip", 'l', RTGETOPT_REQ_STRING }, 72 { "-lowerip", 'l', RTGETOPT_REQ_STRING }, // deprecated 73 { "--upperip", 'u', RTGETOPT_REQ_STRING }, 74 { "-upperip", 'u', RTGETOPT_REQ_STRING }, // deprecated 75 { "--enable", 'e', RTGETOPT_REQ_NOTHING }, 76 { "-enable", 'e', RTGETOPT_REQ_NOTHING }, // deprecated 77 { "--disable", 'd', RTGETOPT_REQ_NOTHING }, 78 { "-disable", 'd', RTGETOPT_REQ_NOTHING } // deprecated 82 79 }; 83 80 … … 104 101 a->argc, 105 102 a->argv, 106 g_a ListOptions,107 enmCode != OP_REMOVE ? RT_ELEMENTS(g_a ListOptions): 2, /* we use only -netname and-ifname for remove*/103 g_aDHCPIPOptions, 104 enmCode != OP_REMOVE ? RT_ELEMENTS(g_aDHCPIPOptions): 4, /* we use only --netname and --ifname for remove*/ 108 105 index, 109 106 0 /* fFlags */); … … 112 109 switch (c) 113 110 { 114 case NETNAME:111 case 'n': // --netname 115 112 if(pNetName) 116 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - netname once.");113 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --netname once."); 117 114 else if (pIfName) 118 return errorSyntax(USAGE_DHCPSERVER, "You can either use a - netname or-ifname for identifying the dhcp server.");115 return errorSyntax(USAGE_DHCPSERVER, "You can either use a --netname or --ifname for identifying the dhcp server."); 119 116 else 120 117 { … … 122 119 } 123 120 break; 124 case IFNAME:121 case 'i': // --ifname 125 122 if(pIfName) 126 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - ifname once.");123 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --ifname once."); 127 124 else if (pNetName) 128 return errorSyntax(USAGE_DHCPSERVER, "You can either use a - netname or-ipname for identifying the dhcp server.");125 return errorSyntax(USAGE_DHCPSERVER, "You can either use a --netname or --ipname for identifying the dhcp server."); 129 126 else 130 127 { … … 132 129 } 133 130 break; 134 case IP:131 case 'a': // -ip 135 132 if(pIp) 136 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - ip once.");133 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --ip once."); 137 134 else 138 135 { … … 140 137 } 141 138 break; 142 case NETMASK:139 case 'm': // --netmask 143 140 if(pNetmask) 144 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - netmask once.");141 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --netmask once."); 145 142 else 146 143 { … … 148 145 } 149 146 break; 150 case LOWERIP:147 case 'l': // --lowerip 151 148 if(pLowerIp) 152 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - lowerip once.");149 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --lowerip once."); 153 150 else 154 151 { … … 156 153 } 157 154 break; 158 case UPPERIP:155 case 'u': // --upperip 159 156 if(pUpperIp) 160 return errorSyntax(USAGE_DHCPSERVER, "You can only specify - upperip once.");157 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --upperip once."); 161 158 else 162 159 { … … 164 161 } 165 162 break; 166 case ENABLE:163 case 'e': // --enable 167 164 if(enable >= 0) 168 return errorSyntax(USAGE_DHCPSERVER, "You can specify either - enable or-disable once.");165 return errorSyntax(USAGE_DHCPSERVER, "You can specify either --enable or --disable once."); 169 166 else 170 167 { … … 172 169 } 173 170 break; 174 case DISABLE:171 case 'd': // --disable 175 172 if(enable >= 0) 176 return errorSyntax(USAGE_DHCPSERVER, "You can specify either - enable or-disable once.");173 return errorSyntax(USAGE_DHCPSERVER, "You can specify either --enable or --disable once."); 177 174 else 178 175 { … … 181 178 break; 182 179 case VINF_GETOPT_NOT_OPTION: 183 case VERR_GETOPT_UNKNOWN_OPTION: 184 return errorSyntax(USAGE_DHCPSERVER, "Unknown option \"%s\".", ValueUnion.psz); 180 return errorSyntax(USAGE_DHCPSERVER, "unhandled parameter: %s", ValueUnion.psz); 185 181 break; 186 182 default: 187 183 if (c > 0) 188 return errorSyntax(USAGE_DHCPSERVER, "missing case: %c\n", c); 184 { 185 if (RT_C_IS_GRAPH(c)) 186 return errorSyntax(USAGE_DHCPSERVER, "unhandled option: -%c", c); 187 else 188 return errorSyntax(USAGE_DHCPSERVER, "unhandled option: %i", c); 189 } 190 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 191 return errorSyntax(USAGE_DHCPSERVER, "unknown option: %s", ValueUnion.psz); 189 192 else if (ValueUnion.pDef) 190 193 return errorSyntax(USAGE_DHCPSERVER, "%s: %Rrs", ValueUnion.pDef->pszLong, c); … … 195 198 196 199 if(! pNetName && !pIfName) 197 return errorSyntax(USAGE_DHCPSERVER, "You need to specify either - netname or-ifname to identify the dhcp server");200 return errorSyntax(USAGE_DHCPSERVER, "You need to specify either --netname or --ifname to identify the dhcp server"); 198 201 199 202 if(enmCode != OP_REMOVE) … … 202 205 { 203 206 if(!pIp) 204 return errorSyntax(USAGE_DHCPSERVER, "You need to specify - ip option");207 return errorSyntax(USAGE_DHCPSERVER, "You need to specify --ip option"); 205 208 206 209 if(!pNetmask) 207 return errorSyntax(USAGE_DHCPSERVER, "You need to specify - netmask option");210 return errorSyntax(USAGE_DHCPSERVER, "You need to specify --netmask option"); 208 211 209 212 if(!pLowerIp) 210 return errorSyntax(USAGE_DHCPSERVER, "You need to specify - lowerip option");213 return errorSyntax(USAGE_DHCPSERVER, "You need to specify --lowerip option"); 211 214 212 215 if(!pUpperIp) 213 return errorSyntax(USAGE_DHCPSERVER, "You need to specify - upperip option");216 return errorSyntax(USAGE_DHCPSERVER, "You need to specify --upperip option"); 214 217 } 215 218 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r17980 r18108 120 120 { 121 121 { "--filename", 'f', RTGETOPT_REQ_STRING }, 122 { "-filename", 'f', RTGETOPT_REQ_STRING }, 122 { "-filename", 'f', RTGETOPT_REQ_STRING }, // deprecated 123 123 { "--size", 's', RTGETOPT_REQ_UINT64 }, 124 { "-size", 's', RTGETOPT_REQ_UINT64 }, 124 { "-size", 's', RTGETOPT_REQ_UINT64 }, // deprecated 125 125 { "--format", 'o', RTGETOPT_REQ_STRING }, 126 { "-format", 'o', RTGETOPT_REQ_STRING }, 126 { "-format", 'o', RTGETOPT_REQ_STRING }, // deprecated 127 127 { "--static", 'F', RTGETOPT_REQ_NOTHING }, 128 { "-static", 'F', RTGETOPT_REQ_NOTHING }, 128 { "-static", 'F', RTGETOPT_REQ_NOTHING }, // deprecated 129 129 { "--variant", 'm', RTGETOPT_REQ_STRING }, 130 { "-variant", 'm', RTGETOPT_REQ_STRING }, 130 { "-variant", 'm', RTGETOPT_REQ_STRING }, // deprecated 131 131 { "--type", 't', RTGETOPT_REQ_STRING }, 132 { "-type", 't', RTGETOPT_REQ_STRING }, 132 { "-type", 't', RTGETOPT_REQ_STRING }, // deprecated 133 133 { "--comment", 'c', RTGETOPT_REQ_STRING }, 134 { "-comment", 'c', RTGETOPT_REQ_STRING }, 134 { "-comment", 'c', RTGETOPT_REQ_STRING }, // deprecated 135 135 { "--remember", 'r', RTGETOPT_REQ_NOTHING }, 136 { "-remember", 'r', RTGETOPT_REQ_NOTHING }, 137 { "--register", 'r', RTGETOPT_REQ_NOTHING }, 138 { "-register", 'r', RTGETOPT_REQ_NOTHING }, 136 { "-remember", 'r', RTGETOPT_REQ_NOTHING }, // deprecated 137 { "--register", 'r', RTGETOPT_REQ_NOTHING }, // deprecated (inofficial) 138 { "-register", 'r', RTGETOPT_REQ_NOTHING }, // deprecated 139 139 }; 140 140 … … 488 488 if (c > 0) 489 489 { 490 if (RT_C_IS_ PRINT(c))491 return errorSyntax(USAGE_CLONEHD, " Invalid option-%c", c);490 if (RT_C_IS_GRAPH(c)) 491 return errorSyntax(USAGE_CLONEHD, "unhandled option: -%c", c); 492 492 else 493 return errorSyntax(USAGE_CLONEHD, " Invalid option case%i", c);493 return errorSyntax(USAGE_CLONEHD, "unhandled option: %i", c); 494 494 } 495 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 496 return errorSyntax(USAGE_CLONEHD, "unknown option: %s", ValueUnion.psz); 495 497 else if (ValueUnion.pDef) 496 498 return errorSyntax(USAGE_CLONEHD, "%s: %Rrs", ValueUnion.pDef->pszLong, c); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r18072 r18108 77 77 RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n" 78 78 #if defined(VBOX_WITH_NETFLT) 79 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"79 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n" 80 80 #else 81 " bridgedifs|hostinfo|dhcpservers|\n"81 " bridgedifs|hostinfo|dhcpservers|\n" 82 82 #endif 83 83 " hddbackends|hdds|dvds|floppies|\n" … … 241 241 if (u64Cmd & USAGE_EXPORTAPPLIANCE) 242 242 { 243 RTPrintf("VBoxManage export <machines> [--output|-o]<ovf>\n"243 RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n" 244 244 "\n"); 245 245 } … … 473 473 if (u64Cmd & USAGE_METRICS) 474 474 { 475 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]] 475 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n" 476 476 " (comma-separated)\n\n" 477 477 "VBoxManage metrics setup\n" … … 492 492 if (u64Cmd & USAGE_HOSTONLYIFS) 493 493 { 494 RTPrintf("VBoxManage hostonlyif ipconfig <name> 495 " [- dhcp|\n"496 " - ip<ipv4> [-netmask<ipv4> (deflt: 255.255.255.0)]|\n"497 " - ipv6<ipv6> [-netmasklengthv6<length> (deflt: 64)]]\n"494 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n" 495 " [--dhcp |\n" 496 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n" 497 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n" 498 498 # if defined(RT_OS_WINDOWS) 499 499 " create |\n" … … 506 506 if (u64Cmd & USAGE_DHCPSERVER) 507 507 { 508 RTPrintf("VBoxManage dhcpserver add|modify - netname <network_name> |\n"508 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n" 509 509 #if defined(VBOX_WITH_NETFLT) 510 " 511 #endif 512 " [- ip <ip_address>\n"513 " - netmask <network_mask>\n"514 " - lowerip <lower_ip>\n"515 " - upperip <upper_ip>]\n"516 " [- enable |-disable]\n"517 "VBoxManage dhcpserver remove - netname <network_name> |\n"510 " --ifname <hostonly_if_name>\n" 511 #endif 512 " [--ip <ip_address>\n" 513 " --netmask <network_mask>\n" 514 " --lowerip <lower_ip>\n" 515 " --upperip <upper_ip>]\n" 516 " [--enable | --disable]\n" 517 "VBoxManage dhcpserver remove --netname <network_name> |\n" 518 518 #if defined(VBOX_WITH_NETFLT) 519 " - ifname <hostonly_if_name>\n"519 " --ifname <hostonly_if_name>\n" 520 520 #endif 521 521 "\n"); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp
r18017 r18108 43 43 #include <iprt/net.h> 44 44 #include <iprt/getopt.h> 45 #include <iprt/ctype.h> 45 46 46 47 #include <VBox/log.h> … … 141 142 #endif 142 143 143 enum enOptionCodes 144 { 145 DHCP = 1000, 146 IP, 147 NETMASK, 148 IPV6, 149 NETMASKLENGTHV6 150 }; 151 152 static const RTGETOPTDEF g_aListOptions[] 144 static const RTGETOPTDEF g_aHostOnlyIPOptions[] 153 145 = { 154 { "-dhcp", DHCP, RTGETOPT_REQ_NOTHING }, 155 { "-ip", IP, RTGETOPT_REQ_STRING }, 156 { "-netmask", NETMASK, RTGETOPT_REQ_STRING }, 157 { "-ipv6", IPV6, RTGETOPT_REQ_STRING }, 158 { "-netmasklengthv6", NETMASKLENGTHV6, RTGETOPT_REQ_UINT8 } 146 { "--dhcp", 'd', RTGETOPT_REQ_NOTHING }, 147 { "-dhcp", 'd', RTGETOPT_REQ_NOTHING }, // deprecated 148 { "--ip", 'a', RTGETOPT_REQ_STRING }, 149 { "-ip", 'a', RTGETOPT_REQ_STRING }, // deprecated 150 { "--netmask", 'm', RTGETOPT_REQ_STRING }, 151 { "-netmask", 'm', RTGETOPT_REQ_STRING }, // deprecated 152 { "--ipv6", 'b', RTGETOPT_REQ_STRING }, 153 { "-ipv6", 'b', RTGETOPT_REQ_STRING }, // deprecated 154 { "--netmasklengthv6", 'l', RTGETOPT_REQ_UINT8 }, 155 { "-netmasklengthv6", 'l', RTGETOPT_REQ_UINT8 } // deprecated 159 156 }; 160 157 … … 183 180 a->argc, 184 181 a->argv, 185 g_a ListOptions,186 RT_ELEMENTS(g_a ListOptions),182 g_aHostOnlyIPOptions, 183 RT_ELEMENTS(g_aHostOnlyIPOptions), 187 184 index, 188 185 0 /* fFlags */); … … 191 188 switch (c) 192 189 { 193 case DHCP: //-dhcp190 case 'd': // --dhcp 194 191 if (bDhcp) 195 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify -dhcp once."); 196 else if(bNetmasklengthv6 || pIpv6 || pIp || pNetmask) 197 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use -dhcp with static ip configuration parameters: -ip, -netmask, -ipv6 and -netmasklengthv6."); 192 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify --dhcp once."); 198 193 else 199 194 bDhcp = true; 200 195 break; 201 case IP:196 case 'a': // --ip 202 197 if(pIp) 203 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify -ip once."); 204 else if (bDhcp) 205 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use -dhcp with static ip configuration parameters: -ip, -netmask, -ipv6 and -netmasklengthv6."); 206 else if(bNetmasklengthv6 || pIpv6) 207 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use ipv4 configuration (-ip and -netmask) with ipv6 (-ipv6 and -netmasklengthv6) simultaneously."); 208 else 209 { 198 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify --ip once."); 199 else 210 200 pIp = ValueUnion.psz; 211 } 212 break; 213 case NETMASK: 201 break; 202 case 'm': // --netmask 214 203 if(pNetmask) 215 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify -netmask once."); 216 else if (bDhcp) 217 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use -dhcp with static ip configuration parameters: -ip, -netmask, -ipv6 and -netmasklengthv6."); 218 else if(bNetmasklengthv6 || pIpv6) 219 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use ipv4 configuration (-ip and -netmask) with ipv6 (-ipv6 and -netmasklengthv6) simultaneously."); 220 else 221 { 204 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify --netmask once."); 205 else 222 206 pNetmask = ValueUnion.psz; 223 } 224 break; 225 case IPV6: 207 break; 208 case 'b': // --ipv6 226 209 if(pIpv6) 227 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify -ipv6 once."); 228 else if (bDhcp) 229 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use -dhcp with static ip configuration parameters: -ip, -netmask, -ipv6 and -netmasklengthv6."); 230 else if(pIp || pNetmask) 231 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use ipv4 configuration (-ip and -netmask) with ipv6 (-ipv6 and -netmasklengthv6) simultaneously."); 210 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify --ipv6 once."); 232 211 else 233 212 pIpv6 = ValueUnion.psz; 234 213 break; 235 case NETMASKLENGTHV6:214 case 'l': // --netmasklengthv6 236 215 if(bNetmasklengthv6) 237 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify -netmasklengthv6 once."); 238 else if (bDhcp) 239 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use -dhcp with static ip configuration parameters: -ip, -netmask, -ipv6 and -netmasklengthv6."); 240 else if(pIp || pNetmask) 241 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use ipv4 configuration (-ip and -netmask) with ipv6 (-ipv6 and -netmasklengthv6) simultaneously."); 216 return errorSyntax(USAGE_HOSTONLYIFS, "You can only specify --netmasklengthv6 once."); 242 217 else 243 218 { … … 247 222 break; 248 223 case VINF_GETOPT_NOT_OPTION: 249 case VERR_GETOPT_UNKNOWN_OPTION: 250 return errorSyntax(USAGE_HOSTONLYIFS, "Unknown option \"%s\".", ValueUnion.psz); 224 return errorSyntax(USAGE_HOSTONLYIFS, "unhandled parameter: %s", ValueUnion.psz); 251 225 break; 252 226 default: 253 227 if (c > 0) 254 return errorSyntax(USAGE_HOSTONLYIFS, "missing case: %c\n", c); 228 { 229 if (RT_C_IS_GRAPH(c)) 230 return errorSyntax(USAGE_HOSTONLYIFS, "unhandled option: -%c", c); 231 else 232 return errorSyntax(USAGE_HOSTONLYIFS, "unhandled option: %i", c); 233 } 234 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 235 return errorSyntax(USAGE_HOSTONLYIFS, "unknown option: %s", ValueUnion.psz); 255 236 else if (ValueUnion.pDef) 256 237 return errorSyntax(USAGE_HOSTONLYIFS, "%s: %Rrs", ValueUnion.pDef->pszLong, c); … … 259 240 } 260 241 } 242 243 /* parameter sanity check */ 244 if (bDhcp && (bNetmasklengthv6 || pIpv6 || pIp || pNetmask)) 245 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use --dhcp with static ip configuration parameters: --ip, --netmask, --ipv6 and --netmasklengthv6."); 246 if((pIp || pNetmask) && (bNetmasklengthv6 || pIpv6)) 247 return errorSyntax(USAGE_HOSTONLYIFS, "You can not use ipv4 configuration (--ip and --netmask) with ipv6 (--ipv6 and --netmasklengthv6) simultaneously."); 261 248 262 249 ComPtr<IHost> host; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r17827 r18108 42 42 #include <iprt/stream.h> 43 43 #include <iprt/getopt.h> 44 #include <iprt/ctype.h> 44 45 45 46 #include <VBox/log.h> … … 535 536 RTGETOPTUNION ValueUnion; 536 537 RTGETOPTSTATE GetState; 537 RTGetOptInit(&GetState, 538 a->argc, 539 a->argv, 540 g_aExportOptions, 541 RT_ELEMENTS(g_aExportOptions), 542 0, // start at 0 even though arg 1 was "list" because main() has hacked both the argc and argv given to us 543 0 /* fFlags */); 538 // start at 0 because main() has hacked both the argc and argv given to us 539 RTGetOptInit(&GetState, a->argc, a->argv, g_aExportOptions, 540 RT_ELEMENTS(g_aExportOptions), 0, 0 /* fFlags */); 544 541 while ((c = RTGetOpt(&GetState, &ValueUnion))) 545 542 { … … 573 570 default: 574 571 if (c > 0) 575 return errorSyntax(USAGE_LIST, "missing case: %c\n", c); 572 { 573 if (RT_C_IS_GRAPH(c)) 574 return errorSyntax(USAGE_EXPORTAPPLIANCE, "unhandled option: -%c", c); 575 else 576 return errorSyntax(USAGE_EXPORTAPPLIANCE, "unhandled option: %i", c); 577 } 578 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 579 return errorSyntax(USAGE_EXPORTAPPLIANCE, "unknown option: %s", ValueUnion.psz); 576 580 else if (ValueUnion.pDef) 577 return errorSyntax(USAGE_ LIST, "%s: %Rrs", ValueUnion.pDef->pszLong, c);581 return errorSyntax(USAGE_EXPORTAPPLIANCE, "%s: %Rrs", ValueUnion.pDef->pszLong, c); 578 582 else 579 return errorSyntax(USAGE_ LIST, "%Rrs", c);583 return errorSyntax(USAGE_EXPORTAPPLIANCE, "%Rrs", c); 580 584 } 581 585 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r18023 r18108 39 39 #include <iprt/time.h> 40 40 #include <iprt/getopt.h> 41 #include <iprt/ctype.h> 41 42 42 43 #include "VBoxManage.h" … … 162 163 default: 163 164 if (c > 0) 164 return errorSyntax(USAGE_LIST, "missing case: %c\n", c); 165 { 166 if (RT_C_IS_GRAPH(c)) 167 return errorSyntax(USAGE_LIST, "unhandled option: -%c", c); 168 else 169 return errorSyntax(USAGE_LIST, "unhandled option: %i", c); 170 } 171 else if (c == VERR_GETOPT_UNKNOWN_OPTION) 172 return errorSyntax(USAGE_LIST, "unknown option: %s", ValueUnion.psz); 165 173 else if (ValueUnion.pDef) 166 174 return errorSyntax(USAGE_LIST, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
Note:
See TracChangeset
for help on using the changeset viewer.