VirtualBox

Changeset 39385 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Nov 21, 2011 3:01:15 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74984
Message:

VBoxService/Toolbox: Added support for/fixed binary parseable streams.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r39069 r39385  
    144144
    145145/**
     146 * Initializes the parseable stream(s).
     147 *
     148 * @return  IPRT status code.
     149 */
     150static int VBoxServiceToolboxStrmInit(void)
     151{
     152    /* Set stdout's mode to binary. This is required for outputting all the machine-readable
     153     * data correctly. */
     154    int rc = RTStrmSetMode(g_pStdOut, 1 /* Binary mode */, -1 /* Current code set, not changed */);
     155    if (RT_FAILURE(rc))
     156        RTMsgError("Unable to set stdout to binary mode, rc=%Rrc\n", rc);
     157
     158    return rc;
     159}
     160
     161
     162/**
    146163 * Prints a parseable stream header which contains the actual tool
    147164 * which was called/used along with its stream version.
     
    157174}
    158175
     176
    159177/**
    160178 * Prints a standardized termination sequence indicating that the
     
    166184    RTPrintf("%c%c%c%c", 0, 0, 0, 0);
    167185}
     186
    168187
    169188/**
     
    833852        /* Print magic/version. */
    834853        if (fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE)
     854        {
     855            rc = VBoxServiceToolboxStrmInit();
     856            if (RT_FAILURE(rc))
     857                RTMsgError("Error while initializing parseable streams, rc=%Rrc\n", rc);
    835858            VBoxServiceToolboxPrintStrmHeader("vbt_ls", 1 /* Stream version */);
     859        }
    836860
    837861        PVBOXSERVICETOOLBOXPATHENTRY pNodeIt;
     
    10681092    {
    10691093        if (fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE) /* Output termination. */
     1094        {
     1095            rc = VBoxServiceToolboxStrmInit();
     1096            if (RT_FAILURE(rc))
     1097                RTMsgError("Error while initializing parseable streams, rc=%Rrc\n", rc);
    10701098            VBoxServiceToolboxPrintStrmHeader("vbt_stat", 1 /* Stream version */);
     1099        }
    10711100
    10721101        PVBOXSERVICETOOLBOXPATHENTRY pNodeIt;
Note: See TracChangeset for help on using the changeset viewer.

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