diff options
| author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-03-15 10:10:24 +0000 |
|---|---|---|
| committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-03-15 10:10:24 +0000 |
| commit | a7d250d6012f6c4ac87eb93ca3b4919d02042f87 (patch) | |
| tree | 4a4628079c4801470ccd448e6447613d9ebbe8cb /src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp | |
| parent | 66871618d8f3aa182769daaf8a73e8e1d091b73e (diff) | |
| download | VirtualBox-svn-a7d250d6012f6c4ac87eb93ca3b4919d02042f87.tar.gz | |
FE/VBoxManage: Move stuff to VBoxInternalManage.cpp because it is only used there now, ​bugref:9186
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@94240 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp')
| -rw-r--r-- | src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp index f167c8c2599..e428649294b 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp @@ -560,128 +560,3 @@ void printUsage(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, PRTSTREAM p } } } - -/** - * Print a usage synopsis and the syntax error message. - * @returns RTEXITCODE_SYNTAX. - */ -RTEXITCODE errorSyntax(USAGECATEGORY enmCommand, const char *pszFormat, ...) -{ - va_list args; - showLogo(g_pStdErr); // show logo even if suppressed - - if (g_fInternalMode) - printUsageInternal(enmCommand, g_pStdErr); - else if (g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID) - printUsage(enmCommand, RTMSGREFENTRYSTR_SCOPE_GLOBAL, g_pStdErr); - else - printUsage(g_pStdErr); - - va_start(args, pszFormat); - RTStrmPrintf(g_pStdErr, Help::tr("\nSyntax error: %N\n"), pszFormat, &args); - va_end(args); - return RTEXITCODE_SYNTAX; -} - -/** - * Print a usage synopsis and the syntax error message. - * @returns RTEXITCODE_SYNTAX. - */ -RTEXITCODE errorSyntaxEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, const char *pszFormat, ...) -{ - va_list args; - showLogo(g_pStdErr); // show logo even if suppressed - - if (g_fInternalMode) - printUsageInternal(enmCommand, g_pStdErr); - else if (g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID) - printUsage(enmCommand, fSubcommandScope, g_pStdErr); - else - printUsage(g_pStdErr); - - va_start(args, pszFormat); - RTStrmPrintf(g_pStdErr, Help::tr("\nSyntax error: %N\n"), pszFormat, &args); - va_end(args); - return RTEXITCODE_SYNTAX; -} - -/** - * errorSyntax for RTGetOpt users. - * - * @returns RTEXITCODE_SYNTAX. - * - * @param enmCommand The command. - * @param fSubcommandScope The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL - * for all. - * @param rc The RTGetOpt return code. - * @param pValueUnion The value union. - */ -RTEXITCODE errorGetOptEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, int rc, union RTGETOPTUNION const *pValueUnion) -{ - /* - * Check if it is an unhandled standard option. - */ - if (rc == 'V') - { - RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision()); - return RTEXITCODE_SUCCESS; - } - - if (rc == 'h') - { - showLogo(g_pStdErr); - - if (g_fInternalMode) - printUsageInternal(enmCommand, g_pStdOut); - else if (g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID) - printUsage(enmCommand, fSubcommandScope, g_pStdOut); - else - printUsage(g_pStdErr); - - return RTEXITCODE_SUCCESS; - } - - /* - * General failure. - */ - showLogo(g_pStdErr); // show logo even if suppressed - - if (g_fInternalMode) - printUsageInternal(enmCommand, g_pStdErr); - else if (g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID) - printUsage(enmCommand, fSubcommandScope, g_pStdErr); - else - printUsage(g_pStdErr); - - if (rc == VINF_GETOPT_NOT_OPTION) - return RTMsgErrorExit(RTEXITCODE_SYNTAX, Help::tr("Invalid parameter '%s'"), pValueUnion->psz); - if (rc > 0) - { - if (RT_C_IS_PRINT(rc)) - return RTMsgErrorExit(RTEXITCODE_SYNTAX, Help::tr("Invalid option -%c"), rc); - return RTMsgErrorExit(RTEXITCODE_SYNTAX, Help::tr("Invalid option case %i"), rc); - } - if (rc == VERR_GETOPT_UNKNOWN_OPTION) - return RTMsgErrorExit(RTEXITCODE_SYNTAX, Help::tr("Unknown option: %s"), pValueUnion->psz); - if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT) - return RTMsgErrorExit(RTEXITCODE_SYNTAX, Help::tr("Invalid argument format: %s"), pValueUnion->psz); - if (pValueUnion->pDef) - return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc); - return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc); -} - - -/** - * errorSyntax for RTGetOpt users. - * - * @returns RTEXITCODE_SYNTAX. - * - * @param enmCommand The command. - * @param rc The RTGetOpt return code. - * @param pValueUnion The value union. - */ -RTEXITCODE errorGetOpt(USAGECATEGORY enmCommand, int rc, union RTGETOPTUNION const *pValueUnion) -{ - return errorGetOptEx(enmCommand, RTMSGREFENTRYSTR_SCOPE_GLOBAL, rc, pValueUnion); -} - |
