Changeset 94209 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 13, 2022 8:16:15 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r94208 r94209 235 235 #endif 236 236 #ifdef VBOX_WITH_GUEST_CONTROL 237 { "guestcontrol", USAGE_ GUESTCONTROL, VBMG_CMD_TODO, handleGuestControl, 0 },237 { "guestcontrol", USAGE_S_NEWCMD, HELP_CMD_GUESTCONTROL, handleGuestControl, 0 }, 238 238 #endif 239 239 { "metrics", USAGE_METRICS, VBMG_CMD_TODO, handleMetrics, 0 }, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r94208 r94209 115 115 USAGE_I_DUMPHDINFO, 116 116 USAGE_STORAGEATTACH, 117 #ifdef VBOX_WITH_GUEST_CONTROL118 USAGE_GUESTCONTROL,119 #endif /* VBOX_WITH_GUEST_CONTROL defined */120 117 USAGE_I_DEBUGLOG, 121 118 USAGE_I_SETHDPARENTUUID, … … 135 132 136 133 137 #ifdef VBOX_WITH_GUEST_CONTROL138 # define HELP_SCOPE_GSTCTRL_RUN RT_BIT(0)139 # define HELP_SCOPE_GSTCTRL_START RT_BIT(1)140 # define HELP_SCOPE_GSTCTRL_COPYFROM RT_BIT(2)141 # define HELP_SCOPE_GSTCTRL_COPYTO RT_BIT(3)142 # define HELP_SCOPE_GSTCTRL_MKDIR RT_BIT(4)143 # define HELP_SCOPE_GSTCTRL_RMDIR RT_BIT(5)144 # define HELP_SCOPE_GSTCTRL_RM RT_BIT(6)145 # define HELP_SCOPE_GSTCTRL_MV RT_BIT(7)146 # define HELP_SCOPE_GSTCTRL_MKTEMP RT_BIT(8)147 # define HELP_SCOPE_GSTCTRL_LIST RT_BIT(9)148 # define HELP_SCOPE_GSTCTRL_CLOSEPROCESS RT_BIT(10)149 # define HELP_SCOPE_GSTCTRL_CLOSESESSION RT_BIT(11)150 # define HELP_SCOPE_GSTCTRL_STAT RT_BIT(12)151 # define HELP_SCOPE_GSTCTRL_UPDATEGA RT_BIT(13)152 # define HELP_SCOPE_GSTCTRL_WATCH RT_BIT(14)153 # define HELP_SCOPE_GSTCTRL_WAITRUNLEVEL RT_BIT(15)154 #endif155 156 134 /** command handler argument */ 157 135 struct HandlerArg … … 251 229 /* VBoxManageDebugVM.cpp */ 252 230 RTEXITCODE handleDebugVM(HandlerArg *a); 253 254 /* VBoxManageGuestCtrl.cpp */255 extern void usageGuestControl(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2, uint64_t fSubcommandScope);256 231 257 232 #ifndef VBOX_ONLY_DOCS -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r93720 r94209 220 220 221 221 DECLARE_TRANSLATION_CONTEXT(GuestCtrl); 222 223 void usageGuestControl(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2, uint64_t fSubcommandScope)224 {225 const uint64_t fAnonSubCmds = HELP_SCOPE_GSTCTRL_CLOSESESSION226 | HELP_SCOPE_GSTCTRL_LIST227 | HELP_SCOPE_GSTCTRL_CLOSEPROCESS228 | HELP_SCOPE_GSTCTRL_CLOSESESSION229 | HELP_SCOPE_GSTCTRL_UPDATEGA230 | HELP_SCOPE_GSTCTRL_WATCH231 | HELP_SCOPE_GSTCTRL_WAITRUNLEVEL;232 233 /* 0 1 2 3 4 5 6 7 8XXXXXXXXXX */234 /* 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 */235 if (~fAnonSubCmds & fSubcommandScope)236 RTStrmPrintf(pStrm,237 "%s guestcontrol %s <uuid|vmname> [--verbose|-v] [--quiet|-q]\n"238 " [--user[name] <name>] [--domain <domain>]\n"239 " [--passwordfile <file> | --password <password>]\n%s",240 pcszSep1, pcszSep2, (fSubcommandScope & RTMSGREFENTRYSTR_SCOPE_MASK) == RTMSGREFENTRYSTR_SCOPE_GLOBAL ? "\n" : "");241 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_RUN)242 RTStrmPrintf(pStrm,243 " run [common-options]\n"244 " [--exe <path to executable>] [--timeout <msec>]\n"245 " [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n"246 " [--ignore-operhaned-processes] [--profile]\n"247 " [--no-wait-stdout|--wait-stdout]\n"248 " [--no-wait-stderr|--wait-stderr]\n"249 " [--dos2unix] [--unix2dos]\n"250 " -- <program/arg0> [argument1] ... [argumentN]]\n"251 "\n");252 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_START)253 RTStrmPrintf(pStrm,254 " start [common-options]\n"255 " [--exe <path to executable>] [--timeout <msec>]\n"256 " [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n"257 " [--ignore-operhaned-processes] [--profile]\n"258 " -- <program/arg0> [argument1] ... [argumentN]]\n"259 "\n");260 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_COPYFROM)261 RTStrmPrintf(pStrm,262 " copyfrom [common-options]\n"263 " [-L|--dereference] [-R|--recursive]\n"264 " <guest-src0> [guest-src1 [...]] <host-dst>\n"265 "\n"266 " copyfrom [common-options]\n"267 " [-L|--dereference] [-R|--recursive]\n"268 " [-t|--target-directory <host-dst-dir>]\n"269 " <guest-src0> [guest-src1 [...]]\n"270 "\n");271 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_COPYTO)272 RTStrmPrintf(pStrm,273 " copyto [common-options]\n"274 " [-L|--dereference] [-R|--recursive]\n"275 " <host-src0> [host-src1 [...]] <guest-dst>\n"276 "\n"277 " copyto [common-options]\n"278 " [-L|--dereference] [-R|--recursive]\n"279 " [-t|--target-directory <guest-dst>]\n"280 " <host-src0> [host-src1 [...]]\n"281 "\n");282 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_MKDIR)283 RTStrmPrintf(pStrm,284 " mkdir|createdir[ectory] [common-options]\n"285 " [--parents] [--mode <mode>]\n"286 " <guest directory> [...]\n"287 "\n");288 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_RMDIR)289 RTStrmPrintf(pStrm,290 " rmdir|removedir[ectory] [common-options]\n"291 " [-R|--recursive]\n"292 " <guest directory> [...]\n"293 "\n");294 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_RM)295 RTStrmPrintf(pStrm,296 " removefile|rm [common-options] [-f|--force]\n"297 " <guest file> [...]\n"298 "\n");299 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_MV)300 RTStrmPrintf(pStrm,301 " mv|move|ren[ame] [common-options]\n"302 " <source> [source1 [...]] <dest>\n"303 "\n");304 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_MKTEMP)305 RTStrmPrintf(pStrm,306 " mktemp|createtemp[orary] [common-options]\n"307 " [--secure] [--mode <mode>] [--tmpdir <directory>]\n"308 " <template>\n"309 "\n");310 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_STAT)311 RTStrmPrintf(pStrm,312 " stat [common-options]\n"313 " <file> [...]\n"314 "\n");315 316 /*317 * Command not requiring authentication.318 */319 if (fAnonSubCmds & fSubcommandScope)320 {321 /* 0 1 2 3 4 5 6 7 8XXXXXXXXXX */322 /* 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 */323 RTStrmPrintf(pStrm,324 "%s guestcontrol %s <uuid|vmname> [--verbose|-v] [--quiet|-q]\n%s",325 pcszSep1, pcszSep2, (fSubcommandScope & RTMSGREFENTRYSTR_SCOPE_MASK) == RTMSGREFENTRYSTR_SCOPE_GLOBAL ? "\n" : "");326 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_LIST)327 RTStrmPrintf(pStrm,328 " list <all|sessions|processes|files> [common-opts]\n"329 "\n");330 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_CLOSEPROCESS)331 RTStrmPrintf(pStrm,332 " closeprocess [common-options]\n"333 " < --session-id <ID>\n"334 " | --session-name <name or pattern>\n"335 " <PID1> [PID1 [...]]\n"336 "\n");337 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_CLOSESESSION)338 RTStrmPrintf(pStrm,339 " closesession [common-options]\n"340 " < --all | --session-id <ID>\n"341 " | --session-name <name or pattern> >\n"342 "\n");343 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_UPDATEGA)344 RTStrmPrintf(pStrm,345 " updatega|updateguestadditions|updateadditions\n"346 " [--source <guest additions .ISO>]\n"347 " [--wait-start] [common-options]\n"348 " [-- [<argument1>] ... [<argumentN>]]\n"349 "\n");350 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_WATCH)351 RTStrmPrintf(pStrm,352 " watch [--timeout <msec>] [common-options]\n"353 "\n");354 if (fSubcommandScope & HELP_SCOPE_GSTCTRL_WAITRUNLEVEL)355 RTStrmPrintf(pStrm,356 " waitrunlevel [--timeout <msec>] [common-options]\n"357 " <system|userland|desktop>\n"358 "\n");359 }360 }361 222 362 223 #ifndef VBOX_ONLY_DOCS … … 992 853 } 993 854 else 994 rcExit = errorSyntax Ex(USAGE_GUESTCONTROL, pCtx->pCmdDef->fSubcommandScope,GuestCtrl::tr("No user name specified!"));855 rcExit = errorSyntax(GuestCtrl::tr("No user name specified!")); 995 856 996 857 pCtx->fPostOptionParsingInited = rcExit == RTEXITCODE_SUCCESS; … … 1280 1141 * @param argv The argument vector for this command. 1281 1142 * @param fRunCmd Set if it's 'run' clear if 'start'. 1282 * @param fHelp The help flag for the command.1283 1143 */ 1284 static RTEXITCODE gctlHandleRunCommon(PGCTLCMDCTX pCtx, int argc, char **argv, bool fRunCmd, uint32_t fHelp) 1285 { 1286 RT_NOREF(fHelp); 1144 static RTEXITCODE gctlHandleRunCommon(PGCTLCMDCTX pCtx, int argc, char **argv, bool fRunCmd) 1145 { 1287 1146 AssertPtrReturn(pCtx, RTEXITCODE_FAILURE); 1288 1147 … … 1359 1218 if ( ValueUnion.psz[0] == '\0' 1360 1219 || ValueUnion.psz[0] == '=') 1361 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RUN, 1362 GuestCtrl::tr("Invalid argument variable[=value]: '%s'"), ValueUnion.psz); 1220 return errorSyntax(GuestCtrl::tr("Invalid argument variable[=value]: '%s'"), ValueUnion.psz); 1363 1221 aEnv.push_back(Bstr(ValueUnion.psz).raw()); 1364 1222 break; … … 1429 1287 1430 1288 default: 1431 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RUN,ch, &ValueUnion);1289 return errorGetOpt(ch, &ValueUnion); 1432 1290 1433 1291 } /* switch */ … … 1436 1294 /* Must have something to execute. */ 1437 1295 if (!pszImage || !*pszImage) 1438 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RUN,GuestCtrl::tr("No executable specified!"));1296 return errorSyntax(GuestCtrl::tr("No executable specified!")); 1439 1297 1440 1298 /* … … 1714 1572 static DECLCALLBACK(RTEXITCODE) gctlHandleRun(PGCTLCMDCTX pCtx, int argc, char **argv) 1715 1573 { 1716 return gctlHandleRunCommon(pCtx, argc, argv, true /*fRunCmd*/ , HELP_SCOPE_GSTCTRL_RUN);1574 return gctlHandleRunCommon(pCtx, argc, argv, true /*fRunCmd*/); 1717 1575 } 1718 1576 … … 1720 1578 static DECLCALLBACK(RTEXITCODE) gctlHandleStart(PGCTLCMDCTX pCtx, int argc, char **argv) 1721 1579 { 1722 return gctlHandleRunCommon(pCtx, argc, argv, false /*fRunCmd*/ , HELP_SCOPE_GSTCTRL_START);1580 return gctlHandleRunCommon(pCtx, argc, argv, false /*fRunCmd*/); 1723 1581 } 1724 1582 … … 1751 1609 bool fFollow = false; 1752 1610 bool fRecursive = false; 1753 uint64_t uUsage = fHostToGuest ? HELP_SCOPE_GSTCTRL_COPYTO : HELP_SCOPE_GSTCTRL_COPYFROM;1754 1611 1755 1612 int vrc = VINF_SUCCESS; … … 1778 1635 1779 1636 default: 1780 return errorGetOpt Ex(USAGE_GUESTCONTROL, uUsage,ch, &ValueUnion);1637 return errorGetOpt(ch, &ValueUnion); 1781 1638 } 1782 1639 } … … 1786 1643 1787 1644 if (!cSources) 1788 return errorSyntax Ex(USAGE_GUESTCONTROL, uUsage,GuestCtrl::tr("No sources specified!"));1645 return errorSyntax(GuestCtrl::tr("No sources specified!")); 1789 1646 1790 1647 /* Unless a --target-directory is given, the last argument is the destination, so … … 1794 1651 1795 1652 if (pszDst == NULL) 1796 return errorSyntax Ex(USAGE_GUESTCONTROL, uUsage,GuestCtrl::tr("No destination specified!"));1653 return errorSyntax(GuestCtrl::tr("No destination specified!")); 1797 1654 1798 1655 char szAbsDst[RTPATH_MAX]; … … 2072 1929 2073 1930 default: 2074 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKDIR,ch, &ValueUnion);1931 return errorGetOpt(ch, &ValueUnion); 2075 1932 } 2076 1933 } 2077 1934 2078 1935 if (!cDirsCreated) 2079 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKDIR,GuestCtrl::tr("No directory to create specified!"));1936 return errorSyntax(GuestCtrl::tr("No directory to create specified!")); 2080 1937 return rcExit; 2081 1938 } … … 2200 2057 2201 2058 default: 2202 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RMDIR,ch, &ValueUnion);2059 return errorGetOpt(ch, &ValueUnion); 2203 2060 } 2204 2061 } 2205 2062 2206 2063 if (!cDirRemoved) 2207 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RMDIR,GuestCtrl::tr("No directory to remove specified!"));2064 return errorSyntax(GuestCtrl::tr("No directory to remove specified!")); 2208 2065 return rcExit; 2209 2066 } … … 2277 2134 2278 2135 default: 2279 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RM,ch, &ValueUnion);2136 return errorGetOpt(ch, &ValueUnion); 2280 2137 } 2281 2138 } 2282 2139 2283 2140 if (!cFilesDeleted && !fForce) 2284 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_RM,GuestCtrl::tr("No file to remove specified!"));2141 return errorSyntax(GuestCtrl::tr("No file to remove specified!")); 2285 2142 return rcExit; 2286 2143 } … … 2330 2187 2331 2188 default: 2332 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MV,ch, &ValueUnion);2189 return errorGetOpt(ch, &ValueUnion); 2333 2190 } 2334 2191 } … … 2344 2201 size_t cSources = vecSources.size(); 2345 2202 if (!cSources) 2346 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MV, 2347 GuestCtrl::tr("No source(s) to move specified!")); 2203 return errorSyntax(GuestCtrl::tr("No source(s) to move specified!")); 2348 2204 if (cSources < 2) 2349 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MV, 2350 GuestCtrl::tr("No destination specified!")); 2205 return errorSyntax(GuestCtrl::tr("No destination specified!")); 2351 2206 2352 2207 RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx); … … 2502 2357 strTemplate = ValueUnion.psz; 2503 2358 else 2504 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKTEMP, 2505 GuestCtrl::tr("More than one template specified!\n")); 2359 return errorSyntax(GuestCtrl::tr("More than one template specified!\n")); 2506 2360 break; 2507 2361 2508 2362 default: 2509 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKTEMP,ch, &ValueUnion);2363 return errorGetOpt(ch, &ValueUnion); 2510 2364 } 2511 2365 } 2512 2366 2513 2367 if (strTemplate.isEmpty()) 2514 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKTEMP, 2515 GuestCtrl::tr("No template specified!")); 2368 return errorSyntax(GuestCtrl::tr("No template specified!")); 2516 2369 2517 2370 if (!fDirectory) 2518 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_MKTEMP, 2519 GuestCtrl::tr("Creating temporary files is currently not supported!")); 2371 return errorSyntax(GuestCtrl::tr("Creating temporary files is currently not supported!")); 2520 2372 2521 2373 RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx); … … 2594 2446 case 'c': /* Format */ 2595 2447 case 't': /* Terse */ 2596 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_STAT, 2597 GuestCtrl::tr("Command \"%s\" not implemented yet!"), ValueUnion.psz); 2448 return errorSyntax(GuestCtrl::tr("Command \"%s\" not implemented yet!"), ValueUnion.psz); 2598 2449 2599 2450 default: 2600 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_STAT,ch, &ValueUnion);2451 return errorGetOpt(ch, &ValueUnion); 2601 2452 } 2602 2453 } 2603 2454 2604 2455 if (ch != VINF_GETOPT_NOT_OPTION) 2605 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_STAT,GuestCtrl::tr("Nothing to stat!"));2456 return errorSyntax(GuestCtrl::tr("Nothing to stat!")); 2606 2457 2607 2458 RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx); … … 2891 2742 2892 2743 default: 2893 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_UPDATEGA,ch, &ValueUnion);2744 return errorGetOpt(ch, &ValueUnion); 2894 2745 } 2895 2746 } … … 3156 3007 enmRunLevel = gctlGetRunLevelFromStr(ValueUnion.psz); 3157 3008 if (enmRunLevel == AdditionsRunLevelType_None) 3158 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_WAITRUNLEVEL, 3159 GuestCtrl::tr("Invalid run level specified. Valid values are: system, userland, desktop")); 3009 return errorSyntax(GuestCtrl::tr("Invalid run level specified. Valid values are: system, userland, desktop")); 3160 3010 break; 3161 3011 } 3162 3012 3163 3013 default: 3164 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_WAITRUNLEVEL,ch, &ValueUnion);3014 return errorGetOpt(ch, &ValueUnion); 3165 3015 } 3166 3016 } … … 3171 3021 3172 3022 if (enmRunLevel == AdditionsRunLevelType_None) 3173 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_WAITRUNLEVEL,GuestCtrl::tr("Missing run level to wait for"));3023 return errorSyntax(GuestCtrl::tr("Missing run level to wait for")); 3174 3024 3175 3025 vrc = gctlWaitForRunLevel(pCtx, enmRunLevel, cMsTimeout); … … 3218 3068 fListAll = true; 3219 3069 else 3220 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_LIST, 3221 GuestCtrl::tr("Unknown list: '%s'"), ValueUnion.psz); 3070 return errorSyntax(GuestCtrl::tr("Unknown list: '%s'"), ValueUnion.psz); 3222 3071 fSeenListArg = true; 3223 3072 break; 3224 3073 3225 3074 default: 3226 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_UPDATEGA,ch, &ValueUnion);3075 return errorGetOpt(ch, &ValueUnion); 3227 3076 } 3228 3077 } 3229 3078 3230 3079 if (!fSeenListArg) 3231 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_LIST,GuestCtrl::tr("Missing list name"));3080 return errorSyntax(GuestCtrl::tr("Missing list name")); 3232 3081 Assert(fListAll || fListSessions); 3233 3082 … … 3404 3253 } 3405 3254 else 3406 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS, 3407 GuestCtrl::tr("Invalid PID value: 0")); 3255 return errorSyntax(GuestCtrl::tr("Invalid PID value: 0")); 3408 3256 } 3409 3257 else 3410 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS, 3411 GuestCtrl::tr("Error parsing PID value: %Rrc"), rc); 3258 return errorSyntax(GuestCtrl::tr("Error parsing PID value: %Rrc"), rc); 3412 3259 break; 3413 3260 } 3414 3261 3415 3262 default: 3416 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS,ch, &ValueUnion);3263 return errorGetOpt(ch, &ValueUnion); 3417 3264 } 3418 3265 } 3419 3266 3420 3267 if (vecPID.empty()) 3421 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS, 3422 GuestCtrl::tr("At least one PID must be specified to kill!")); 3268 return errorSyntax(GuestCtrl::tr("At least one PID must be specified to kill!")); 3423 3269 3424 3270 if ( strSessionName.isEmpty() 3425 3271 && idSession == UINT32_MAX) 3426 return errorSyntax Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS,GuestCtrl::tr("No session ID specified!"));3272 return errorSyntax(GuestCtrl::tr("No session ID specified!")); 3427 3273 3428 3274 if ( strSessionName.isNotEmpty() 3429 3275 && idSession != UINT32_MAX) 3430 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSEPROCESS, 3431 GuestCtrl::tr("Either session ID or name (pattern) must be specified")); 3276 return errorSyntax(GuestCtrl::tr("Either session ID or name (pattern) must be specified")); 3432 3277 3433 3278 RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx); … … 3573 3418 * break; */ 3574 3419 default: 3575 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSESESSION,ch, &ValueUnion);3420 return errorGetOpt(ch, &ValueUnion); 3576 3421 } 3577 3422 } … … 3579 3424 if ( strSessionName.isEmpty() 3580 3425 && idSession == UINT32_MAX) 3581 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSESESSION, 3582 GuestCtrl::tr("No session ID specified!")); 3426 return errorSyntax(GuestCtrl::tr("No session ID specified!")); 3583 3427 3584 3428 if ( !strSessionName.isEmpty() 3585 3429 && idSession != UINT32_MAX) 3586 return errorSyntaxEx(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_CLOSESESSION, 3587 GuestCtrl::tr("Either session ID or name (pattern) must be specified")); 3430 return errorSyntax(GuestCtrl::tr("Either session ID or name (pattern) must be specified")); 3588 3431 3589 3432 RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx); … … 3678 3521 case VINF_GETOPT_NOT_OPTION: 3679 3522 default: 3680 return errorGetOpt Ex(USAGE_GUESTCONTROL, HELP_SCOPE_GSTCTRL_WATCH,ch, &ValueUnion);3523 return errorGetOpt(ch, &ValueUnion); 3681 3524 } 3682 3525 } … … 3773 3616 static const GCTLCMDDEF s_aCmdDefs[] = 3774 3617 { 3775 { "run", gctlHandleRun, HELP_SCOPE_G STCTRL_RUN, 0 },3776 { "start", gctlHandleStart, HELP_SCOPE_G STCTRL_START, 0 },3777 { "copyfrom", gctlHandleCopyFrom, HELP_SCOPE_G STCTRL_COPYFROM, 0 },3778 { "copyto", gctlHandleCopyTo, HELP_SCOPE_G STCTRL_COPYTO, 0 },3779 3780 { "mkdir", gctrlHandleMkDir, HELP_SCOPE_G STCTRL_MKDIR, 0 },3781 { "md", gctrlHandleMkDir, HELP_SCOPE_G STCTRL_MKDIR, 0 },3782 { "createdirectory", gctrlHandleMkDir, HELP_SCOPE_G STCTRL_MKDIR, 0 },3783 { "createdir", gctrlHandleMkDir, HELP_SCOPE_G STCTRL_MKDIR, 0 },3784 3785 { "rmdir", gctlHandleRmDir, HELP_SCOPE_G STCTRL_RMDIR, 0 },3786 { "removedir", gctlHandleRmDir, HELP_SCOPE_G STCTRL_RMDIR, 0 },3787 { "removedirectory", gctlHandleRmDir, HELP_SCOPE_G STCTRL_RMDIR, 0 },3788 3789 { "rm", gctlHandleRm, HELP_SCOPE_G STCTRL_RM, 0 },3790 { "removefile", gctlHandleRm, HELP_SCOPE_G STCTRL_RM, 0 },3791 { "erase", gctlHandleRm, HELP_SCOPE_G STCTRL_RM, 0 },3792 { "del", gctlHandleRm, HELP_SCOPE_G STCTRL_RM, 0 },3793 { "delete", gctlHandleRm, HELP_SCOPE_G STCTRL_RM, 0 },3794 3795 { "mv", gctlHandleMv, HELP_SCOPE_G STCTRL_MV, 0 },3796 { "move", gctlHandleMv, HELP_SCOPE_G STCTRL_MV, 0 },3797 { "ren", gctlHandleMv, HELP_SCOPE_G STCTRL_MV, 0 },3798 { "rename", gctlHandleMv, HELP_SCOPE_G STCTRL_MV, 0 },3799 3800 { "mktemp", gctlHandleMkTemp, HELP_SCOPE_G STCTRL_MKTEMP, 0 },3801 { "createtemp", gctlHandleMkTemp, HELP_SCOPE_G STCTRL_MKTEMP, 0 },3802 { "createtemporary", gctlHandleMkTemp, HELP_SCOPE_G STCTRL_MKTEMP, 0 },3803 3804 { "stat", gctlHandleStat, HELP_SCOPE_G STCTRL_STAT, 0 },3805 3806 { "closeprocess", gctlHandleCloseProcess, HELP_SCOPE_G STCTRL_CLOSEPROCESS, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER },3807 { "closesession", gctlHandleCloseSession, HELP_SCOPE_G STCTRL_CLOSESESSION, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER },3808 { "list", gctlHandleList, HELP_SCOPE_G STCTRL_LIST, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER },3809 { "watch", gctlHandleWatch, HELP_SCOPE_G STCTRL_WATCH, GCTLCMDCTX_F_SESSION_ANONYMOUS },3810 3811 {"updateguestadditions",gctlHandleUpdateAdditions, HELP_SCOPE_G STCTRL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS },3812 { "updateadditions", gctlHandleUpdateAdditions, HELP_SCOPE_G STCTRL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS },3813 { "updatega", gctlHandleUpdateAdditions, HELP_SCOPE_G STCTRL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS },3814 3815 { "waitrunlevel", gctlHandleWaitRunLevel, HELP_SCOPE_G STCTRL_WAITRUNLEVEL, GCTLCMDCTX_F_SESSION_ANONYMOUS },3816 { "waitforrunlevel", gctlHandleWaitRunLevel, HELP_SCOPE_G STCTRL_WAITRUNLEVEL, GCTLCMDCTX_F_SESSION_ANONYMOUS },3618 { "run", gctlHandleRun, HELP_SCOPE_GUESTCONTROL_RUN, 0 }, 3619 { "start", gctlHandleStart, HELP_SCOPE_GUESTCONTROL_START, 0 }, 3620 { "copyfrom", gctlHandleCopyFrom, HELP_SCOPE_GUESTCONTROL_COPYFROM_HOSTDEST, 0 }, 3621 { "copyto", gctlHandleCopyTo, HELP_SCOPE_GUESTCONTROL_COPYTO_HOSTDEST, 0 }, 3622 3623 { "mkdir", gctrlHandleMkDir, HELP_SCOPE_GUESTCONTROL_MKDIR, 0 }, 3624 { "md", gctrlHandleMkDir, HELP_SCOPE_GUESTCONTROL_MKDIR, 0 }, 3625 { "createdirectory", gctrlHandleMkDir, HELP_SCOPE_GUESTCONTROL_MKDIR, 0 }, 3626 { "createdir", gctrlHandleMkDir, HELP_SCOPE_GUESTCONTROL_MKDIR, 0 }, 3627 3628 { "rmdir", gctlHandleRmDir, HELP_SCOPE_GUESTCONTROL_RMDIR, 0 }, 3629 { "removedir", gctlHandleRmDir, HELP_SCOPE_GUESTCONTROL_RMDIR, 0 }, 3630 { "removedirectory", gctlHandleRmDir, HELP_SCOPE_GUESTCONTROL_RMDIR, 0 }, 3631 3632 { "rm", gctlHandleRm, HELP_SCOPE_GUESTCONTROL_RM, 0 }, 3633 { "removefile", gctlHandleRm, HELP_SCOPE_GUESTCONTROL_RM, 0 }, 3634 { "erase", gctlHandleRm, HELP_SCOPE_GUESTCONTROL_RM, 0 }, 3635 { "del", gctlHandleRm, HELP_SCOPE_GUESTCONTROL_RM, 0 }, 3636 { "delete", gctlHandleRm, HELP_SCOPE_GUESTCONTROL_RM, 0 }, 3637 3638 { "mv", gctlHandleMv, HELP_SCOPE_GUESTCONTROL_MV, 0 }, 3639 { "move", gctlHandleMv, HELP_SCOPE_GUESTCONTROL_MV, 0 }, 3640 { "ren", gctlHandleMv, HELP_SCOPE_GUESTCONTROL_MV, 0 }, 3641 { "rename", gctlHandleMv, HELP_SCOPE_GUESTCONTROL_MV, 0 }, 3642 3643 { "mktemp", gctlHandleMkTemp, HELP_SCOPE_GUESTCONTROL_MKTEMP, 0 }, 3644 { "createtemp", gctlHandleMkTemp, HELP_SCOPE_GUESTCONTROL_MKTEMP, 0 }, 3645 { "createtemporary", gctlHandleMkTemp, HELP_SCOPE_GUESTCONTROL_MKTEMP, 0 }, 3646 3647 { "stat", gctlHandleStat, HELP_SCOPE_GUESTCONTROL_STAT, 0 }, 3648 3649 { "closeprocess", gctlHandleCloseProcess, HELP_SCOPE_GUESTCONTROL_CLOSEPROCESS, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER }, 3650 { "closesession", gctlHandleCloseSession, HELP_SCOPE_GUESTCONTROL_CLOSESESSION, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER }, 3651 { "list", gctlHandleList, HELP_SCOPE_GUESTCONTROL_LIST, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER }, 3652 { "watch", gctlHandleWatch, HELP_SCOPE_GUESTCONTROL_WATCH, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3653 3654 {"updateguestadditions",gctlHandleUpdateAdditions, HELP_SCOPE_GUESTCONTROL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3655 { "updateadditions", gctlHandleUpdateAdditions, HELP_SCOPE_GUESTCONTROL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3656 { "updatega", gctlHandleUpdateAdditions, HELP_SCOPE_GUESTCONTROL_UPDATEGA, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3657 3658 { "waitrunlevel", gctlHandleWaitRunLevel, HELP_SCOPE_GUESTCONTROL_WAITRUNLEVEL, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3659 { "waitforrunlevel", gctlHandleWaitRunLevel, HELP_SCOPE_GUESTCONTROL_WAITRUNLEVEL, GCTLCMDCTX_F_SESSION_ANONYMOUS }, 3817 3660 }; 3818 3661 … … 3861 3704 CmdCtx.pCmdDef = &s_aCmdDefs[iCmd]; 3862 3705 3706 setCurrentSubcommand(s_aCmdDefs[iCmd].fSubcommandScope); 3863 3707 rcExit = s_aCmdDefs[iCmd].pfnHandler(&CmdCtx, pArg->argc - GetState.iNext + 1, 3864 3708 &pArg->argv[GetState.iNext - 1]); … … 3867 3711 return rcExit; 3868 3712 } 3869 return errorSyntax( USAGE_GUESTCONTROL,GuestCtrl::tr("Unknown sub-command: '%s'"), pszCmd);3713 return errorSyntax(GuestCtrl::tr("Unknown sub-command: '%s'"), pszCmd); 3870 3714 } 3871 3715 break; 3872 3716 3873 3717 default: 3874 return errorGetOpt( USAGE_GUESTCONTROL,ch, &ValueUnion);3718 return errorGetOpt(ch, &ValueUnion); 3875 3719 } 3876 3720 } 3877 3721 if (CmdCtx.pszVmNameOrUuid) 3878 rcExit = errorSyntax( USAGE_GUESTCONTROL,GuestCtrl::tr("Missing sub-command"));3722 rcExit = errorSyntax(GuestCtrl::tr("Missing sub-command")); 3879 3723 else 3880 rcExit = errorSyntax( USAGE_GUESTCONTROL,GuestCtrl::tr("Missing VM name and sub-command"));3724 rcExit = errorSyntax(GuestCtrl::tr("Missing VM name and sub-command")); 3881 3725 } 3882 3726 return rcExit; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r94208 r94209 639 639 "\n", SEP); 640 640 641 #ifdef VBOX_WITH_GUEST_CONTROL642 if (enmCommand == USAGE_GUESTCONTROL || enmCommand == USAGE_S_ALL)643 usageGuestControl(pStrm, SEP, fSubcommandScope);644 #endif /* VBOX_WITH_GUEST_CONTROL defined */645 646 641 if (enmCommand == USAGE_METRICS || enmCommand == USAGE_S_ALL) 647 642 RTStrmPrintf(pStrm,
Note:
See TracChangeset
for help on using the changeset viewer.