VirtualBox

Changeset 32701 in vbox


Ignore:
Timestamp:
Sep 22, 2010 5:12:01 PM (14 years ago)
Author:
vboxsync
Message:

Frontends/VBoxManage: Error printing cleanup, use stderr and consistent formatting. Small cleanups (like using Keyboard::PutScancodes instead of the more clumsy Keyboard::PutScancode and fixing the incorrect comment which attracted my attention).

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r32536 r32701  
    132132void printUsageInternal(USAGECATEGORY u64Cmd)
    133133{
    134     RTPrintf("Usage: VBoxManage internalcommands <command> [command arguments]\n"
    135              "\n"
    136              "Commands:\n"
    137              "\n"
    138              "%s%s%s%s%s%s%s%s%s%s%s%s"
    139              "WARNING: This is a development tool and shall only be used to analyse\n"
    140              "         problems. It is completely unsupported and will change in\n"
    141              "         incompatible ways without warning.\n",
    142 
    143              (u64Cmd & USAGE_LOADSYMS)
    144              ? "  loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]\n"
    145                "      This will instruct DBGF to load the given symbolfile\n"
    146                "      during initialization.\n"
    147                "\n"
    148              : "",
    149              (u64Cmd & USAGE_UNLOADSYMS)
    150              ? "  unloadsyms <vmname>|<uuid> <symfile>\n"
    151                "      Removes <symfile> from the list of symbol files that\n"
    152                "      should be loaded during DBF initialization.\n"
    153                "\n"
    154              : "",
    155              (u64Cmd & USAGE_SETHDUUID)
    156              ? "  sethduuid <filepath> [<uuid>]\n"
    157                "       Assigns a new UUID to the given image file. This way, multiple copies\n"
    158                "       of a container can be registered.\n"
    159                "\n"
    160              : "",
    161              (u64Cmd & USAGE_SETHDPARENTUUID)
    162              ? "  sethdparentuuid <filepath> <uuid>\n"
    163              "       Assigns a new parent UUID to the given image file.\n"
    164              "\n"
    165              : "",
    166              (u64Cmd & USAGE_DUMPHDINFO)
    167              ?  "  dumphdinfo <filepath>\n"
    168                 "       Prints information about the image at the given location.\n"
    169                 "\n"
    170              : "",
    171              (u64Cmd & USAGE_LISTPARTITIONS)
    172              ? "  listpartitions -rawdisk <diskname>\n"
    173                "       Lists all partitions on <diskname>.\n"
    174                "\n"
    175              : "",
    176              (u64Cmd & USAGE_CREATERAWVMDK)
    177              ? "  createrawvmdk -filename <filename> -rawdisk <diskname>\n"
    178                "                [-partitions <list of partition numbers> [-mbr <filename>] ]\n"
    179                "                [-register] [-relative]\n"
    180                "       Creates a new VMDK image which gives access to an entite host disk (if\n"
    181                "       the parameter -partitions is not specified) or some partitions of a\n"
    182                "       host disk. If access to individual partitions is granted, then the\n"
    183                "       parameter -mbr can be used to specify an alternative MBR to be used\n"
    184                "       (the partitioning information in the MBR file is ignored).\n"
    185                "       The diskname is on Linux e.g. /dev/sda, and on Windows e.g.\n"
    186                "       \\\\.\\PhysicalDrive0).\n"
    187                "       On Linux host the parameter -relative causes a VMDK file to be created\n"
    188                "       which refers to individual partitions instead to the entire disk.\n"
    189                "       Optionally the created image can be immediately registered.\n"
    190                "       The necessary partition numbers can be queried with\n"
    191                "         VBoxManage internalcommands listpartitions\n"
    192                "\n"
    193              : "",
    194              (u64Cmd & USAGE_RENAMEVMDK)
    195              ? "  renamevmdk -from <filename> -to <filename>\n"
    196                "       Renames an existing VMDK image, including the base file and all its extents.\n"
    197                "\n"
    198              : "",
    199              (u64Cmd & USAGE_CONVERTTORAW)
    200              ? "  converttoraw [-format <fileformat>] <filename> <outputfile>"
     134    RTStrmPrintf(g_pStdErr,
     135        "Usage: VBoxManage internalcommands <command> [command arguments]\n"
     136        "\n"
     137        "Commands:\n"
     138        "\n"
     139        "%s%s%s%s%s%s%s%s%s%s%s%s"
     140        "WARNING: This is a development tool and shall only be used to analyse\n"
     141        "         problems. It is completely unsupported and will change in\n"
     142        "         incompatible ways without warning.\n",
     143
     144        (u64Cmd & USAGE_LOADSYMS)
     145        ? "  loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]\n"
     146          "      This will instruct DBGF to load the given symbolfile\n"
     147          "      during initialization.\n"
     148          "\n"
     149        : "",
     150        (u64Cmd & USAGE_UNLOADSYMS)
     151        ? "  unloadsyms <vmname>|<uuid> <symfile>\n"
     152          "      Removes <symfile> from the list of symbol files that\n"
     153          "      should be loaded during DBF initialization.\n"
     154          "\n"
     155        : "",
     156        (u64Cmd & USAGE_SETHDUUID)
     157        ? "  sethduuid <filepath> [<uuid>]\n"
     158          "       Assigns a new UUID to the given image file. This way, multiple copies\n"
     159          "       of a container can be registered.\n"
     160          "\n"
     161        : "",
     162        (u64Cmd & USAGE_SETHDPARENTUUID)
     163        ? "  sethdparentuuid <filepath> <uuid>\n"
     164          "       Assigns a new parent UUID to the given image file.\n"
     165          "\n"
     166        : "",
     167        (u64Cmd & USAGE_DUMPHDINFO)
     168        ?  "  dumphdinfo <filepath>\n"
     169           "       Prints information about the image at the given location.\n"
     170           "\n"
     171        : "",
     172        (u64Cmd & USAGE_LISTPARTITIONS)
     173        ? "  listpartitions -rawdisk <diskname>\n"
     174          "       Lists all partitions on <diskname>.\n"
     175          "\n"
     176        : "",
     177        (u64Cmd & USAGE_CREATERAWVMDK)
     178        ? "  createrawvmdk -filename <filename> -rawdisk <diskname>\n"
     179          "                [-partitions <list of partition numbers> [-mbr <filename>] ]\n"
     180          "                [-register] [-relative]\n"
     181          "       Creates a new VMDK image which gives access to an entite host disk (if\n"
     182          "       the parameter -partitions is not specified) or some partitions of a\n"
     183          "       host disk. If access to individual partitions is granted, then the\n"
     184          "       parameter -mbr can be used to specify an alternative MBR to be used\n"
     185          "       (the partitioning information in the MBR file is ignored).\n"
     186          "       The diskname is on Linux e.g. /dev/sda, and on Windows e.g.\n"
     187          "       \\\\.\\PhysicalDrive0).\n"
     188          "       On Linux host the parameter -relative causes a VMDK file to be created\n"
     189          "       which refers to individual partitions instead to the entire disk.\n"
     190          "       Optionally the created image can be immediately registered.\n"
     191          "       The necessary partition numbers can be queried with\n"
     192          "         VBoxManage internalcommands listpartitions\n"
     193          "\n"
     194        : "",
     195        (u64Cmd & USAGE_RENAMEVMDK)
     196        ? "  renamevmdk -from <filename> -to <filename>\n"
     197          "       Renames an existing VMDK image, including the base file and all its extents.\n"
     198          "\n"
     199        : "",
     200        (u64Cmd & USAGE_CONVERTTORAW)
     201        ? "  converttoraw [-format <fileformat>] <filename> <outputfile>"
    201202#ifdef ENABLE_CONVERT_RAW_TO_STDOUT
    202                "|stdout"
     203          "|stdout"
    203204#endif /* ENABLE_CONVERT_RAW_TO_STDOUT */
    204                "\n"
    205                "       Convert image to raw, writing to file"
     205          "\n"
     206          "       Convert image to raw, writing to file"
    206207#ifdef ENABLE_CONVERT_RAW_TO_STDOUT
    207                " or stdout"
     208          " or stdout"
    208209#endif /* ENABLE_CONVERT_RAW_TO_STDOUT */
    209                ".\n"
    210                "\n"
    211              : "",
    212              (u64Cmd & USAGE_CONVERTHD)
    213              ? "  converthd [-srcformat VDI|VMDK|VHD|RAW]\n"
    214                "            [-dstformat VDI|VMDK|VHD|RAW]\n"
    215                "            <inputfile> <outputfile>\n"
    216                "       converts hard disk images between formats\n"
    217                "\n"
    218              : "",
     210          ".\n"
     211          "\n"
     212        : "",
     213        (u64Cmd & USAGE_CONVERTHD)
     214        ? "  converthd [-srcformat VDI|VMDK|VHD|RAW]\n"
     215          "            [-dstformat VDI|VMDK|VHD|RAW]\n"
     216          "            <inputfile> <outputfile>\n"
     217          "       converts hard disk images between formats\n"
     218          "\n"
     219        : "",
    219220#ifdef RT_OS_WINDOWS
    220              (u64Cmd & USAGE_MODINSTALL)
    221              ? "  modinstall\n"
    222                "       Installs the neccessary driver for the host OS\n"
    223                "\n"
    224              : "",
    225              (u64Cmd & USAGE_MODUNINSTALL)
    226              ? "  moduninstall\n"
    227                "       Deinstalls the driver\n"
    228                "\n"
    229              : "",
     221        (u64Cmd & USAGE_MODINSTALL)
     222        ? "  modinstall\n"
     223          "       Installs the neccessary driver for the host OS\n"
     224          "\n"
     225        : "",
     226        (u64Cmd & USAGE_MODUNINSTALL)
     227        ? "  moduninstall\n"
     228          "       Deinstalls the driver\n"
     229          "\n"
     230        : "",
    230231#else
    231              "",
    232              "",
     232        "",
     233        "",
    233234#endif
    234              (u64Cmd & USAGE_DEBUGLOG)
    235              ? "  debuglog <vmname>|<uuid> [--enable|--disable] [--flags todo]\n"
    236                "           [--groups todo] [--destinations todo]\n"
    237                "       Controls debug logging.\n"
    238                "\n"
    239              : ""
    240              );
     235        (u64Cmd & USAGE_DEBUGLOG)
     236        ? "  debuglog <vmname>|<uuid> [--enable|--disable] [--flags todo]\n"
     237          "           [--groups todo] [--destinations todo]\n"
     238          "       Controls debug logging.\n"
     239          "\n"
     240        : ""
     241        );
    241242}
    242243
     
    292293        }
    293294    }
    294     RTPrintf("Error: Cannot find unique key for '%s'!\n", pszKeyBase);
     295    RTMsgError("Cannot find unique key for '%s'!", pszKeyBase);
    295296    return E_FAIL;
    296297}
     
    355356    }
    356357    else
    357         RTPrintf("error: failed to delete key '%s' from '%s',  string conversion error %Rrc!\n",
    358                  pszKey,  pszKeyBase, rc);
     358        RTMsgError("Failed to delete key '%s' from '%s',  string conversion error %Rrc!",
     359                   pszKey,  pszKeyBase, rc);
    359360
    360361    return E_FAIL;
     
    377378    HRESULT hrc = pMachine->SetExtraData(Bstr(Utf8StrFmt("%s/%s/%s", pszKeyBase, pszKey, pszAttribute)), Bstr(pszValue));
    378379    if (FAILED(hrc))
    379         RTPrintf("error: Failed to set '%s/%s/%s' to '%s'! hrc=%#x\n",
    380                  pszKeyBase, pszKey, pszAttribute, pszValue, hrc);
     380        RTMsgError("Failed to set '%s/%s/%s' to '%s'! hrc=%#x",
     381                   pszKeyBase, pszKey, pszAttribute, pszValue, hrc);
    381382    return hrc;
    382383}
     
    502503static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
    503504{
    504     RTPrintf("ERROR: ");
    505     RTPrintfV(pszFormat, va);
    506     RTPrintf("\n");
    507     RTPrintf("Error code %Rrc at %s(%u) in function %s\n", rc, RT_SRC_POS_ARGS);
     505    RTMsgErrorV(pszFormat, va);
     506    RTMsgError("Error code %Rrc at %s(%u) in function %s", rc, RT_SRC_POS_ARGS);
    508507}
    509508
     
    555554    if (RT_FAILURE(rc))
    556555    {
    557         RTPrintf("Format autodetect failed: %Rrc\n", rc);
     556        RTMsgError("Format autodetect failed: %Rrc", rc);
    558557        return 1;
    559558    }
     
    576575    if (RT_FAILURE(rc))
    577576    {
    578         RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc);
     577        RTMsgError("Cannot create the virtual disk container: %Rrc", rc);
    579578        return 1;
    580579    }
     
    584583    if (RT_FAILURE(rc))
    585584    {
    586         RTPrintf("Error while opening the image: %Rrc\n", rc);
     585        RTMsgError("Cannot open the image: %Rrc", rc);
    587586        return 1;
    588587    }
     
    593592      rc = VDSetParentUuid(pDisk, VD_LAST_IMAGE, uuid.raw());
    594593    if (RT_FAILURE(rc))
    595         RTPrintf("Error while setting a new UUID: %Rrc\n", rc);
     594        RTMsgError("Cannot set a new UUID: %Rrc", rc);
    596595    else
    597596        RTPrintf("UUID changed to: %s\n", uuid.toString().c_str());
     
    617616    if (RT_FAILURE(rc))
    618617    {
    619         RTPrintf("Format autodetect failed: %Rrc\n", rc);
     618        RTMsgError("Format autodetect failed: %Rrc", rc);
    620619        return 1;
    621620    }
     
    638637    if (RT_FAILURE(rc))
    639638    {
    640         RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc);
     639        RTMsgError("Cannot create the virtual disk container: %Rrc", rc);
    641640        return 1;
    642641    }
     
    646645    if (RT_FAILURE(rc))
    647646    {
    648         RTPrintf("Error while opening the image: %Rrc\n", rc);
     647        RTMsgError("Cannot open the image: %Rrc", rc);
    649648        return 1;
    650649    }
     
    697696            else
    698697            {
    699                 RTPrintf("More than one extended partition. Aborting\n");
     698                RTMsgError("More than one extended partition");
    700699                return VERR_INVALID_PARAMETER;
    701700            }
     
    710709        if (!uStart)
    711710        {
    712             RTPrintf("Inconsistency for logical partition start. Aborting\n");
     711            RTMsgError("Inconsistency for logical partition start");
    713712            return VERR_INVALID_PARAMETER;
    714713        }
     
    722721            if (aBuffer[510] != 0x55 || aBuffer[511] != 0xaa)
    723722            {
    724                 RTPrintf("Logical partition without magic. Aborting\n");
     723                RTMsgError("Logical partition without magic");
    725724                return VERR_INVALID_PARAMETER;
    726725            }
     
    729728            if (p[4] == 0)
    730729            {
    731                 RTPrintf("Logical partition with type 0 encountered. Aborting\n");
     730                RTMsgError("Logical partition with type 0 encountered");
    732731                return VERR_INVALID_PARAMETER;
    733732            }
     
    745744            if (!uStartOffset)
    746745            {
    747                 RTPrintf("Invalid partition start offset. Aborting\n");
     746                RTMsgError("Invalid partition start offset");
    748747                return VERR_INVALID_PARAMETER;
    749748            }
     
    763762            else
    764763            {
    765                 RTPrintf("Logical partition chain broken. Aborting\n");
     764                RTMsgError("Logical partition chain broken");
    766765                return VERR_INVALID_PARAMETER;
    767766            }
     
    784783            else if (pPart->aPartitions[j].uStart == uMinVal)
    785784            {
    786                 RTPrintf("Two partitions start at the same place. Aborting\n");
     785                RTMsgError("Two partitions start at the same place");
    787786                return VERR_INVALID_PARAMETER;
    788787            }
    789788            else if (pPart->aPartitions[j].uStart == 0)
    790789            {
    791                 RTPrintf("Partition starts at sector 0. Aborting\n");
     790                RTMsgError("Partition starts at sector 0");
    792791                return VERR_INVALID_PARAMETER;
    793792            }
     
    818817        if (pPart->aPartitions[i].uStart < uPrevEnd)
    819818        {
    820             RTPrintf("Overlapping partitions. Aborting\n");
     819            RTMsgError("Overlapping partitions");
    821820            return VERR_INVALID_PARAMETER;
    822821        }
     
    857856    if (RT_FAILURE(vrc))
    858857    {
    859         RTPrintf("Error opening the raw disk: %Rrc\n", vrc);
     858        RTMsgError("Cannnot open the raw disk: %Rrc", vrc);
    860859        return vrc;
    861860    }
     
    987986    if (RT_FAILURE(vrc))
    988987    {
    989         RTPrintf("Error opening the raw disk '%s': %Rrc\n", rawdisk.c_str(), vrc);
     988        RTMsgError("Cannot open the raw disk '%s': %Rrc", rawdisk.c_str(), vrc);
    990989        goto out;
    991990    }
     
    10161015        else
    10171016        {
    1018             RTPrintf("File '%s' is no fixed/removable medium device\n", rawdisk.c_str());
     1017            RTMsgError("File '%s' is no fixed/removable medium device", rawdisk.c_str());
    10191018            vrc = VERR_INVALID_PARAMETER;
    10201019            goto out;
     
    10341033    {
    10351034        vrc = RTErrConvertFromWin32(GetLastError());
    1036         RTPrintf("Error getting the geometry of the raw disk '%s': %Rrc\n", rawdisk.c_str(), vrc);
     1035        RTMsgError("Cannot get the geometry of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc);
    10371036        goto out;
    10381037    }
     
    10621061            {
    10631062                vrc = RTErrConvertFromErrno(errno);
    1064                 RTPrintf("Error getting the size of the raw disk '%s': %Rrc\n", rawdisk.c_str(), vrc);
     1063                RTMsgError("Cannot get the size of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc);
    10651064                goto out;
    10661065            }
     
    10691068    else
    10701069    {
    1071         RTPrintf("File '%s' is no block device\n", rawdisk.c_str());
     1070        RTMsgError("File '%s' is no block device", rawdisk.c_str());
    10721071        vrc = VERR_INVALID_PARAMETER;
    10731072        goto out;
     
    10851084            else
    10861085            {
    1087                 RTPrintf("Cannot get the block size for file '%s': %Rrc", rawdisk.c_str(), vrc);
     1086                RTMsgError("Cannot get the block size for file '%s': %Rrc", rawdisk.c_str(), vrc);
    10881087                vrc = RTErrConvertFromErrno(errno);
    10891088                goto out;
     
    10931092        {
    10941093            vrc = RTErrConvertFromErrno(errno);
    1095             RTPrintf("Cannot get the block count for file '%s': %Rrc", rawdisk.c_str(), vrc);
     1094            RTMsgError("Cannot get the block count for file '%s': %Rrc", rawdisk.c_str(), vrc);
    10961095            goto out;
    10971096        }
     
    10991098    else
    11001099    {
    1101         RTPrintf("File '%s' is no block device\n", rawdisk.c_str());
     1100        RTMsgError("File '%s' is no block device", rawdisk.c_str());
    11021101        vrc = VERR_INVALID_PARAMETER;
    11031102        goto out;
     
    11141113        {
    11151114            vrc = RTErrConvertFromErrno(errno);
    1116             RTPrintf("Error getting the size of the raw disk '%s': %Rrc\n", rawdisk.c_str(), vrc);
     1115            RTMsgError("Cannot get the size of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc);
    11171116            goto out;
    11181117        }
     
    11201119    else
    11211120    {
    1122         RTPrintf("File '%s' is no block or char device\n", rawdisk.c_str());
     1121        RTMsgError("File '%s' is no block or char device", rawdisk.c_str());
    11231122        vrc = VERR_INVALID_PARAMETER;
    11241123        goto out;
     
    11361135        {
    11371136            vrc = RTErrConvertFromErrno(errno);
    1138             RTPrintf("Cannot get the block count for file '%s': %Rrc", rawdisk.c_str(), vrc);
     1137            RTMsgError("Cannot get the block count for file '%s': %Rrc", rawdisk.c_str(), vrc);
    11391138            goto out;
    11401139        }
     
    11421141    else
    11431142    {
    1144         RTPrintf("File '%s' is no character device\n", rawdisk.c_str());
     1143        RTMsgError("File '%s' is no character device", rawdisk.c_str());
    11451144        vrc = VERR_INVALID_PARAMETER;
    11461145        goto out;
     
    11521151    if (RT_FAILURE(vrc))
    11531152    {
    1154         RTPrintf("Error getting the size of the raw disk '%s': %Rrc\n", rawdisk.c_str(), vrc);
     1153        RTMsgError("Cannot get the size of the raw disk '%s': %Rrc", rawdisk.c_str(), vrc);
    11551154        goto out;
    11561155    }
     
    11601159    if (!cbSize || cbSize % 512)
    11611160    {
    1162         RTPrintf("Detected size of raw disk '%s' is %s, an invalid value\n", rawdisk.c_str(), cbSize);
     1161        RTMsgError("Detected size of raw disk '%s' is %s, an invalid value", rawdisk.c_str(), cbSize);
    11631162        vrc = VERR_INVALID_PARAMETER;
    11641163        goto out;
     
    11911190            if (RT_FAILURE(vrc))
    11921191            {
    1193                 RTPrintf("Incorrect value in partitions parameter\n");
     1192                RTMsgError("Incorrect value in partitions parameter");
    11941193                goto out;
    11951194            }
     
    12001199            else if (*p != '\0')
    12011200            {
    1202                 RTPrintf("Incorrect separator in partitions parameter\n");
     1201                RTMsgError("Incorrect separator in partitions parameter");
    12031202                vrc = VERR_INVALID_PARAMETER;
    12041203                goto out;
     
    12101209        if (RT_FAILURE(vrc))
    12111210        {
    1212             RTPrintf("Error reading the partition information from '%s'\n", rawdisk.c_str());
     1211            RTMsgError("Cannot read the partition information from '%s'", rawdisk.c_str());
    12131212            goto out;
    12141213        }
     
    12231222                 * partitions error later during VMDK creation. So warn
    12241223                 * here and ignore what the user requested. */
    1225                 RTPrintf("Warning: it is not possible (and necessary) to explicitly give access to the\n"
    1226                          "         extended partition %u. If required, enable access to all logical\n"
    1227                          "         partitions inside this extended partition.\n", partitions.aPartitions[i].uIndex);
     1224                RTMsgWarning("It is not possible (and necessary) to explicitly give access to the "
     1225                             "extended partition %u. If required, enable access to all logical "
     1226                             "partitions inside this extended partition.",
     1227                             partitions.aPartitions[i].uIndex);
    12281228                uPartitions &= ~RT_BIT(partitions.aPartitions[i].uIndex);
    12291229            }
     
    12411241                if (!pPartDesc)
    12421242                {
    1243                     RTPrintf("Out of memory allocating the partition list for '%s'\n", rawdisk.c_str());
     1243                    RTMsgError("Out of memory allocating the partition list for '%s'", rawdisk.c_str());
    12441244                    vrc = VERR_NO_MEMORY;
    12451245                    goto out;
     
    12571257                if (!pPartData)
    12581258                {
    1259                     RTPrintf("Out of memory allocating the partition descriptor for '%s'\n", rawdisk.c_str());
     1259                    RTMsgError("Out of memory allocating the partition descriptor for '%s'", rawdisk.c_str());
    12601260                    vrc = VERR_NO_MEMORY;
    12611261                    goto out;
     
    12651265                if (RT_FAILURE(vrc))
    12661266                {
    1267                     RTPrintf("Cannot read partition data from raw device '%s': %Rrc\n", rawdisk.c_str(), vrc);
     1267                    RTMsgError("Cannot read partition data from raw device '%s': %Rrc", rawdisk.c_str(), vrc);
    12681268                    goto out;
    12691269                }
     
    12761276                    if (RT_FAILURE(vrc))
    12771277                    {
    1278                         RTPrintf("Cannot open replacement MBR file '%s' specified with -mbr: %Rrc\n", pszMBRFilename, vrc);
     1278                        RTMsgError("Cannot open replacement MBR file '%s' specified with -mbr: %Rrc", pszMBRFilename, vrc);
    12791279                        goto out;
    12801280                    }
     
    12831283                    if (RT_FAILURE(vrc))
    12841284                    {
    1285                         RTPrintf("Cannot read replacement MBR file '%s': %Rrc\n", pszMBRFilename, vrc);
     1285                        RTMsgError("Cannot read replacement MBR file '%s': %Rrc", pszMBRFilename, vrc);
    12861286                        goto out;
    12871287                    }
     
    13061306            if (!pPartDesc)
    13071307            {
    1308                 RTPrintf("Out of memory allocating the partition list for '%s'\n", rawdisk.c_str());
     1308                RTMsgError("Out of memory allocating the partition list for '%s'", rawdisk.c_str());
    13091309                vrc = VERR_NO_MEMORY;
    13101310                goto out;
     
    13221322                    if (RT_FAILURE(vrc))
    13231323                    {
    1324                         RTPrintf("Error creating reference to individual partition %u, rc=%Rrc\n",
     1324                        RTMsgError("Cannot create reference to individual partition %u, rc=%Rrc",
    13251325                                 partitions.aPartitions[i].uIndex, vrc);
    13261326                        goto out;
     
    13351335                    if (RT_FAILURE(vrc))
    13361336                    {
    1337                         RTPrintf("Error creating reference to individual partition %u, rc=%Rrc\n",
     1337                        RTMsgError("Cannot create reference to individual partition %u, rc=%Rrc",
    13381338                                 partitions.aPartitions[i].uIndex, vrc);
    13391339                        goto out;
     
    13921392                if (!RawDescriptor.pPartDescs[i].cbData)
    13931393                {
    1394                     RTPrintf("MBR/EPT overlaps with data area\n");
     1394                    RTMsgError("MBR/EPT overlaps with data area");
    13951395                    vrc = VERR_INVALID_PARAMETER;
    13961396                    goto out;
     
    14291429    if (RT_FAILURE(vrc))
    14301430    {
    1431         RTPrintf("Error while creating the virtual disk container: %Rrc\n", vrc);
     1431        RTMsgError("Cannot create the virtual disk container: %Rrc", vrc);
    14321432        goto out;
    14331433    }
     
    14481448    if (RT_FAILURE(vrc))
    14491449    {
    1450         RTPrintf("Error while creating the raw disk VMDK: %Rrc\n", vrc);
     1450        RTMsgError("Cannot create the raw disk VMDK: %Rrc", vrc);
    14511451        goto out;
    14521452    }
     
    14791479
    14801480out:
    1481     RTPrintf("The raw disk vmdk file was not created\n");
     1481    RTMsgError("The raw disk vmdk file was not created");
    14821482    return RT_SUCCESS(vrc) ? 0 : 1;
    14831483}
     
    15361536    if (RT_FAILURE(vrc))
    15371537    {
    1538         RTPrintf("Error while creating the virtual disk container: %Rrc\n", vrc);
     1538        RTMsgError("Cannot create the virtual disk container: %Rrc", vrc);
    15391539        return vrc;
    15401540    }
     
    15441544        if (RT_FAILURE(vrc))
    15451545        {
    1546             RTPrintf("Error while opening the source image: %Rrc\n", vrc);
     1546            RTMsgError("Cannot create the source image: %Rrc", vrc);
    15471547        }
    15481548        else
     
    15511551            if (RT_FAILURE(vrc))
    15521552            {
    1553                 RTPrintf("Error while renaming the image: %Rrc\n", vrc);
     1553                RTMsgError("Cannot rename the image: %Rrc", vrc);
    15541554            }
    15551555        }
     
    16181618    if (RT_FAILURE(vrc))
    16191619    {
    1620         RTPrintf("Error while creating the virtual disk container: %Rrc\n", vrc);
     1620        RTMsgError("Cannot create the virtual disk container: %Rrc", vrc);
    16211621        return 1;
    16221622    }
     
    16321632    {
    16331633        VDCloseAll(pDisk);
    1634         RTPrintf("Error while creating destination file \"%s\": %Rrc\n", dst.c_str(), vrc);
     1634        RTMsgError("Cannot create destination file \"%s\": %Rrc", dst.c_str(), vrc);
    16351635        return 1;
    16361636    }
     
    16491649                RTFileDelete(dst.c_str());
    16501650            }
    1651             RTPrintf("No file format specified and autodetect failed - please specify format: %Rrc\n", vrc);
     1651            RTMsgError("No file format specified and autodetect failed - please specify format: %Rrc", vrc);
    16521652            return 1;
    16531653        }
     
    16641664            RTFileDelete(dst.c_str());
    16651665        }
    1666         RTPrintf("Error while opening the source image: %Rrc\n", vrc);
     1666        RTMsgError("Cannot open the source image: %Rrc", vrc);
    16671667        return 1;
    16681668    }
     
    16751675    if (pvBuf)
    16761676    {
    1677         RTPrintf("Converting image \"%s\" with size %RU64 bytes (%RU64MB) to raw...\n", src.c_str(), cbSize, (cbSize + _1M - 1) / _1M);
     1677        RTStrmPrintf(g_pStdErr, "Converting image \"%s\" with size %RU64 bytes (%RU64MB) to raw...\n", src.c_str(), cbSize, (cbSize + _1M - 1) / _1M);
    16781678        while (offFile < cbSize)
    16791679        {
     
    16951695                RTFileDelete(dst.c_str());
    16961696            }
    1697             RTPrintf("Error copying image data: %Rrc\n", vrc);
     1697            RTMsgError("Cannot copy image data: %Rrc", vrc);
    16981698            return 1;
    16991699        }
     
    17081708            RTFileDelete(dst.c_str());
    17091709        }
    1710         RTPrintf("Error allocating read buffer: %Rrc\n", vrc);
     1710        RTMsgError("Out of memory allocating read buffer");
    17111711        return 1;
    17121712    }
     
    17911791            if (RT_FAILURE(vrc))
    17921792            {
    1793                 RTPrintf("No file format specified and autodetect failed - please specify format: %Rrc\n", vrc);
     1793                RTMsgError("No file format specified and autodetect failed - please specify format: %Rrc", vrc);
    17941794                break;
    17951795            }
     
    18011801        if (RT_FAILURE(vrc))
    18021802        {
    1803             RTPrintf("Error while creating the source virtual disk container: %Rrc\n", vrc);
     1803            RTMsgError("Cannot create the source virtual disk container: %Rrc", vrc);
    18041804            break;
    18051805        }
     
    18091809        if (RT_FAILURE(vrc))
    18101810        {
    1811             RTPrintf("Error while opening the source image: %Rrc\n", vrc);
     1811            RTMsgError("Cannot open the source image: %Rrc", vrc);
    18121812            break;
    18131813        }
     
    18201820        if (RT_FAILURE(vrc))
    18211821        {
    1822             RTPrintf("Error while creating the destination virtual disk container: %Rrc\n", vrc);
     1822            RTMsgError("Cannot create the destination virtual disk container: %Rrc", vrc);
    18231823            break;
    18241824        }
    18251825
    18261826        uint64_t cbSize = VDGetSize(pSrcDisk, VD_LAST_IMAGE);
    1827         RTPrintf("Converting image \"%s\" with size %RU64 bytes (%RU64MB)...\n", src.c_str(), cbSize, (cbSize + _1M - 1) / _1M);
     1827        RTStrmPrintf(g_pStdErr, "Converting image \"%s\" with size %RU64 bytes (%RU64MB)...\n", src.c_str(), cbSize, (cbSize + _1M - 1) / _1M);
    18281828
    18291829        /* Create the output image */
     
    18331833        if (RT_FAILURE(vrc))
    18341834        {
    1835             RTPrintf("Error while copying the image: %Rrc\n", vrc);
     1835            RTMsgError("Cannot copy the image: %Rrc", vrc);
    18361836            break;
    18371837        }
     
    19871987    /** @todo flags, groups destination. */
    19881988    if (fFlagsPresent || fGroupsPresent || fDestsPresent)
    1989         RTPrintf("WARNING: One or more of the requested features are not implemented! Feel free to do this... :-)\n");
     1989        RTMsgWarning("One or more of the requested features are not implemented! Feel free to do this.");
    19901990
    19911991    if (fEnablePresent && fEnable)
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r32686 r32701  
    3030
    3131# include <VBox/com/VirtualBox.h>
    32 
    33 # include <vector>
    34 # include <list>
    3532#endif /* !VBOX_ONLY_DOCS */
    3633
     
    9592    if (!g_fDetailedProgress)
    9693    {
    97         RTPrintf("0%%...");
    98         RTStrmFlush(g_pStdOut);
     94        RTStrmPrintf(g_pStdErr, "0%%...");
     95        RTStrmFlush(g_pStdErr);
    9996    }
    10097
     
    137134                progress->COMGETTER(TimeRemaining)(&lSecsRem);
    138135
    139                 RTPrintf("(%ld/%ld) %ls %ld%% => %ld%% (%d s remaining)\n", ulOperation + 1, cOperations, bstrOperationDescription.raw(), ulCurrentOperationPercent, ulCurrentPercent, lSecsRem);
     136                RTStrmPrintf(g_pStdErr, "(%ld/%ld) %ls %ld%% => %ld%% (%d s remaining)\n", ulOperation + 1, cOperations, bstrOperationDescription.raw(), ulCurrentOperationPercent, ulCurrentPercent, lSecsRem);
    140137                ulLastPercent = ulCurrentPercent;
    141138                ulLastOperationPercent = ulCurrentOperationPercent;
     
    152149                    if (curVal < 100)
    153150                    {
    154                         RTPrintf("%ld%%...", curVal);
    155                         RTStrmFlush(g_pStdOut);
     151                        RTStrmPrintf(g_pStdErr, "%ld%%...", curVal);
     152                        RTStrmFlush(g_pStdErr);
    156153                    }
    157154                }
     
    190187    {
    191188        if (SUCCEEDED(iRc))
    192             RTPrintf("100%%\n");
     189            RTStrmPrintf(g_pStdErr, "100%%\n");
    193190        else if (g_fCanceled)
    194             RTPrintf("CANCELED\n");
     191            RTStrmPrintf(g_pStdErr, "CANCELED\n");
    195192        else
    196             RTPrintf("FAILED\n");
     193            RTStrmPrintf(g_pStdErr, "FAILED\n");
    197194    }
    198195    else
    199         RTPrintf("\n");
    200     RTStrmFlush(g_pStdOut);
     196        RTStrmPrintf(g_pStdErr, "\n");
     197    RTStrmFlush(g_pStdErr);
    201198    return iRc;
    202199}
     
    279276    if (FAILED(rc))
    280277    {
    281         RTPrintf("ERROR: failed to initialize COM!\n");
     278        RTMsgError("Failed to initialize COM!");
    282279        return rc;
    283280    }
     
    318315    rc = virtualBox.createLocalObject(CLSID_VirtualBox);
    319316    if (FAILED(rc))
    320         RTPrintf("ERROR: failed to create the VirtualBox object!\n");
     317        RTMsgError("Failed to create the VirtualBox object!");
    321318    else
    322319    {
    323320        rc = session.createInprocObject(CLSID_Session);
    324321        if (FAILED(rc))
    325             RTPrintf("ERROR: failed to create a session object!\n");
     322            RTMsgError("Failed to create a session object!");
    326323    }
    327324
     
    332329        {
    333330            com::GluePrintRCMessage(rc);
    334             RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n");
     331            RTMsgError("Most likely, the VirtualBox COM server is not running or failed to start.");
    335332        }
    336333        else
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r31461 r32701  
    2727
    2828#include <iprt/types.h>
     29#include <iprt/message.h>
    2930
    3031////////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r31539 r32701  
    11/* $Id$ */
    22/** @file
    3  * VBoxManage - VirtualBox's command-line interface.
     3 * VBoxManage - Implementation of controlvm command.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3939
    4040#include "VBoxManage.h"
     41
     42#include <list>
    4143
    4244
     
    148150                com::ProgressErrorInfo info(progress);
    149151                if (info.isBasicAvailable())
    150                 {
    151                     RTPrintf("Error: failed to power off machine. Error message: %lS\n", info.getText().raw());
    152                 }
    153                 else
    154                 {
    155                     RTPrintf("Error: failed to power off machine. No error message available!\n");
    156                 }
     152                    RTMsgError("Failed to power off machine. Error message: %lS", info.getText().raw());
     153                else
     154                    RTMsgError("Failed to power off machine. No error message available!");
    157155            }
    158156        }
     
    175173                com::ProgressErrorInfo info(progress);
    176174                if (info.isBasicAvailable())
    177                 {
    178                     RTPrintf("Error: failed to save machine state. Error message: %lS\n", info.getText().raw());
    179                 }
    180                 else
    181                 {
    182                     RTPrintf("Error: failed to save machine state. No error message available!\n");
    183                 }
     175                    RTMsgError("Failed to save machine state. Error message: %lS", info.getText().raw());
     176                else
     177                    RTMsgError("Failed to save machine state. No error message available!");
    184178                console->Resume();
    185179            }
     
    212206            }
    213207
    214             /* Arbitrary restrict the length of a sequence of scancodes to 1024. */
    215             LONG alScancodes[1024];
    216             int cScancodes = 0;
     208            std::list<LONG> llScancodes;
    217209
    218210            /* Process the command line. */
    219211            int i;
    220             for (i = 1 + 1; i < a->argc && cScancodes < (int)RT_ELEMENTS(alScancodes); i++, cScancodes++)
     212            for (i = 1 + 1; i < a->argc; i++)
    221213            {
    222214                if (   RT_C_IS_XDIGIT (a->argv[i][0])
     
    228220                    if (RT_FAILURE (irc))
    229221                    {
    230                         RTPrintf("Error: converting '%s' returned %Rrc!\n", a->argv[i], rc);
     222                        RTMsgError("Converting '%s' returned %Rrc!", a->argv[i], rc);
    231223                        rc = E_FAIL;
    232224                        break;
    233225                    }
    234226
    235                     alScancodes[cScancodes] = u8Scancode;
    236                 }
    237                 else
    238                 {
    239                     RTPrintf("Error: '%s' is not a hex byte!\n", a->argv[i]);
     227                    llScancodes.push_back(u8Scancode);
     228                }
     229                else
     230                {
     231                    RTMsgError("Error: '%s' is not a hex byte!", a->argv[i]);
    240232                    rc = E_FAIL;
    241233                    break;
     
    246238                break;
    247239
    248             if (   cScancodes == RT_ELEMENTS(alScancodes)
    249                 && i < a->argc)
    250             {
    251                 RTPrintf("Error: too many scancodes, maximum %d allowed!\n", RT_ELEMENTS(alScancodes));
    252                 rc = E_FAIL;
    253                 break;
    254             }
    255 
    256             /* Send scancodes to the VM.
    257              * Note: 'PutScancodes' did not work here. Only the first scancode was transmitted.
    258              */
    259             for (i = 0; i < cScancodes; i++)
    260             {
    261                 CHECK_ERROR_BREAK(keyboard, PutScancode(alScancodes[i]));
    262                 RTPrintf("Scancode[%d]: 0x%02X\n", i, alScancodes[i]);
     240            /* Send scancodes to the VM. */
     241            com::SafeArray<LONG> saScancodes(llScancodes);
     242            ULONG codesStored = 0;
     243            CHECK_ERROR_BREAK(keyboard, PutScancodes(ComSafeArrayAsInParam(saScancodes),
     244                                                     &codesStored));
     245            if (codesStored < saScancodes.size())
     246            {
     247                RTMsgError("Only %d scancodes were stored", codesStored);
     248                rc = E_FAIL;
     249                break;
    263250            }
    264251        }
     
    352339                }
    353340                else
    354                 {
    355                     RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n);
    356                 }
     341                    RTMsgError("The NIC %d is currently disabled and thus can't change its tracefile", n);
    357342            }
    358343        }
     
    403388                }
    404389                else
    405                 {
    406                     RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n);
    407                 }
     390                    RTMsgError("The NIC %d is currently disabled and thus can't change its trace flag", n);
    408391            }
    409392        }
     
    497480                }
    498481                else
    499                 {
    500                     RTPrintf("The NIC %d is currently disabled and thus can't change its attachment type\n", n);
    501                 }
     482                    RTMsgError("The NIC %d is currently disabled and thus can't change its attachment type", n);
    502483            }
    503484        }
     
    869850                com::ProgressErrorInfo info(progress);
    870851                if (info.isBasicAvailable())
    871                     RTPrintf("Error: teleportation failed. Error message: %lS\n", info.getText().raw());
    872                 else
    873                     RTPrintf("Error: teleportation failed. No error message available!\n");
     852                    RTMsgError("Teleportation failed. Error message: %lS", info.getText().raw());
     853                else
     854                    RTMsgError("Teleportation failed. No error message available!");
    874855            }
    875856        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp

    r31539 r32701  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727
    2828#include <VBox/com/VirtualBox.h>
    29 
    30 #include <vector>
    31 #include <list>
    3229#endif /* !VBOX_ONLY_DOCS */
    3330
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp

    r32536 r32701  
    4848static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
    4949{
    50     RTPrintf("ERROR: ");
    51     RTPrintfV(pszFormat, va);
    52     RTPrintf("\n");
    53     RTPrintf("Error code %Rrc at %s(%u) in function %s\n", rc, RT_SRC_POS_ARGS);
     50    RTMsgError(pszFormat, va);
     51    RTMsgError("Error code %Rrc at %s(%u) in function %s", rc, RT_SRC_POS_ARGS);
    5452}
    5553
     
    300298                com::ProgressErrorInfo info(progress);
    301299                if (info.isBasicAvailable())
    302                     RTPrintf("Error: failed to create hard disk. Error message: %lS\n", info.getText().raw());
    303                 else
    304                     RTPrintf("Error: failed to create hard disk. No error message available!\n");
     300                    RTMsgError("Failed to create hard disk. Error message: %lS", info.getText().raw());
     301                else
     302                    RTMsgError("Failed to create hard disk. No error message available!");
    305303            }
    306304            else
     
    327325    return SUCCEEDED(rc) ? 0 : 1;
    328326}
    329 
    330 #if 0 /* disabled until disk shrinking is implemented based on VBoxHDD */
    331 static DECLCALLBACK(int) hardDiskProgressCallback(PVM pVM, unsigned uPercent, void *pvUser)
    332 {
    333     unsigned *pPercent = (unsigned *)pvUser;
    334 
    335     if (*pPercent != uPercent)
    336     {
    337         *pPercent = uPercent;
    338         RTPrintf(".");
    339         if ((uPercent % 10) == 0 && uPercent)
    340             RTPrintf("%d%%", uPercent);
    341         RTStrmFlush(g_pStdOut);
    342     }
    343 
    344     return VINF_SUCCESS;
    345 }
    346 #endif
    347327
    348328static const RTGETOPTDEF g_aModifyHardDiskOptions[] =
     
    474454                if (RT_FAILURE(irc))
    475455                {
    476                     RTPrintf("Cannot convert filename \"%s\" to absolute path\n", FilenameOrUuid);
     456                    RTMsgError("Cannot convert filename \"%s\" to absolute path", FilenameOrUuid);
    477457                    return 1;
    478458                }
     
    489469            {
    490470                if (rc == E_NOTIMPL)
    491                 {
    492                     RTPrintf("Error: Compact hard disk operation is not implemented!\n");
    493                     RTPrintf("The functionality will be restored later.\n");
    494                 }
     471                    RTMsgError("Compact hard disk operation is not implemented!");
    495472                else if (rc == VBOX_E_NOT_SUPPORTED)
    496                 {
    497                     RTPrintf("Error: Compact hard disk operation for this format is not implemented yet!\n");
    498                 }
     473                    RTMsgError("Compact hard disk operation for this format is not implemented yet!");
    499474                else
    500475                    com::GluePrintRCMessage(rc);
     
    519494                if (RT_FAILURE(irc))
    520495                {
    521                     RTPrintf("Cannot convert filename \"%s\" to absolute path\n", FilenameOrUuid);
     496                    RTMsgError("Cannot convert filename \"%s\" to absolute path", FilenameOrUuid);
    522497                    return 1;
    523498                }
     
    534509            {
    535510                if (rc == E_NOTIMPL)
    536                 {
    537                     RTPrintf("Error: Resize hard disk operation is not implemented!\n");
    538                     RTPrintf("The functionality will be restored later.\n");
    539                 }
     511                    RTMsgError("Resize hard disk operation is not implemented!");
    540512                else if (rc == VBOX_E_NOT_SUPPORTED)
    541                 {
    542                     RTPrintf("Error: Resize hard disk operation for this format is not implemented yet!\n");
    543                 }
     513                    RTMsgError("Resize hard disk operation for this format is not implemented yet!");
    544514                else
    545515                    com::GluePrintRCMessage(rc);
     
    674644            if (RT_FAILURE(irc))
    675645            {
    676                 RTPrintf("Cannot convert filename \"%s\" to absolute path\n", Utf8Str(src).c_str());
     646                RTMsgError("Cannot convert filename \"%s\" to absolute path", Utf8Str(src).c_str());
    677647                return 1;
    678648            }
     
    702672                    if (RT_FAILURE(irc))
    703673                    {
    704                         RTPrintf("Cannot convert filename \"%s\" to absolute path\n", Utf8Str(dst).c_str());
     674                        RTMsgError("Cannot convert filename \"%s\" to absolute path", Utf8Str(dst).c_str());
    705675                        return 1;
    706676                    }
     
    736706            com::ProgressErrorInfo info(progress);
    737707            if (info.isBasicAvailable())
    738                 RTPrintf("Error: failed to clone hard disk. Error message: %lS\n", info.getText().raw());
     708                RTMsgError("Failed to clone hard disk. Error message: %lS", info.getText().raw());
    739709            else
    740                 RTPrintf("Error: failed to clone hard disk. No error message available!\n");
     710                RTMsgError("Failed to clone hard disk. No error message available!");
    741711            break;
    742712        }
     
    837807    if (!srcfilename || !dstfilename || (fReadFromStdIn && !filesize))
    838808        return errorSyntax(USAGE_CONVERTFROMRAW, "Incorrect number of parameters");
    839     RTPrintf("Converting from raw image file=\"%s\" to file=\"%s\"...\n",
    840              srcfilename, dstfilename);
     809    RTStrmPrintf(g_pStdErr, "Converting from raw image file=\"%s\" to file=\"%s\"...\n",
     810                 srcfilename, dstfilename);
    841811
    842812    PVBOXHDD pDisk = NULL;
     
    862832    if (RT_FAILURE(rc))
    863833    {
    864         RTPrintf("File=\"%s\" open error: %Rrf\n", srcfilename, rc);
     834        RTMsgError("Cannot open file \"%s\": %Rrc", srcfilename, rc);
    865835        goto out;
    866836    }
     
    874844    if (RT_FAILURE(rc))
    875845    {
    876         RTPrintf("Error getting image size for file \"%s\": %Rrc\n", srcfilename, rc);
     846        RTMsgError("Cannot get image size for file \"%s\": %Rrc", srcfilename, rc);
    877847        goto out;
    878848    }
    879849
    880     RTPrintf("Creating %s image with size %RU64 bytes (%RU64MB)...\n", (uImageFlags & VD_IMAGE_FLAGS_FIXED) ? "fixed" : "dynamic", cbFile, (cbFile + _1M - 1) / _1M);
     850    RTStrmPrintf(g_pStdErr, "Creating %s image with size %RU64 bytes (%RU64MB)...\n",
     851                 (uImageFlags & VD_IMAGE_FLAGS_FIXED) ? "fixed" : "dynamic", cbFile, (cbFile + _1M - 1) / _1M);
    881852    char pszComment[256];
    882853    RTStrPrintf(pszComment, sizeof(pszComment), "Converted image from %s", srcfilename);
     
    884855    if (RT_FAILURE(rc))
    885856    {
    886         RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc);
     857        RTMsgError("Cannot create the virtual disk container: %Rrc", rc);
    887858        goto out;
    888859    }
     
    902873    if (RT_FAILURE(rc))
    903874    {
    904         RTPrintf("Error while creating the disk image \"%s\": %Rrc\n", dstfilename, rc);
     875        RTMsgError("Cannot create the disk image \"%s\": %Rrc", dstfilename, rc);
    905876        goto out;
    906877    }
     
    912883    {
    913884        rc = VERR_NO_MEMORY;
    914         RTPrintf("Not enough memory allocating buffers for image \"%s\": %Rrc\n", dstfilename, rc);
     885        RTMsgError("Out of memory allocating buffers for image \"%s\": %Rrc", dstfilename, rc);
    915886        goto out;
    916887    }
     
    931902        if (RT_FAILURE(rc))
    932903        {
    933             RTPrintf("Failed to write to disk image \"%s\": %Rrc\n", dstfilename, rc);
     904            RTMsgError("Failed to write to disk image \"%s\": %Rrc", dstfilename, rc);
    934905            goto out;
    935906        }
     
    12011172            if (RT_FAILURE(vrc))
    12021173            {
    1203                 RTPrintf("Cannot convert filename \"%s\" to absolute path\n", FilenameOrUuid);
     1174                RTMsgError("Cannot convert filename \"%s\" to absolute path", FilenameOrUuid);
    12041175                return 1;
    12051176            }
     
    12751246        hardDisk->COMGETTER(Format)(format.asOutParam());
    12761247        RTPrintf("Storage format:       %lS\n", format.raw());
     1248
     1249        /// @todo also dump config parameters (iSCSI)
    12771250
    12781251        if (!unknown)
     
    14361409        if (RT_FAILURE(irc))
    14371410        {
    1438             RTPrintf("Cannot convert filename \"%s\" to absolute path\n", Filename);
     1411            RTMsgError("Cannot convert filename \"%s\" to absolute path", Filename);
    14391412            return 1;
    14401413        }
     
    15711544                    com::ProgressErrorInfo info(progress);
    15721545                    if (info.isBasicAvailable())
    1573                         RTPrintf("Error: failed to delete medium. Error message: %lS\n", info.getText().raw());
     1546                        RTMsgError("Failed to delete medium. Error message: %lS", info.getText().raw());
    15741547                    else
    1575                         RTPrintf("Error: failed to delete medium. No error message available!\n");
     1548                        RTMsgError("Failed to delete medium. No error message available!");
    15761549                }
    15771550            }
    15781551            else
    1579                 RTPrintf("Error: failed to delete medium. Error code %Rrc\n", rc);
     1552                RTMsgError("Failed to delete medium. Error code %Rrc", rc);
    15801553        }
    15811554        CHECK_ERROR(medium, Close());
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r31539 r32701  
    11/* $Id$ */
    22/** @file
    3  * VBoxManage - The 'guestcontrol' command.
     3 * VBoxManage - Implementation of guestcontrol command.
    44 */
    55
     
    6565void usageGuestControl(void)
    6666{
    67     RTPrintf("VBoxManage guestcontrol     execute <vmname>|<uuid>\n"
    68              "                            <path to program>\n"
    69              "                            --username <name> --password <password>\n"
    70              "                            [--arguments \"<arguments>\"]\n"
    71              "                            [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n"
    72              "                            [--flags <flags>] [--timeout <msec>]\n"
    73              "                            [--verbose] [--wait-for exit,stdout,stderr||]\n"
    74              "\n");
     67    RTStrmPrintf(g_pStdErr,
     68                 "VBoxManage guestcontrol     execute <vmname>|<uuid>\n"
     69                 "                            <path to program>\n"
     70                 "                            --username <name> --password <password>\n"
     71                 "                            [--arguments \"<arguments>\"]\n"
     72                 "                            [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n"
     73                 "                            [--flags <flags>] [--timeout <msec>]\n"
     74                 "                            [--verbose] [--wait-for exit,stdout,stderr||]\n"
     75                 "\n");
    7576}
    7677
     
    322323                {
    323324                    if (rc == VBOX_E_IPRT_ERROR)
    324                         RTPrintf("%ls.\n", info.getText().raw());
     325                        RTMsgError("%ls.", info.getText().raw());
    325326                    else
    326                         RTPrintf("ERROR: %ls (%Rhrc).\n", info.getText().raw(), info.getResultCode());
     327                        RTMsgError("%ls (%Rhrc).", info.getText().raw(), info.getResultCode());
    327328                }
    328329                break;
     
    392393                            {
    393394                                if (rc == VBOX_E_IPRT_ERROR)
    394                                 {
    395                                     RTPrintf("%ls.\n", info.getText().raw());
    396                                 }
     395                                    RTMsgError("%ls.", info.getText().raw());
    397396                                else
    398                                 {
    399                                     RTPrintf("ERROR: %ls (%Rhrc).\n", info.getText().raw(), info.getResultCode());
    400                                 }
     397                                    RTMsgError("%ls (%Rhrc).", info.getText().raw(), info.getResultCode());
    401398                            }
    402399                            cbOutputData = 0;
     
    489486                             * because it contains more accurate info about what went wrong. */
    490487                            if (info.getResultCode() == VBOX_E_IPRT_ERROR)
    491                             {
    492                                 RTPrintf("%ls.\n", info.getText().raw());
    493                             }
     488                                RTMsgError("%ls.", info.getText().raw());
    494489                            else
    495490                            {
    496                                 RTPrintf("\n\nProcess error details:\n");
     491                                RTMsgError("Process error details:");
    497492                                GluePrintErrorInfo(info);
    498                                 RTPrintf("\n");
    499493                            }
    500494                        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp

    r31698 r32701  
    11/* $Id$ */
    22/** @file
    3  * VBoxManage - The 'guestproperty' command.
     3 * VBoxManage - Implementation of guestproperty command.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5151void usageGuestProperty(void)
    5252{
    53     RTPrintf("VBoxManage guestproperty    get <vmname>|<uuid>\n"
    54              "                            <property> [--verbose]\n"
    55              "\n");
    56     RTPrintf("VBoxManage guestproperty    set <vmname>|<uuid>\n"
    57              "                            <property> [<value> [--flags <flags>]]\n"
    58              "\n");
    59     RTPrintf("VBoxManage guestproperty    enumerate <vmname>|<uuid>\n"
    60              "                            [--patterns <patterns>]\n"
    61              "\n");
    62     RTPrintf("VBoxManage guestproperty    wait <vmname>|<uuid> <patterns>\n"
    63              "                            [--timeout <msec>] [--fail-on-timeout]\n"
    64              "\n");
     53    RTStrmPrintf(g_pStdErr,
     54                 "VBoxManage guestproperty    get <vmname>|<uuid>\n"
     55                 "                            <property> [--verbose]\n"
     56                 "\n");
     57    RTStrmPrintf(g_pStdErr,
     58                 "VBoxManage guestproperty    set <vmname>|<uuid>\n"
     59                 "                            <property> [<value> [--flags <flags>]]\n"
     60                 "\n");
     61    RTStrmPrintf(g_pStdErr,
     62                 "VBoxManage guestproperty    enumerate <vmname>|<uuid>\n"
     63                 "                            [--patterns <patterns>]\n"
     64                 "\n");
     65    RTStrmPrintf(g_pStdErr,
     66                 "VBoxManage guestproperty    wait <vmname>|<uuid> <patterns>\n"
     67                 "                            [--timeout <msec>] [--fail-on-timeout]\n"
     68                 "\n");
    6569}
    6670
     
    357361    if (!fSignalled)
    358362    {
    359         RTPrintf("Time out or interruption while waiting for a notification.\n");
     363        RTMsgError("Time out or interruption while waiting for a notification.");
    360364        if (fFailOnTimeout)
    361365            rcRet = 2;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r32531 r32701  
    3737    if (!s_fShown)
    3838    {
    39         RTPrintf(VBOX_PRODUCT" Command Line Management Interface Version "
    40                  VBOX_VERSION_STRING "\n"
    41                  "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
    42                  "All rights reserved.\n"
    43                  "\n");
     39        RTStrmPrintf(g_pStdErr, VBOX_PRODUCT " Command Line Management Interface Version "
     40                     VBOX_VERSION_STRING "\n"
     41                     "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
     42                     "All rights reserved.\n"
     43                     "\n");
    4444        s_fShown = true;
    4545    }
     
    9898    }
    9999
    100     RTPrintf("Usage:\n"
    101              "\n");
     100    RTStrmPrintf(g_pStdErr,
     101                 "Usage:\n"
     102                 "\n");
    102103
    103104    if (u64Cmd == USAGE_ALL)
    104105    {
    105         RTPrintf("VBoxManage [-v|--version]    print version number and exit\n"
    106                  "VBoxManage [-q|--nologo] ... suppress the logo\n"
    107                  "\n");
     106        RTStrmPrintf(g_pStdErr,
     107                     "VBoxManage [-v|--version]    print version number and exit\n"
     108                     "VBoxManage [-q|--nologo] ... suppress the logo\n"
     109                     "\n");
    108110    }
    109111
    110112    if (u64Cmd & USAGE_LIST)
    111113    {
    112         RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
     114        RTStrmPrintf(g_pStdErr,
     115                     "VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
    113116#if defined(VBOX_WITH_NETFLT)
    114                  "                            bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
     117                     "                            bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
    115118#else
    116                  "                            bridgedifs|dhcpservers|hostinfo|\n"
    117 #endif
    118                  "                            hostcpuids|hddbackends|hdds|dvds|floppies|\n"
    119                  "                            usbhost|usbfilters|systemproperties\n"
    120                  "\n");
     119                     "                            bridgedifs|dhcpservers|hostinfo|\n"
     120#endif
     121                     "                            hostcpuids|hddbackends|hdds|dvds|floppies|\n"
     122                     "                            usbhost|usbfilters|systemproperties\n"
     123                     "\n");
    121124    }
    122125
    123126    if (u64Cmd & USAGE_SHOWVMINFO)
    124127    {
    125         RTPrintf("VBoxManage showvminfo       <uuid>|<name> [--details] [--statistics]\n"
    126                  "                            [--machinereadable]\n"
    127                  "VBoxManage showvminfo       <uuid>|<name> --log <idx>\n"
    128                  "\n");
     128        RTStrmPrintf(g_pStdErr,
     129                     "VBoxManage showvminfo       <uuid>|<name> [--details] [--statistics]\n"
     130                     "                            [--machinereadable]\n"
     131                     "VBoxManage showvminfo       <uuid>|<name> --log <idx>\n"
     132                     "\n");
    129133    }
    130134
    131135    if (u64Cmd & USAGE_REGISTERVM)
    132136    {
    133         RTPrintf("VBoxManage registervm       <filename>\n"
    134                  "\n");
     137        RTStrmPrintf(g_pStdErr,
     138                     "VBoxManage registervm       <filename>\n"
     139                     "\n");
    135140    }
    136141
    137142    if (u64Cmd & USAGE_UNREGISTERVM)
    138143    {
    139         RTPrintf("VBoxManage unregistervm     <uuid>|<name> [--delete]\n"
    140                  "\n");
     144        RTStrmPrintf(g_pStdErr,
     145                     "VBoxManage unregistervm     <uuid>|<name> [--delete]\n"
     146                     "\n");
    141147    }
    142148
    143149    if (u64Cmd & USAGE_CREATEVM)
    144150    {
    145         RTPrintf("VBoxManage createvm         --name <name>\n"
    146                  "                            [--ostype <ostype>]\n"
    147                  "                            [--register]\n"
    148                  "                            [--basefolder <path> | --settingsfile <path>]\n"
    149                  "                            [--uuid <uuid>]\n"
    150                  "\n");
     151        RTStrmPrintf(g_pStdErr,
     152                     "VBoxManage createvm         --name <name>\n"
     153                     "                            [--ostype <ostype>]\n"
     154                     "                            [--register]\n"
     155                     "                            [--basefolder <path> | --settingsfile <path>]\n"
     156                     "                            [--uuid <uuid>]\n"
     157                     "\n");
    151158    }
    152159
    153160    if (u64Cmd & USAGE_MODIFYVM)
    154161    {
    155         RTPrintf("VBoxManage modifyvm         <uuid|name>\n"
    156                  "                            [--name <name>]\n"
    157                  "                            [--ostype <ostype>]\n"
    158                  "                            [--memory <memorysize in MB>]\n"
    159                  "                            [--pagefusion on|off]\n"
    160                  "                            [--vram <vramsize in MB>]\n"
    161                  "                            [--acpi on|off]\n"
    162                  "                            [--ioapic on|off]\n"
    163                  "                            [--pae on|off]\n"
    164                  "                            [--hpet on|off]\n"
    165                  "                            [--hwvirtex on|off]\n"
    166                  "                            [--nestedpaging on|off]\n"
    167                  "                            [--largepages on|off]\n"
    168                  "                            [--vtxvpid on|off]\n"
    169                  "                            [--synthcpu on|off]\n"
    170                  "                            [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
    171                  "                            [--cpuidremove <leaf>]\n"
    172                  "                            [--cpuidremoveall]\n"
    173                  "                            [--hardwareuuid <uuid>]\n"
    174                  "                            [--cpus <number>]\n"
    175                  "                            [--cpuhotplug on|off]\n"
    176                  "                            [--plugcpu <id>]\n"
    177                  "                            [--unplugcpu <id>]\n"
    178                  "                            [--rtcuseutc on|off]\n"
    179                  "                            [--monitorcount <number>]\n"
    180                  "                            [--accelerate3d on|off]\n"
     162        RTStrmPrintf(g_pStdErr,
     163                     "VBoxManage modifyvm         <uuid|name>\n"
     164                     "                            [--name <name>]\n"
     165                     "                            [--ostype <ostype>]\n"
     166                     "                            [--memory <memorysize in MB>]\n"
     167                     "                            [--pagefusion on|off]\n"
     168                     "                            [--vram <vramsize in MB>]\n"
     169                     "                            [--acpi on|off]\n"
     170                     "                            [--ioapic on|off]\n"
     171                     "                            [--pae on|off]\n"
     172                     "                            [--hpet on|off]\n"
     173                     "                            [--hwvirtex on|off]\n"
     174                     "                            [--nestedpaging on|off]\n"
     175                     "                            [--largepages on|off]\n"
     176                     "                            [--vtxvpid on|off]\n"
     177                     "                            [--synthcpu on|off]\n"
     178                     "                            [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
     179                     "                            [--cpuidremove <leaf>]\n"
     180                     "                            [--cpuidremoveall]\n"
     181                     "                            [--hardwareuuid <uuid>]\n"
     182                     "                            [--cpus <number>]\n"
     183                     "                            [--cpuhotplug on|off]\n"
     184                     "                            [--plugcpu <id>]\n"
     185                     "                            [--unplugcpu <id>]\n"
     186                     "                            [--rtcuseutc on|off]\n"
     187                     "                            [--monitorcount <number>]\n"
     188                     "                            [--accelerate3d on|off]\n"
    181189#ifdef VBOX_WITH_VIDEOHWACCEL
    182                  "                            [--accelerate2dvideo on|off]\n"
    183 #endif
    184                  "                            [--firmware bios|efi|efi32|efi64]\n"
    185                  "                            [--bioslogofadein on|off]\n"
    186                  "                            [--bioslogofadeout on|off]\n"
    187                  "                            [--bioslogodisplaytime <msec>]\n"
    188                  "                            [--bioslogoimagepath <imagepath>]\n"
    189                  "                            [--biosbootmenu disabled|menuonly|messageandmenu]\n"
    190                  "                            [--biossystemtimeoffset <msec>]\n"
    191                  "                            [--biospxedebug on|off]\n"
    192                  "                            [--boot<1-4> none|floppy|dvd|disk|net>]\n"
    193                  "                            [--nic<1-N> none|null|nat|bridged|intnet"
     190                     "                            [--accelerate2dvideo on|off]\n"
     191#endif
     192                     "                            [--firmware bios|efi|efi32|efi64]\n"
     193                     "                            [--bioslogofadein on|off]\n"
     194                     "                            [--bioslogofadeout on|off]\n"
     195                     "                            [--bioslogodisplaytime <msec>]\n"
     196                     "                            [--bioslogoimagepath <imagepath>]\n"
     197                     "                            [--biosbootmenu disabled|menuonly|messageandmenu]\n"
     198                     "                            [--biossystemtimeoffset <msec>]\n"
     199                     "                            [--biospxedebug on|off]\n"
     200                     "                            [--boot<1-4> none|floppy|dvd|disk|net>]\n"
     201                     "                            [--nic<1-N> none|null|nat|bridged|intnet"
    194202#if defined(VBOX_WITH_NETFLT)
    195                  "|hostonly"
     203                     "|hostonly"
    196204#endif
    197205#ifdef VBOX_WITH_VDE
    198                  "|\n"
    199                  "                                        vde"
    200 #endif
    201                  "]\n"
    202                  "                            [--nictype<1-N> Am79C970A|Am79C973"
     206                     "|\n"
     207                     "                                        vde"
     208#endif
     209                     "]\n"
     210                     "                            [--nictype<1-N> Am79C970A|Am79C973"
    203211#ifdef VBOX_WITH_E1000
    204               "|\n                                            82540EM|82543GC|82545EM"
     212                  "|\n                                            82540EM|82543GC|82545EM"
    205213#endif
    206214#ifdef VBOX_WITH_VIRTIO
    207               "|\n                                            virtio"
     215                  "|\n                                            virtio"
    208216#endif /* VBOX_WITH_VIRTIO */
    209                  "]\n"
    210                  "                            [--cableconnected<1-N> on|off]\n"
    211                  "                            [--nictrace<1-N> on|off]\n"
    212                  "                            [--nictracefile<1-N> <filename>]\n"
    213                  "                            [--nicspeed<1-N> <kbps>]\n"
    214                  "                            [--nicbootprio<1-N> <priority>]\n"
    215                  "                            [--bridgeadapter<1-N> none|<devicename>]\n"
     217                     "]\n"
     218                     "                            [--cableconnected<1-N> on|off]\n"
     219                     "                            [--nictrace<1-N> on|off]\n"
     220                     "                            [--nictracefile<1-N> <filename>]\n"
     221                     "                            [--nicspeed<1-N> <kbps>]\n"
     222                     "                            [--nicbootprio<1-N> <priority>]\n"
     223                     "                            [--bridgeadapter<1-N> none|<devicename>]\n"
    216224#if defined(VBOX_WITH_NETFLT)
    217                  "                            [--hostonlyadapter<1-N> none|<devicename>]\n"
    218 #endif
    219                  "                            [--intnet<1-N> <network name>]\n"
    220                  "                            [--natnet<1-N> <network>|default]\n"
     225                     "                            [--hostonlyadapter<1-N> none|<devicename>]\n"
     226#endif
     227                     "                            [--intnet<1-N> <network name>]\n"
     228                     "                            [--natnet<1-N> <network>|default]\n"
    221229#ifdef VBOX_WITH_VDE
    222                  "                            [--vdenet<1-N> <network>|default]\n"
    223 #endif
    224                  "                            [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
    225                  "                                                [<sockrcv>],[<tcpsnd>],\n"
    226                  "                                                [<tcprcv>]]\n"
    227                  "                            [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
    228                  "                                          <hostport>,[<guestip>],<guestport>]\n"
    229                  "                            [--natpf<1-N> delete <rulename>]\n"
    230                  "                            [--nattftpprefix<1-N> <prefix>]\n"
    231                  "                            [--nattftpfile<1-N> <file>]\n"
    232                  "                            [--nattftpserver<1-N> <ip>]\n"
    233                  "                            [--natdnspassdomain<1-N> on|off]\n"
    234                  "                            [--natdnsproxy<1-N> on|off]\n"
    235                  "                            [--natdnshostresolver<1-N> on|off]\n"
    236                  "                            [--nataliasmode<1-N> default|[log],[proxyonly],\n"
    237                  "                                                         [sameports]]\n"
    238                  "                            [--macaddress<1-N> auto|<mac>]\n"
    239                  "                            [--mouse ps2|usb|usbtablet\n"
    240                  "                            [--keyboard ps2|usb\n"
    241                  "                            [--uart<1-N> off|<I/O base> <IRQ>]\n"
    242                  "                            [--uartmode<1-N> disconnected|\n"
    243                  "                                             server <pipe>|\n"
    244                  "                                             client <pipe>|\n"
    245                  "                                             file <file>|\n"
    246                  "                                             <devicename>]\n"
    247                  "                            [--guestmemoryballoon <balloonsize in MB>]\n"
    248                  "                            [--gueststatisticsinterval <seconds>]\n"
    249                  );
    250         RTPrintf("                            [--audio none|null");
     230                     "                            [--vdenet<1-N> <network>|default]\n"
     231#endif
     232                     "                            [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
     233                     "                                                [<sockrcv>],[<tcpsnd>],\n"
     234                     "                                                [<tcprcv>]]\n"
     235                     "                            [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
     236                     "                                          <hostport>,[<guestip>],<guestport>]\n"
     237                     "                            [--natpf<1-N> delete <rulename>]\n"
     238                     "                            [--nattftpprefix<1-N> <prefix>]\n"
     239                     "                            [--nattftpfile<1-N> <file>]\n"
     240                     "                            [--nattftpserver<1-N> <ip>]\n"
     241                     "                            [--natdnspassdomain<1-N> on|off]\n"
     242                     "                            [--natdnsproxy<1-N> on|off]\n"
     243                     "                            [--natdnshostresolver<1-N> on|off]\n"
     244                     "                            [--nataliasmode<1-N> default|[log],[proxyonly],\n"
     245                     "                                                         [sameports]]\n"
     246                     "                            [--macaddress<1-N> auto|<mac>]\n"
     247                     "                            [--mouse ps2|usb|usbtablet\n"
     248                     "                            [--keyboard ps2|usb\n"
     249                     "                            [--uart<1-N> off|<I/O base> <IRQ>]\n"
     250                     "                            [--uartmode<1-N> disconnected|\n"
     251                     "                                             server <pipe>|\n"
     252                     "                                             client <pipe>|\n"
     253                     "                                             file <file>|\n"
     254                     "                                             <devicename>]\n"
     255                     "                            [--guestmemoryballoon <balloonsize in MB>]\n"
     256                     "                            [--gueststatisticsinterval <seconds>]\n"
     257                     "                            [--audio none|null");
    251258        if (fWin)
    252259        {
    253260#ifdef VBOX_WITH_WINMM
    254             RTPrintf(                        "|winmm|dsound");
     261            RTStrmPrintf(g_pStdErr, "|winmm|dsound");
    255262#else
    256             RTPrintf(                        "|dsound");
     263            RTStrmPrintf(g_pStdErr, "|dsound");
    257264#endif
    258265        }
    259266        if (fSolaris)
    260267        {
    261             RTPrintf(                        "|solaudio"
     268            RTStrmPrintf(g_pStdErr, "|solaudio"
    262269#ifdef VBOX_WITH_SOLARIS_OSS
    263                                              "|oss"
    264 #endif
    265                                               );
     270                                    "|oss"
     271#endif
     272                        );
    266273        }
    267274        if (fLinux)
    268275        {
    269             RTPrintf(                        "|oss"
     276            RTStrmPrintf(g_pStdErr, "|oss"
    270277#ifdef VBOX_WITH_ALSA
    271                                              "|alsa"
     278                                    "|alsa"
    272279#endif
    273280#ifdef VBOX_WITH_PULSE
    274                                              "|pulse"
    275 #endif
    276                                              );
     281                                    "|pulse"
     282#endif
     283                        );
    277284        }
    278285        if (fFreeBSD)
     
    281288            if (fDumpOpts)
    282289            {
    283                 RTPrintf(                    "|\n"
    284                  "                                     oss");
     290                RTStrmPrintf(g_pStdErr, "|\n"
     291                     "                                     oss");
    285292            }
    286293            else
    287                 RTPrintf(                    "|oss");
     294                RTStrmPrintf(g_pStdErr, "|oss");
    288295#ifdef VBOX_WITH_PULSE
    289             RTPrintf(                        "|pulse");
     296            RTStrmPrintf(g_pStdErr, "|pulse");
    290297#endif
    291298        }
    292299        if (fDarwin)
    293300        {
    294             RTPrintf(                        "|coreaudio");
     301            RTStrmPrintf(g_pStdErr, "|coreaudio");
    295302        }
    296         RTPrintf(                            "]\n");
    297         RTPrintf("                            [--audiocontroller ac97|hda|sb16]\n"
    298                  "                            [--clipboard disabled|hosttoguest|guesttohost|\n"
    299                  "                                         bidirectional]\n");
     303        RTStrmPrintf(g_pStdErr, "]\n");
     304        RTStrmPrintf(g_pStdErr,
     305                     "                            [--audiocontroller ac97|hda|sb16]\n"
     306                     "                            [--clipboard disabled|hosttoguest|guesttohost|\n"
     307                     "                                         bidirectional]\n");
    300308        if (fVRDP)
    301309        {
    302             RTPrintf("                            [--vrdp on|off]\n"
     310            RTStrmPrintf(g_pStdErr,
     311                     "                            [--vrdp on|off]\n"
    303312                     "                            [--vrdpport default|<ports>]\n"
    304313                     "                            [--vrdpaddress <host>]\n"
     
    309318                     "                            [--vrdpvideochannelquality <percent>]\n");
    310319        }
    311         RTPrintf("                            [--usb on|off]\n"
    312                  "                            [--usbehci on|off]\n"
    313                  "                            [--snapshotfolder default|<path>]\n"
    314                  "                            [--teleporter on|off]\n"
    315                  "                            [--teleporterport <port>]\n"
    316                  "                            [--teleporteraddress <address|empty>\n"
    317                  "                            [--teleporterpassword <password>]\n"
     320        RTStrmPrintf(g_pStdErr,
     321                     "                            [--usb on|off]\n"
     322                     "                            [--usbehci on|off]\n"
     323                     "                            [--snapshotfolder default|<path>]\n"
     324                     "                            [--teleporter on|off]\n"
     325                     "                            [--teleporterport <port>]\n"
     326                     "                            [--teleporteraddress <address|empty>\n"
     327                     "                            [--teleporterpassword <password>]\n"
    318328#if 0
    319                  "                            [--iocache on|off]\n"
    320                  "                            [--iocachesize <I/O cache size in MB>]\n"
    321 #endif
    322                 );
    323         RTPrintf("                            [--faulttolerance master|standby]\n"
    324                  "                            [--faulttoleranceaddress <name>]\n"
    325                  "                            [--faulttoleranceport <port>]\n"
    326                  "                            [--faulttolerancesyncinterval <msec>]\n"
    327                  "                            [--faulttolerancepassword <password>]\n"
    328                  );
    329 
    330         RTPrintf("\n");
     329                     "                            [--iocache on|off]\n"
     330                     "                            [--iocachesize <I/O cache size in MB>]\n"
     331#endif
     332                     "                            [--faulttolerance master|standby]\n"
     333                     "                            [--faulttoleranceaddress <name>]\n"
     334                     "                            [--faulttoleranceport <port>]\n"
     335                     "                            [--faulttolerancesyncinterval <msec>]\n"
     336                     "                            [--faulttolerancepassword <password>]\n"
     337                     "\n");
    331338    }
    332339
    333340    if (u64Cmd & USAGE_IMPORTAPPLIANCE)
    334341    {
    335         RTPrintf("VBoxManage import           <ovf> [--dry-run|-n] [more options]\n"
    336                  "                            (run with -n to have options displayed\n"
    337                  "                             for a particular OVF)\n\n");
     342        RTStrmPrintf(g_pStdErr,
     343                     "VBoxManage import           <ovf> [--dry-run|-n] [more options]\n"
     344                     "                            (run with -n to have options displayed\n"
     345                     "                             for a particular OVF)\n\n");
    338346    }
    339347
    340348    if (u64Cmd & USAGE_EXPORTAPPLIANCE)
    341349    {
    342         RTPrintf("VBoxManage export           <machines> --output|-o <ovf>\n"
    343                  "                            [--legacy09]\n"
    344                  "                            [--manifest]\n"
    345                  "                            [--vsys <number of virtual system>]\n"
    346                  "                                    [--product <product name>]\n"
    347                  "                                    [--producturl <product url>]\n"
    348                  "                                    [--vendor <vendor name>]\n"
    349                  "                                    [--vendorurl <vendor url>]\n"
    350                  "                                    [--version <version info>]\n"
    351                  "                                    [--eula <license text>]\n"
    352                  "                                    [--eulafile <filename>]\n"
    353                  "\n");
     350        RTStrmPrintf(g_pStdErr,
     351                     "VBoxManage export           <machines> --output|-o <ovf>\n"
     352                     "                            [--legacy09]\n"
     353                     "                            [--manifest]\n"
     354                     "                            [--vsys <number of virtual system>]\n"
     355                     "                                    [--product <product name>]\n"
     356                     "                                    [--producturl <product url>]\n"
     357                     "                                    [--vendor <vendor name>]\n"
     358                     "                                    [--vendorurl <vendor url>]\n"
     359                     "                                    [--version <version info>]\n"
     360                     "                                    [--eula <license text>]\n"
     361                     "                                    [--eulafile <filename>]\n"
     362                     "\n");
    354363    }
    355364
    356365    if (u64Cmd & USAGE_STARTVM)
    357366    {
    358         RTPrintf("VBoxManage startvm          <uuid>|<name>\n");
    359         RTPrintf("                            [--type gui");
     367        RTStrmPrintf(g_pStdErr,
     368                     "VBoxManage startvm          <uuid>|<name>\n");
     369        RTStrmPrintf(g_pStdErr,
     370                     "                            [--type gui");
    360371        if (fVBoxSDL)
    361             RTPrintf(                        "|sdl");
     372            RTStrmPrintf(g_pStdErr, "|sdl");
    362373        if (fVRDP)
    363             RTPrintf(                         "|vrdp");
    364         RTPrintf(                             "|headless]\n");
    365         RTPrintf("\n");
     374            RTStrmPrintf(g_pStdErr, "|vrdp");
     375        RTStrmPrintf(g_pStdErr, "|headless]\n");
     376        RTStrmPrintf(g_pStdErr,
     377                     "\n");
    366378    }
    367379
    368380    if (u64Cmd & USAGE_CONTROLVM)
    369381    {
    370         RTPrintf("VBoxManage controlvm        <uuid>|<name>\n"
    371                  "                            pause|resume|reset|poweroff|savestate|\n"
    372                  "                            acpipowerbutton|acpisleepbutton|\n"
    373                  "                            keyboardputscancode <hex> [<hex> ...]|\n"
    374                  "                            injectnmi|\n"
    375                  "                            setlinkstate<1-N> on|off |\n"
     382        RTStrmPrintf(g_pStdErr,
     383                     "VBoxManage controlvm        <uuid>|<name>\n"
     384                     "                            pause|resume|reset|poweroff|savestate|\n"
     385                     "                            acpipowerbutton|acpisleepbutton|\n"
     386                     "                            keyboardputscancode <hex> [<hex> ...]|\n"
     387                     "                            injectnmi|\n"
     388                     "                            setlinkstate<1-N> on|off |\n"
    376389#ifdef VBOX_DYNAMIC_NET_ATTACH
    377390#if defined(VBOX_WITH_NETFLT)
    378                  "                            nic<1-N> null|nat|bridged|intnet|hostonly\n"
    379                  "                                     [<devicename>] |\n"
     391                     "                            nic<1-N> null|nat|bridged|intnet|hostonly\n"
     392                     "                                     [<devicename>] |\n"
    380393#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
    381                  "                            nic<1-N> null|nat|bridged|intnet\n"
    382                  "                                     [<devicename>] |\n"
     394                     "                            nic<1-N> null|nat|bridged|intnet\n"
     395                     "                                     [<devicename>] |\n"
    383396#endif /* !RT_OS_LINUX && !RT_OS_DARWIN  */
    384                  "                            nictrace<1-N> on|off\n"
    385                  "                            nictracefile<1-N> <filename>\n"
     397                     "                            nictrace<1-N> on|off\n"
     398                     "                            nictracefile<1-N> <filename>\n"
    386399#endif /* VBOX_DYNAMIC_NET_ATTACH */
    387                  "                            guestmemoryballoon <balloonsize in MB>]\n"
    388                  "                            gueststatisticsinterval <seconds>]\n"
    389                  "                            usbattach <uuid>|<address> |\n"
    390                  "                            usbdetach <uuid>|<address> |\n");
     400                     "                            guestmemoryballoon <balloonsize in MB>]\n"
     401                     "                            gueststatisticsinterval <seconds>]\n"
     402                     "                            usbattach <uuid>|<address> |\n"
     403                     "                            usbdetach <uuid>|<address> |\n");
    391404        if (fVRDP)
    392405        {
    393             RTPrintf("                            vrdp on|off |\n");
    394             RTPrintf("                            vrdpport default|<ports> |\n"
     406            RTStrmPrintf(g_pStdErr,
     407                     "                            vrdp on|off |\n");
     408            RTStrmPrintf(g_pStdErr,
     409                     "                            vrdpport default|<ports> |\n"
    395410                     "                            vrdpvideochannelquality <percent>\n");
    396411        }
    397         RTPrintf("                            setvideomodehint <xres> <yres> <bpp> [display] |\n"
    398                  "                            setcredentials <username> <password> <domain>\n"
    399                  "                                           [--allowlocallogon <yes|no>] |\n"
    400                  "                            teleport --host <name> --port <port>\n"
    401                  "                                   [--maxdowntime <msec>] [--password password]\n"
    402                  "                            plugcpu <id>\n"
    403                  "                            unplugcpu <id>\n"
    404                  "\n");
     412        RTStrmPrintf(g_pStdErr,
     413                     "                            setvideomodehint <xres> <yres> <bpp> [display] |\n"
     414                     "                            setcredentials <username> <password> <domain>\n"
     415                     "                                           [--allowlocallogon <yes|no>] |\n"
     416                     "                            teleport --host <name> --port <port>\n"
     417                     "                                   [--maxdowntime <msec>] [--password password]\n"
     418                     "                            plugcpu <id>\n"
     419                     "                            unplugcpu <id>\n"
     420                     "\n");
    405421    }
    406422
    407423    if (u64Cmd & USAGE_DISCARDSTATE)
    408424    {
    409         RTPrintf("VBoxManage discardstate     <uuid>|<name>\n"
    410                  "\n");
     425        RTStrmPrintf(g_pStdErr,
     426                     "VBoxManage discardstate     <uuid>|<name>\n"
     427                     "\n");
    411428    }
    412429
    413430    if (u64Cmd & USAGE_ADOPTSTATE)
    414431    {
    415         RTPrintf("VBoxManage adoptstate       <uuid>|<name> <state_file>\n"
    416                  "\n");
     432        RTStrmPrintf(g_pStdErr,
     433                     "VBoxManage adoptstate       <uuid>|<name> <state_file>\n"
     434                     "\n");
    417435    }
    418436
    419437    if (u64Cmd & USAGE_SNAPSHOT)
    420438    {
    421         RTPrintf("VBoxManage snapshot         <uuid>|<name>\n"
    422                  "                            take <name> [--description <desc>] [--pause] |\n"
    423                  "                            delete <uuid>|<name> |\n"
    424                  "                            restore <uuid>|<name> |\n"
    425                  "                            restorecurrent |\n"
    426                  "                            edit <uuid>|<name>|--current\n"
    427                  "                                 [--name <name>]\n"
    428                  "                                 [--description <desc>] |\n"
    429                  "                            showvminfo <uuid>|<name>\n"
    430                  "\n");
     439        RTStrmPrintf(g_pStdErr,
     440                     "VBoxManage snapshot         <uuid>|<name>\n"
     441                     "                            take <name> [--description <desc>] [--pause] |\n"
     442                     "                            delete <uuid>|<name> |\n"
     443                     "                            restore <uuid>|<name> |\n"
     444                     "                            restorecurrent |\n"
     445                     "                            edit <uuid>|<name>|--current\n"
     446                     "                                 [--name <name>]\n"
     447                     "                                 [--description <desc>] |\n"
     448                     "                            showvminfo <uuid>|<name>\n"
     449                     "\n");
    431450    }
    432451
    433452    if (u64Cmd & USAGE_OPENMEDIUM)
    434453    {
    435         RTPrintf("VBoxManage openmedium       disk|dvd|floppy <filename>\n"
    436                  "                            [--type normal|immutable|writethrough|\n"
    437                  "                                    shareable] (disk only)\n"
    438                  "                            [--uuid <uuid>]\n"
    439                  "                            [--parentuuid <uuid>] (disk only)\n"
    440                  "\n");
     454        RTStrmPrintf(g_pStdErr,
     455                     "VBoxManage openmedium       disk|dvd|floppy <filename>\n"
     456                     "                            [--type normal|immutable|writethrough|\n"
     457                     "                                    shareable] (disk only)\n"
     458                     "                            [--uuid <uuid>]\n"
     459                     "                            [--parentuuid <uuid>] (disk only)\n"
     460                     "\n");
    441461    }
    442462
    443463    if (u64Cmd & USAGE_CLOSEMEDIUM)
    444464    {
    445         RTPrintf("VBoxManage closemedium      disk|dvd|floppy <uuid>|<filename>\n"
    446                  "                            [--delete]\n"
    447                  "\n");
     465        RTStrmPrintf(g_pStdErr,
     466                     "VBoxManage closemedium      disk|dvd|floppy <uuid>|<filename>\n"
     467                     "                            [--delete]\n"
     468                     "\n");
    448469    }
    449470
    450471    if (u64Cmd & USAGE_STORAGEATTACH)
    451472    {
    452         RTPrintf("VBoxManage storageattach    <uuid|vmname>\n"
    453                  "                            --storagectl <name>\n"
    454                  "                            --port <number>\n"
    455                  "                            --device <number>\n"
    456                  "                            [--type dvddrive|hdd|fdd]\n"
    457                  "                            [--medium none|emptydrive|\n"
    458                  "                                      <uuid>|<filename>|host:<drive>]\n"
    459                  "                            [--passthrough on|off]\n"
    460                  "                            [--forceunmount]\n"
    461                  "\n");
     473        RTStrmPrintf(g_pStdErr,
     474                     "VBoxManage storageattach    <uuid|vmname>\n"
     475                     "                            --storagectl <name>\n"
     476                     "                            --port <number>\n"
     477                     "                            --device <number>\n"
     478                     "                            [--type dvddrive|hdd|fdd]\n"
     479                     "                            [--medium none|emptydrive|\n"
     480                     "                                      <uuid>|<filename>|host:<drive>]\n"
     481                     "                            [--passthrough on|off]\n"
     482                     "                            [--forceunmount]\n"
     483                     "\n");
    462484    }
    463485
    464486    if (u64Cmd & USAGE_STORAGECONTROLLER)
    465487    {
    466         RTPrintf("VBoxManage storagectl       <uuid|vmname>\n"
    467                  "                            --name <name>\n"
    468                  "                            [--add ide|sata|scsi|floppy|sas]\n"
    469                  "                            [--controller LSILogic|LSILogicSAS|BusLogic|\n"
    470                  "                                          IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
    471                  "                            [--sataideemulation<1-4> <1-30>]\n"
    472                  "                            [--sataportcount <1-30>]\n"
    473                  "                            [--hostiocache on|off]\n"
    474                  "                            [--remove]\n"
    475                  "\n");
     488        RTStrmPrintf(g_pStdErr,
     489                     "VBoxManage storagectl       <uuid|vmname>\n"
     490                     "                            --name <name>\n"
     491                     "                            [--add ide|sata|scsi|floppy|sas]\n"
     492                     "                            [--controller LSILogic|LSILogicSAS|BusLogic|\n"
     493                     "                                          IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
     494                     "                            [--sataideemulation<1-4> <1-30>]\n"
     495                     "                            [--sataportcount <1-30>]\n"
     496                     "                            [--hostiocache on|off]\n"
     497                     "                            [--remove]\n"
     498                     "\n");
    476499    }
    477500
    478501    if (u64Cmd & USAGE_SHOWHDINFO)
    479502    {
    480         RTPrintf("VBoxManage showhdinfo       <uuid>|<filename>\n"
    481                  "\n");
     503        RTStrmPrintf(g_pStdErr,
     504                     "VBoxManage showhdinfo       <uuid>|<filename>\n"
     505                     "\n");
    482506    }
    483507
    484508    if (u64Cmd & USAGE_CREATEHD)
    485509    {
    486         RTPrintf("VBoxManage createhd         --filename <filename>\n"
    487                  "                            --size <megabytes>|--sizebyte <bytes>\n"
    488                  "                            [--format VDI|VMDK|VHD] (default: VDI)\n"
    489                  "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
    490                  "                            [--type normal|writethrough|\n"
    491                  "                                    shareable] (default: normal)\n"
    492                  "                            [--comment <comment>]\n"
    493                  "                            [--remember]\n"
    494                  "\n");
     510        RTStrmPrintf(g_pStdErr,
     511                     "VBoxManage createhd         --filename <filename>\n"
     512                     "                            --size <megabytes>|--sizebyte <bytes>\n"
     513                     "                            [--format VDI|VMDK|VHD] (default: VDI)\n"
     514                     "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
     515                     "                            [--type normal|writethrough|\n"
     516                     "                                    shareable] (default: normal)\n"
     517                     "                            [--comment <comment>]\n"
     518                     "                            [--remember]\n"
     519                     "\n");
    495520    }
    496521
    497522    if (u64Cmd & USAGE_MODIFYHD)
    498523    {
    499         RTPrintf("VBoxManage modifyhd         <uuid>|<filename>\n"
    500                  "                            [--type normal|writethrough|immutable|shareable]\n"
    501                  "                            [--autoreset on|off]\n"
    502                  "                            [--compact]\n"
    503                  "                            [--resize <megabytes>]\n"
    504                  "\n");
     524        RTStrmPrintf(g_pStdErr,
     525                     "VBoxManage modifyhd         <uuid>|<filename>\n"
     526                     "                            [--type normal|writethrough|immutable|shareable]\n"
     527                     "                            [--autoreset on|off]\n"
     528                     "                            [--compact]\n"
     529                     "                            [--resize <megabytes>]\n"
     530                     "\n");
    505531    }
    506532
    507533    if (u64Cmd & USAGE_CLONEHD)
    508534    {
    509         RTPrintf("VBoxManage clonehd          <uuid>|<filename> <outputfile>\n"
    510                  "                            [--format VDI|VMDK|VHD|RAW|<other>]\n"
    511                  "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
    512                  "                            [--type normal|writethrough|immutable|shareable]\n"
    513                  "                            [--remember] [--existing]\n"
    514                  "\n");
     535        RTStrmPrintf(g_pStdErr,
     536                     "VBoxManage clonehd          <uuid>|<filename> <outputfile>\n"
     537                     "                            [--format VDI|VMDK|VHD|RAW|<other>]\n"
     538                     "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
     539                     "                            [--type normal|writethrough|immutable|shareable]\n"
     540                     "                            [--remember] [--existing]\n"
     541                     "\n");
    515542    }
    516543
    517544    if (u64Cmd & USAGE_CONVERTFROMRAW)
    518545    {
    519         RTPrintf("VBoxManage convertfromraw   <filename> <outputfile>\n"
    520                  "                            [--format VDI|VMDK|VHD]\n"
    521                  "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
     546        RTStrmPrintf(g_pStdErr,
     547                     "VBoxManage convertfromraw   <filename> <outputfile>\n"
     548                     "                            [--format VDI|VMDK|VHD]\n"
     549                     "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
    522550#ifndef RT_OS_WINDOWS
    523                  "VBoxManage convertfromraw   stdin <outputfile> <bytes>\n"
    524                  "                            [--format VDI|VMDK|VHD]\n"
    525                  "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
    526 #endif
    527                  "\n");
     551                     "VBoxManage convertfromraw   stdin <outputfile> <bytes>\n"
     552                     "                            [--format VDI|VMDK|VHD]\n"
     553                     "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
     554#endif
     555                     "\n");
    528556    }
    529557
    530558    if (u64Cmd & USAGE_ADDISCSIDISK)
    531559    {
    532         RTPrintf("VBoxManage addiscsidisk     --server <name>|<ip>\n"
    533                  "                            --target <target>\n"
    534                  "                            [--port <port>]\n"
    535                  "                            [--lun <lun>]\n"
    536                  "                            [--encodedlun <lun>]\n"
    537                  "                            [--username <username>]\n"
    538                  "                            [--password <password>]\n"
    539                  "                            [--type normal|writethrough|immutable|shareable]\n"
    540                  "                            [--intnet]\n"
    541                  "\n");
     560        RTStrmPrintf(g_pStdErr,
     561                     "VBoxManage addiscsidisk     --server <name>|<ip>\n"
     562                     "                            --target <target>\n"
     563                     "                            [--port <port>]\n"
     564                     "                            [--lun <lun>]\n"
     565                     "                            [--encodedlun <lun>]\n"
     566                     "                            [--username <username>]\n"
     567                     "                            [--password <password>]\n"
     568                     "                            [--type normal|writethrough|immutable|shareable]\n"
     569                     "                            [--intnet]\n"
     570                     "\n");
    542571    }
    543572
    544573    if (u64Cmd & USAGE_GETEXTRADATA)
    545574    {
    546         RTPrintf("VBoxManage getextradata     global|<uuid>|<name>\n"
    547                  "                            <key>|enumerate\n"
    548                  "\n");
     575        RTStrmPrintf(g_pStdErr,
     576                     "VBoxManage getextradata     global|<uuid>|<name>\n"
     577                     "                            <key>|enumerate\n"
     578                     "\n");
    549579    }
    550580
    551581    if (u64Cmd & USAGE_SETEXTRADATA)
    552582    {
    553         RTPrintf("VBoxManage setextradata     global|<uuid>|<name>\n"
    554                  "                            <key>\n"
    555                  "                            [<value>] (no value deletes key)\n"
    556                  "\n");
     583        RTStrmPrintf(g_pStdErr,
     584                     "VBoxManage setextradata     global|<uuid>|<name>\n"
     585                     "                            <key>\n"
     586                     "                            [<value>] (no value deletes key)\n"
     587                     "\n");
    557588    }
    558589
    559590    if (u64Cmd & USAGE_SETPROPERTY)
    560591    {
    561         RTPrintf("VBoxManage setproperty      hdfolder default|<folder> |\n"
    562                  "                            machinefolder default|<folder> |\n"
    563                  "                            vrdpauthlibrary default|<library> |\n"
    564                  "                            websrvauthlibrary default|null|<library> |\n"
    565                  "                            loghistorycount <value>\n"
    566                  "\n");
     592        RTStrmPrintf(g_pStdErr,
     593                     "VBoxManage setproperty      hdfolder default|<folder> |\n"
     594                     "                            machinefolder default|<folder> |\n"
     595                     "                            vrdpauthlibrary default|<library> |\n"
     596                     "                            websrvauthlibrary default|null|<library> |\n"
     597                     "                            loghistorycount <value>\n"
     598                     "\n");
    567599    }
    568600
    569601    if (u64Cmd & USAGE_USBFILTER_ADD)
    570602    {
    571         RTPrintf("VBoxManage usbfilter        add <index,0-N>\n"
    572                  "                            --target <uuid>|<name>|global\n"
    573                  "                            --name <string>\n"
    574                  "                            --action ignore|hold (global filters only)\n"
    575                  "                            [--active yes|no] (yes)\n"
    576                  "                            [--vendorid <XXXX>] (null)\n"
    577                  "                            [--productid <XXXX>] (null)\n"
    578                  "                            [--revision <IIFF>] (null)\n"
    579                  "                            [--manufacturer <string>] (null)\n"
    580                  "                            [--product <string>] (null)\n"
    581                  "                            [--remote yes|no] (null, VM filters only)\n"
    582                  "                            [--serialnumber <string>] (null)\n"
    583                  "                            [--maskedinterfaces <XXXXXXXX>]\n"
    584                  "\n");
     603        RTStrmPrintf(g_pStdErr,
     604                     "VBoxManage usbfilter        add <index,0-N>\n"
     605                     "                            --target <uuid>|<name>|global\n"
     606                     "                            --name <string>\n"
     607                     "                            --action ignore|hold (global filters only)\n"
     608                     "                            [--active yes|no] (yes)\n"
     609                     "                            [--vendorid <XXXX>] (null)\n"
     610                     "                            [--productid <XXXX>] (null)\n"
     611                     "                            [--revision <IIFF>] (null)\n"
     612                     "                            [--manufacturer <string>] (null)\n"
     613                     "                            [--product <string>] (null)\n"
     614                     "                            [--remote yes|no] (null, VM filters only)\n"
     615                     "                            [--serialnumber <string>] (null)\n"
     616                     "                            [--maskedinterfaces <XXXXXXXX>]\n"
     617                     "\n");
    585618    }
    586619
    587620    if (u64Cmd & USAGE_USBFILTER_MODIFY)
    588621    {
    589         RTPrintf("VBoxManage usbfilter        modify <index,0-N>\n"
    590                  "                            --target <uuid>|<name>|global\n"
    591                  "                            [--name <string>]\n"
    592                  "                            [--action ignore|hold] (global filters only)\n"
    593                  "                            [--active yes|no]\n"
    594                  "                            [--vendorid <XXXX>|\"\"]\n"
    595                  "                            [--productid <XXXX>|\"\"]\n"
    596                  "                            [--revision <IIFF>|\"\"]\n"
    597                  "                            [--manufacturer <string>|\"\"]\n"
    598                  "                            [--product <string>|\"\"]\n"
    599                  "                            [--remote yes|no] (null, VM filters only)\n"
    600                  "                            [--serialnumber <string>|\"\"]\n"
    601                  "                            [--maskedinterfaces <XXXXXXXX>]\n"
    602                  "\n");
     622        RTStrmPrintf(g_pStdErr,
     623                     "VBoxManage usbfilter        modify <index,0-N>\n"
     624                     "                            --target <uuid>|<name>|global\n"
     625                     "                            [--name <string>]\n"
     626                     "                            [--action ignore|hold] (global filters only)\n"
     627                     "                            [--active yes|no]\n"
     628                     "                            [--vendorid <XXXX>|\"\"]\n"
     629                     "                            [--productid <XXXX>|\"\"]\n"
     630                     "                            [--revision <IIFF>|\"\"]\n"
     631                     "                            [--manufacturer <string>|\"\"]\n"
     632                     "                            [--product <string>|\"\"]\n"
     633                     "                            [--remote yes|no] (null, VM filters only)\n"
     634                     "                            [--serialnumber <string>|\"\"]\n"
     635                     "                            [--maskedinterfaces <XXXXXXXX>]\n"
     636                     "\n");
    603637    }
    604638
    605639    if (u64Cmd & USAGE_USBFILTER_REMOVE)
    606640    {
    607         RTPrintf("VBoxManage usbfilter        remove <index,0-N>\n"
    608                  "                            --target <uuid>|<name>|global\n"
    609                  "\n");
     641        RTStrmPrintf(g_pStdErr,
     642                     "VBoxManage usbfilter        remove <index,0-N>\n"
     643                     "                            --target <uuid>|<name>|global\n"
     644                     "\n");
    610645    }
    611646
    612647    if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
    613648    {
    614         RTPrintf("VBoxManage sharedfolder     add <vmname>|<uuid>\n"
    615                  "                            --name <name> --hostpath <hostpath>\n"
    616                  "                            [--transient] [--readonly] [--automount]\n"
    617                  "\n");
     649        RTStrmPrintf(g_pStdErr,
     650                     "VBoxManage sharedfolder     add <vmname>|<uuid>\n"
     651                     "                            --name <name> --hostpath <hostpath>\n"
     652                     "                            [--transient] [--readonly] [--automount]\n"
     653                     "\n");
    618654    }
    619655
    620656    if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
    621657    {
    622         RTPrintf("VBoxManage sharedfolder     remove <vmname>|<uuid>\n"
    623                  "                            --name <name> [--transient]\n"
    624                  "\n");
     658        RTStrmPrintf(g_pStdErr,
     659                     "VBoxManage sharedfolder     remove <vmname>|<uuid>\n"
     660                     "                            --name <name> [--transient]\n"
     661                     "\n");
    625662    }
    626663
    627664    if (u64Cmd & USAGE_VM_STATISTICS)
    628665    {
    629         RTPrintf("VBoxManage vmstatistics     <vmname>|<uuid> [--reset]\n"
    630                  "                            [--pattern <pattern>] [--descriptions]\n"
    631                  "\n");
     666        RTStrmPrintf(g_pStdErr,
     667                     "VBoxManage vmstatistics     <vmname>|<uuid> [--reset]\n"
     668                     "                            [--pattern <pattern>] [--descriptions]\n"
     669                     "\n");
    632670    }
    633671
     
    644682    if (u64Cmd & USAGE_METRICS)
    645683    {
    646         RTPrintf("VBoxManage metrics          list [*|host|<vmname> [<metric_list>]]\n"
    647                  "                                                 (comma-separated)\n\n"
    648                  "VBoxManage metrics          setup\n"
    649                  "                            [--period <seconds>] (default: 1)\n"
    650                  "                            [--samples <count>] (default: 1)\n"
    651                  "                            [--list]\n"
    652                  "                            [*|host|<vmname> [<metric_list>]]\n\n"
    653                  "VBoxManage metrics          query [*|host|<vmname> [<metric_list>]]\n\n"
    654                  "VBoxManage metrics          enable\n"
    655                  "                            [--list]\n"
    656                  "                            [*|host|<vmname> [<metric_list>]]\n\n"
    657                  "VBoxManage metrics          disable\n"
    658                  "                            [--list]\n"
    659                  "                            [*|host|<vmname> [<metric_list>]]\n\n"
    660                  "VBoxManage metrics          collect\n"
    661                  "                            [--period <seconds>] (default: 1)\n"
    662                  "                            [--samples <count>] (default: 1)\n"
    663                  "                            [--list]\n"
    664                  "                            [--detach]\n"
    665                  "                            [*|host|<vmname> [<metric_list>]]\n"
    666                  "\n");
     684        RTStrmPrintf(g_pStdErr,
     685                     "VBoxManage metrics          list [*|host|<vmname> [<metric_list>]]\n"
     686                     "                                                 (comma-separated)\n\n"
     687                     "VBoxManage metrics          setup\n"
     688                     "                            [--period <seconds>] (default: 1)\n"
     689                     "                            [--samples <count>] (default: 1)\n"
     690                     "                            [--list]\n"
     691                     "                            [*|host|<vmname> [<metric_list>]]\n\n"
     692                     "VBoxManage metrics          query [*|host|<vmname> [<metric_list>]]\n\n"
     693                     "VBoxManage metrics          enable\n"
     694                     "                            [--list]\n"
     695                     "                            [*|host|<vmname> [<metric_list>]]\n\n"
     696                     "VBoxManage metrics          disable\n"
     697                     "                            [--list]\n"
     698                     "                            [*|host|<vmname> [<metric_list>]]\n\n"
     699                     "VBoxManage metrics          collect\n"
     700                     "                            [--period <seconds>] (default: 1)\n"
     701                     "                            [--samples <count>] (default: 1)\n"
     702                     "                            [--list]\n"
     703                     "                            [--detach]\n"
     704                     "                            [*|host|<vmname> [<metric_list>]]\n"
     705                     "\n");
    667706    }
    668707#if defined(VBOX_WITH_NETFLT)
    669708    if (u64Cmd & USAGE_HOSTONLYIFS)
    670709    {
    671         RTPrintf("VBoxManage hostonlyif       ipconfig <name>\n"
    672                  "                            [--dhcp |\n"
    673                  "                            --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
    674                  "                            --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
     710        RTStrmPrintf(g_pStdErr,
     711                     "VBoxManage hostonlyif       ipconfig <name>\n"
     712                     "                            [--dhcp |\n"
     713                     "                            --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
     714                     "                            --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
    675715# if defined(RT_OS_WINDOWS)
    676                  "                            create |\n"
    677                  "                            remove <name>\n"
     716                     "                            create |\n"
     717                     "                            remove <name>\n"
    678718# endif
    679                  "\n");
     719                     "\n");
    680720    }
    681721#endif
     
    683723    if (u64Cmd & USAGE_DHCPSERVER)
    684724    {
    685         RTPrintf("VBoxManage dhcpserver       add|modify --netname <network_name> |\n"
     725        RTStrmPrintf(g_pStdErr,
     726                     "VBoxManage dhcpserver       add|modify --netname <network_name> |\n"
    686727#if defined(VBOX_WITH_NETFLT)
    687                  "                                       --ifname <hostonly_if_name>\n"
    688 #endif
    689                  "                                [--ip <ip_address>\n"
    690                  "                                 --netmask <network_mask>\n"
    691                  "                                 --lowerip <lower_ip>\n"
    692                  "                                 --upperip <upper_ip>]\n"
    693                  "                                [--enable | --disable]\n\n"
    694                  "VBoxManage dhcpserver       remove --netname <network_name> |\n"
     728                     "                                       --ifname <hostonly_if_name>\n"
     729#endif
     730                     "                                [--ip <ip_address>\n"
     731                     "                                 --netmask <network_mask>\n"
     732                     "                                 --lowerip <lower_ip>\n"
     733                     "                                 --upperip <upper_ip>]\n"
     734                     "                                [--enable | --disable]\n\n"
     735                     "VBoxManage dhcpserver       remove --netname <network_name> |\n"
    695736#if defined(VBOX_WITH_NETFLT)
    696                  "                                   --ifname <hostonly_if_name>\n"
    697 #endif
    698                  "\n");
     737                     "                                   --ifname <hostonly_if_name>\n"
     738#endif
     739                     "\n");
    699740    }
    700741}
     
    714755#endif /* !VBOX_ONLY_DOCS */
    715756    va_start(args, pszFormat);
    716     RTPrintf("\n"
    717              "Syntax error: %N\n", pszFormat, &args);
     757    RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
    718758    va_end(args);
    719759    return 1;
     
    740780
    741781    if (rc == VINF_GETOPT_NOT_OPTION)
    742         return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
     782        return RTMsgError("Invalid parameter '%s'", pValueUnion->psz);
    743783    if (rc > 0)
    744784    {
    745785        if (RT_C_IS_PRINT(rc))
    746             return RTPrintf("error: Invalid option -%c\n", rc);
    747         return RTPrintf("error: Invalid option case %i\n", rc);
     786            return RTMsgError("Invalid option -%c", rc);
     787        return RTMsgError("Invalid option case %i", rc);
    748788    }
    749789    if (rc == VERR_GETOPT_UNKNOWN_OPTION)
    750         return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
     790        return RTMsgError("Unknown option: %s", pValueUnion->psz);
    751791    if (pValueUnion->pDef)
    752         return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
    753     return RTPrintf("error: %Rrs\n", rc);
     792        return RTMsgError("%s: %Rrs", pValueUnion->pDef->pszLong, rc);
     793    return RTMsgError("%Rrs", rc);
    754794}
    755795
     
    761801    va_list args;
    762802    va_start(args, pszFormat);
    763     RTPrintf("error: %N\n", pszFormat, &args);
     803    RTMsgError(pszFormat, args);
    764804    va_end(args);
    765805    return 1;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp

    r31539 r32701  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727
    2828#include <VBox/com/VirtualBox.h>
    29 
    30 #include <vector>
    31 #include <list>
    3229#endif /* !VBOX_ONLY_DOCS */
    3330
     
    7370        com::ProgressErrorInfo info(progress);
    7471        if (info.isBasicAvailable())
    75             RTPrintf("Error: failed to create the host-only adapter. Error message: %lS\n", info.getText().raw());
     72            RTMsgError("Failed to create the host-only adapter. Error message: %lS", info.getText().raw());
    7673        else
    77             RTPrintf("Error: failed to create the host-only adapter. No error message available, HRESULT code: 0x%x\n", rc);
     74            RTMsgError("Failed to create the host-only adapter. No error message available, code: %Rhrc", rc);
    7875
    7976        return 1;
     
    117114        com::ProgressErrorInfo info(progress);
    118115        if (info.isBasicAvailable())
    119             RTPrintf("Error: failed to remove the host-only adapter. Error message: %lS\n", info.getText().raw());
     116            RTMsgError("Failed to remove the host-only adapter. Error message: %lS", info.getText().raw());
    120117        else
    121             RTPrintf("Error: failed to remove the host-only adapter. No error message available, HRESULT code: 0x%x\n", rc);
     118            RTMsgError("Failed to remove the host-only adapter. No error message available, code: %Rhrc", rc);
    122119
    123120        return 1;
     
    262259        if (!bIpV6Supported)
    263260        {
    264             RTPrintf("IPv6 setting is not supported for this adapter\n");
     261            RTMsgError("IPv6 setting is not supported for this adapter");
    265262            return 1;
    266263        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp

    r32448 r32701  
    55
    66/*
    7  * Copyright (C) 2009 Oracle Corporation
     7 * Copyright (C) 2009-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    265265        // call interpret(); this can yield both warnings and errors, so we need
    266266        // to tinker with the error info a bit
    267         RTPrintf("Interpreting %ls...\n", path.raw());
     267        RTStrmPrintf(g_pStdErr, "Interpreting %ls...\n", path.raw());
    268268        rc = pAppliance->Interpret();
    269269        com::ErrorInfo info0(pAppliance, COM_IIDOF(IAppliance));
     
    276276            {
    277277                Bstr bstrWarning(aWarnings[i]);
    278                 RTPrintf("WARNING: %ls.\n", bstrWarning.raw());
     278                RTMsgWarning("%ls.", bstrWarning.raw());
    279279            }
    280280        }
     
    287287        }
    288288
    289         RTPrintf("OK.\n");
     289        RTStrmPrintf(g_pStdErr, "OK.\n");
    290290
    291291        // fetch all disks
     
    693693
    694694            if (cLicensesInTheWay == 1)
    695                 RTPrintf("ERROR: Cannot import until the license agreement listed above is accepted.\n");
     695                RTMsgError("Cannot import until the license agreement listed above is accepted.");
    696696            else if (cLicensesInTheWay > 1)
    697                 RTPrintf("ERROR: Cannot import until the %c license agreements listed above are accepted.\n", cLicensesInTheWay);
     697                RTMsgError("Cannot import until the %c license agreements listed above are accepted.", cLicensesInTheWay);
    698698
    699699            if (!cLicensesInTheWay && fExecute)
     
    935935                        else
    936936                        {
    937                             RTPrintf("ERROR: Cannot read license file \"%s\" which should be included in the virtual system %u.\n",
    938                                      itD->second.c_str(),
    939                                      i);
     937                            RTMsgError("Cannot read license file \"%s\" which should be included in the virtual system %u.",
     938                                       itD->second.c_str(), i);
    940939                            return 1;
    941940                        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r32086 r32701  
    10931093                             ulIOBase, ulIRQ);
    10941094                else
    1095                     RTPrintf("UART %d:          I/O base: 0x%04x, IRQ: %d",
     1095                    RTPrintf("UART %d:          I/O base: %#06x, IRQ: %d",
    10961096                             currentUART + 1, ulIOBase, ulIRQ);
    10971097                switch (HostMode)
     
    14941494                        CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces) (&fMaskedIfs), rc);
    14951495                        if (fMaskedIfs)
    1496                             RTPrintf("Masked Interfaces: 0x%08x\n", fMaskedIfs);
     1496                            RTPrintf("Masked Interfaces: %#010x\n", fMaskedIfs);
    14971497                        RTPrintf("\n");
    14981498                    }
     
    15431543                        else
    15441544                            RTPrintf("UUID:               %S\n"
    1545                                      "VendorId:           0x%04x (%04X)\n"
    1546                                      "ProductId:          0x%04x (%04X)\n"
     1545                                     "VendorId:           %#06x (%04X)\n"
     1546                                     "ProductId:          %#06x (%04X)\n"
    15471547                                     "Revision:           %u.%u (%02u%02u)\n",
    15481548                                     Utf8Str(id).c_str(),
     
    16321632                        else
    16331633                            RTPrintf("UUID:               %S\n"
    1634                                      "VendorId:           0x%04x (%04X)\n"
    1635                                      "ProductId:          0x%04x (%04X)\n"
     1634                                     "VendorId:           %#06x (%04X)\n"
     1635                                     "ProductId:          %#06x (%04X)\n"
    16361636                                     "Revision:           %u.%u (%02u%02u)\n",
    16371637                                     Utf8Str(id).c_str(),
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r32531 r32701  
    703703
    704704                    RTPrintf("UUID:               %S\n"
    705                             "VendorId:           0x%04x (%04X)\n"
    706                             "ProductId:          0x%04x (%04X)\n"
    707                             "Revision:           %u.%u (%02u%02u)\n",
    708                             Utf8Str(id).c_str(),
    709                             usVendorId, usVendorId, usProductId, usProductId,
    710                             bcdRevision >> 8, bcdRevision & 0xff,
    711                             bcdRevision >> 8, bcdRevision & 0xff);
     705                             "VendorId:           %#06x (%04X)\n"
     706                             "ProductId:          %#06x (%04X)\n"
     707                             "Revision:           %u.%u (%02u%02u)\n",
     708                             Utf8Str(id).c_str(),
     709                             usVendorId, usVendorId, usProductId, usProductId,
     710                             bcdRevision >> 8, bcdRevision & 0xff,
     711                             bcdRevision >> 8, bcdRevision & 0xff);
    712712
    713713                    /* optional stuff. */
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp

    r28800 r32701  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    176176    else
    177177    {
    178         RTPrintf("No metrics match the specified filter!\n");
     178        RTMsgError("No metrics match the specified filter!");
    179179    }
    180180}
    181181
    182182/**
    183  * list                                                               *
     183 * list
    184184 */
    185185static int handleMetricsList(int argc, char *argv[],
     
    465465    if (isDetached)
    466466    {
    467         RTPrintf("Warning! The background process holding collected metrics will shutdown\n"
    468                  "in few seconds, discarding all collected data and parameters.\n");
     467        RTMsgWarning("The background process holding collected metrics will shutdown\n"
     468                     "in few seconds, discarding all collected data and parameters.");
    469469        return 0;
    470470    }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r31595 r32701  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030
    3131#include <VBox/com/VirtualBox.h>
    32 
    33 #include <vector>
    34 #include <list>
    3532#endif /* !VBOX_ONLY_DOCS */
    3633
     
    8077        if (RT_FAILURE(vrc))
    8178        {
    82             RTPrintf("Cannot convert filename \"%s\" to absolute path\n", a->argv[0]);
     79            RTMsgError("Cannot convert filename \"%s\" to absolute path", a->argv[0]);
    8380            return 1;
    8481        }
     
    231228            return errorSyntax(USAGE_CREATEVM, "Invalid parameter '%s'", Utf8Str(a->argv[i]).c_str());
    232229    }
    233     if (!name)
     230
     231    /* check for required options */
     232    if (name)
    234233        return errorSyntax(USAGE_CREATEVM, "Parameter --name is required");
    235234
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r31991 r32701  
    2727
    2828#include <VBox/com/VirtualBox.h>
    29 
    30 #include <vector>
    31 #include <list>
    3229#endif /* !VBOX_ONLY_DOCS */
    3330
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp

    r31539 r32701  
    315315                com::ProgressErrorInfo info(progress);
    316316                if (info.isBasicAvailable())
    317                     RTPrintf("Error: failed to take snapshot. Error message: %lS\n", info.getText().raw());
     317                    RTMsgError("Failed to take snapshot. Error message: %lS", info.getText().raw());
    318318                else
    319                     RTPrintf("Error: failed to take snapshot. No error message available!\n");
     319                    RTMsgError("Failed to take snapshot. No error message available!");
    320320            }
    321321
     
    393393                com::ProgressErrorInfo info(pProgress);
    394394                if (info.isBasicAvailable())
    395                     RTPrintf("Error: snapshot operation failed. Error message: %lS\n", info.getText().raw());
     395                    RTMsgError("Snapshot operation failed. Error message: %lS", info.getText().raw());
    396396                else
    397                     RTPrintf("Error: snapshot operation failed. No error message available!\n");
     397                    RTMsgError("Snapshot operation failed. No error message available!");
    398398            }
    399399        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette