Changeset 71123 in vbox
- Timestamp:
- Feb 26, 2018 11:01:04 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
r71122 r71123 1399 1399 uint32_t fQueryInfoFlags = RTPATH_F_ON_LINK; 1400 1400 1401 /* Init file list. */1402 RTLISTANCHOR fileList;1403 RTListInit(&fileList);1404 1405 1401 while ( (ch = RTGetOpt(&GetState, &ValueUnion)) 1406 1402 && RT_SUCCESS(rc)) … … 1434 1430 case VINF_GETOPT_NOT_OPTION: 1435 1431 { 1436 /** @todo r=bird: The whole fileList is unecessary because you're using 1437 * RTGETOPTINIT_FLAGS_OPTS_FIRST. You can obviously do the processing right 1438 * here, but you could also just drop down and rewind GetState.iNext by one and 1439 * continue there. */ 1440 1441 /* Add file(s) to buffer. This enables processing multiple files 1442 * at once. 1443 * 1444 * Since the non-options (RTGETOPTINIT_FLAGS_OPTS_FIRST) come last when 1445 * processing this loop it's safe to immediately exit on syntax errors 1446 * or showing the help text (see above). */ 1447 rc = vgsvcToolboxPathBufAddPathEntry(&fileList, ValueUnion.psz); 1432 Assert(GetState.iNext); 1433 GetState.iNext--; 1448 1434 break; 1449 1435 } … … 1452 1438 return RTGetOptPrintError(ch, &ValueUnion); 1453 1439 } 1440 1441 /* All flags / options processed? Bail out here. 1442 * Processing the file / directory list comes down below. */ 1443 if (ch == VINF_GETOPT_NOT_OPTION) 1444 break; 1454 1445 } 1455 1446 … … 1464 1455 } 1465 1456 1466 PVBOXSERVICETOOLBOXPATHENTRY pNodeIt; 1467 RTListForEach(&fileList, pNodeIt, VBOXSERVICETOOLBOXPATHENTRY, Node) 1457 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 1468 1458 { 1469 1459 RTFSOBJINFO objInfo; 1470 int rc2 = RTPathQueryInfoEx( pNodeIt->pszName, &objInfo, RTFSOBJATTRADD_UNIX, fQueryInfoFlags);1460 int rc2 = RTPathQueryInfoEx(ValueUnion.psz, &objInfo, RTFSOBJATTRADD_UNIX, fQueryInfoFlags); 1471 1461 if (RT_FAILURE(rc2)) 1472 1462 { 1473 1463 if (!(fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE)) 1474 RTMsgError("Cannot stat for '%s': %Rrc\n", pNodeIt->pszName, rc2);1464 RTMsgError("Cannot stat for '%s': %Rrc\n", ValueUnion.psz, rc2); 1475 1465 } 1476 1466 else 1477 1467 { 1478 rc2 = vgsvcToolboxPrintFsInfo( pNodeIt->pszName,1479 strlen( pNodeIt->pszName) /* cbName */,1468 rc2 = vgsvcToolboxPrintFsInfo(ValueUnion.psz, 1469 strlen(ValueUnion.psz) /* cbName */, 1480 1470 fOutputFlags, 1481 1471 &objInfo); … … 1492 1482 1493 1483 /* At this point the overall result (success/failure) should be in rc. */ 1494 1495 if (RTListIsEmpty(&fileList))1496 RTMsgError("Missing operand\n");1497 1484 } 1498 1485 else 1499 1486 RTMsgError("Failed with rc=%Rrc\n", rc); 1500 1501 vgsvcToolboxPathBufDestroy(&fileList);1502 1487 1503 1488 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.

