Changeset 77606 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Mar 8, 2019 2:55:07 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r76553 r77606 1 #include <signal.h> 1 2 /* $Id$ */ 2 3 /** @file … … 50 51 MEDIUMCATEGORY_FLOPPY 51 52 } MEDIUMCATEGORY; 52 53 54 53 55 54 // funcs … … 244 243 { "--variant", 'm', RTGETOPT_REQ_STRING }, 245 244 { "-variant", 'm', RTGETOPT_REQ_STRING }, // deprecated 245 { "--property", 'p', RTGETOPT_REQ_STRING } 246 246 }; 247 247 … … 253 253 const char *diffparent = NULL; 254 254 uint64_t size = 0; 255 typedef struct MEDIUMPROPERTY_LIST { 256 struct MEDIUMPROPERTY_LIST *next; 257 char *key; 258 char *value; 259 } MEDIUMPROPERTY, *PMEDIUMPROPERTY; 260 PMEDIUMPROPERTY pMediumProps = NULL; 255 261 enum { 256 262 CMD_NONE, … … 312 318 break; 313 319 320 case 'p': // --property 321 { 322 /* allocate property kvp, parse, and append to end of singly linked list */ 323 # define PROP_MAXLEN 256 324 PMEDIUMPROPERTY pNewProp = (PMEDIUMPROPERTY)RTMemAlloc(sizeof(MEDIUMPROPERTY)); 325 if (!pNewProp) 326 return errorArgument("Can't allocate memory for property '%s'", ValueUnion.psz); 327 int cbKvp = RTStrNLen(ValueUnion.psz, PROP_MAXLEN); 328 char *cp; 329 for (cp = (char *)ValueUnion.psz; *cp != '=' && cp < ValueUnion.psz + cbKvp; cp++) 330 continue; 331 if (cp < ValueUnion.psz + cbKvp) 332 { 333 *cp = '\0'; 334 pNewProp->next = NULL; 335 pNewProp->key = (char *)ValueUnion.psz; 336 pNewProp->value = cp + 1; 337 } 338 if (pMediumProps) { 339 PMEDIUMPROPERTY pProp; 340 for (pProp = pMediumProps; pProp->next; pProp = pProp->next) 341 continue; 342 pProp->next = pNewProp; 343 } 344 else 345 pMediumProps = pNewProp; 346 } 314 347 case 'F': // --static ("fixed"/"flat") 315 348 { … … 441 474 rc = E_INVALIDARG; /* cannot happen but make gcc happy */ 442 475 476 443 477 if (SUCCEEDED(rc) && pMedium) 444 478 { 479 if (pMediumProps) 480 for (PMEDIUMPROPERTY pProp = pMediumProps; pProp; pProp = pProp->next) 481 CHECK_ERROR(pMedium, SetProperty(Bstr(pProp->key).raw(), Bstr(pProp->value).raw())); 482 } 483 445 484 ComPtr<IProgress> pProgress; 446 485 com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8); … … 461 500 rc = showProgress(pProgress); 462 501 CHECK_PROGRESS_ERROR(pProgress, ("Failed to create medium")); 463 }464 502 } 465 503 … … 1000 1038 else if (cmd == CMD_DVD) 1001 1039 rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_DVD, 1002 AccessMode_ReadOnly, pDstMedium);1040 AccessMode_ReadOnly, pDstMedium); 1003 1041 else if (cmd == CMD_FLOPPY) 1004 1042 rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_Floppy, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r77595 r77606 993 993 " [--variant Standard,Fixed,Split2G,Stream,ESX,\n" 994 994 " Formatted]\n" 995 " [[--property <name>=<value>] --property <name>=<value]...\n" 995 996 "\n", SEP); 996 997
Note:
See TracChangeset
for help on using the changeset viewer.