Changeset 37543 in vbox
- Timestamp:
- Jun 17, 2011 1:52:29 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37525 r37543 336 336 " [--snapshot <uuid>|<name>]\n" 337 337 " [--mode machine|machineandchilds|all]\n" 338 " [--options keepallmacs|keepnatmacs]\n" 338 339 " [--name <name>]\n" 339 340 " [--basefolder <basefolder>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r37531 r37543 273 273 { "--name", 'n', RTGETOPT_REQ_STRING }, 274 274 { "--mode", 'm', RTGETOPT_REQ_STRING }, 275 { "--options", 'o', RTGETOPT_REQ_STRING }, 275 276 { "--register", 'r', RTGETOPT_REQ_NOTHING }, 276 277 { "--basefolder", 'p', RTGETOPT_REQ_STRING }, … … 292 293 } 293 294 295 static int parseCloneOptions(const char *psz, com::SafeArray<CloneOptions_T> *options) 296 { 297 int rc = VINF_SUCCESS; 298 while (psz && *psz && RT_SUCCESS(rc)) 299 { 300 size_t len; 301 const char *pszComma = strchr(psz, ','); 302 if (pszComma) 303 len = pszComma - psz; 304 else 305 len = strlen(psz); 306 if (len > 0) 307 { 308 if (!RTStrNICmp(psz, "KeepAllMACs", len)) 309 options->push_back(CloneOptions_KeepAllMACs); 310 else if (!RTStrNICmp(psz, "KeepNATMACs", len)) 311 options->push_back(CloneOptions_KeepNATMACs); 312 // else if (!RTStrNICmp(psz, "Link", len)) 313 // *options.push_back(CloneOptions_Link) 314 else 315 rc = VERR_PARSE_ERROR; 316 } 317 if (pszComma) 318 psz += len + 1; 319 else 320 psz += len; 321 } 322 323 return rc; 324 } 325 294 326 int handleCloneVM(HandlerArg *a) 295 327 { 296 HRESULT rc; 297 const char *pszSrcName = NULL; 298 const char *pszSnapshotName = NULL; 299 CloneMode_T mode = CloneMode_MachineState; 300 const char *pszTrgName = NULL; 301 const char *pszTrgBaseFolder = NULL; 302 bool fRegister = false; 303 RTUUID trgUuid; 328 HRESULT rc; 329 const char *pszSrcName = NULL; 330 const char *pszSnapshotName = NULL; 331 CloneMode_T mode = CloneMode_MachineState; 332 com::SafeArray<CloneOptions_T> options; 333 const char *pszTrgName = NULL; 334 const char *pszTrgBaseFolder = NULL; 335 bool fRegister = false; 336 RTUUID trgUuid; 304 337 305 338 int c; … … 320 353 if (RT_FAILURE(parseCloneMode(ValueUnion.psz, &mode))) 321 354 return errorArgument("Invalid clone mode '%s'\n", ValueUnion.psz); 355 break; 356 357 case 'o': // --options 358 if (RT_FAILURE(parseCloneOptions(ValueUnion.psz, &options))) 359 return errorArgument("Invalid clone options '%s'\n", ValueUnion.psz); 322 360 break; 323 361 … … 392 430 trgMachine.asOutParam()), 393 431 RTEXITCODE_FAILURE); 394 395 /* Clone options */396 com::SafeArray<CloneOptions_T> options;397 options.push_back(CloneOptions_KeepNATMACs);398 432 399 433 /* Start the cloning */
Note:
See TracChangeset
for help on using the changeset viewer.