Index: /trunk/src/VBox/Runtime/tools/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Runtime/tools/Makefile.kmk	(revision 66594)
+++ /trunk/src/VBox/Runtime/tools/Makefile.kmk	(revision 66595)
@@ -46,4 +46,9 @@
 
  # RTManifest is a tool for creating and verifying manifest files.
+ PROGRAMS += RTCat
+ RTCat_TEMPLATE = VBoxR3Tool
+ RTCat_SOURCES = RTCat.cpp
+
+ # RTRm is a tool for removing files and directories.
  PROGRAMS += RTRm
  RTRm_TEMPLATE = VBoxR3Tool
Index: /trunk/src/VBox/Runtime/tools/RTCat.cpp
===================================================================
--- /trunk/src/VBox/Runtime/tools/RTCat.cpp	(revision 66595)
+++ /trunk/src/VBox/Runtime/tools/RTCat.cpp	(revision 66595)
@@ -0,0 +1,316 @@
+/* $Id$ */
+/** @file
+ * IPRT - cat like utility.
+ */
+
+/*
+ * Copyright (C) 2017 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/vfs.h>
+
+#include <iprt/buildconfig.h>
+#include <iprt/file.h>
+#include <iprt/getopt.h>
+#include <iprt/initterm.h>
+#include <iprt/message.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * CAT command options.
+ */
+typedef struct RTCMDCATOPTS
+{
+    bool fShowEnds;                 /**< -E */
+    bool fShowNonPrinting;          /**< -v */
+    bool fShowTabs;                 /**< -T */
+    bool fSqueezeBlankLines;        /**< -s */
+    bool fNumberLines;              /**< -n */
+    bool fNumberNonBlankLines;      /**< -b */
+    bool fAdvisoryOutputLock;       /**< -l */
+    bool fUnbufferedOutput;         /**< -u */
+} RTCMDCATOPTS;
+/** Pointer to const CAT options. */
+typedef RTCMDCATOPTS const *PCRTCMDCATOPTS;
+
+
+
+/**
+ * Outputs the source raw.
+ *
+ * @returns Command exit, error messages written using RTMsg*.
+ * @param   hVfsOutput          The output I/O stream.
+ * @param   hVfsSrc             The input I/O stream.
+ * @param   pszSrc              The input name.
+ */
+static RTEXITCODE rtCmdCatShowRaw(RTVFSIOSTREAM hVfsOutput, RTVFSIOSTREAM hVfsSrc, const char *pszSrc)
+{
+    int rc = RTVfsUtilPumpIoStreams(hVfsSrc, hVfsOutput, 0 /*cbBufHint*/);
+    if (RT_SUCCESS(rc))
+        return RTEXITCODE_SUCCESS;
+    return RTMsgErrorExitFailure("Error catting '%s': %Rrc", pszSrc, rc);
+}
+
+
+/**
+ * Outputs the source with complicated formatting.
+ *
+ * @returns Command exit, error messages written using RTMsg*.
+ * @param   hVfsOutput          The output I/O stream.
+ * @param   hVfsSrc             The input I/O stream.
+ * @param   pszSrc              The input name.
+ */
+static RTEXITCODE rtCmdCatShowComplicated(RTVFSIOSTREAM hVfsOutput, RTVFSIOSTREAM hVfsSrc, const char *pszSrc,
+                                          PCRTCMDCATOPTS pOpts)
+{
+    if (pOpts->fShowEnds)
+        RTMsgWarning("--show-ends is not implemented\n");
+    if (pOpts->fShowTabs)
+        RTMsgWarning("--show-tabs is not implemented\n");
+    if (pOpts->fShowNonPrinting)
+        RTMsgWarning("--show-nonprinting is not implemented\n");
+    if (pOpts->fSqueezeBlankLines)
+        RTMsgWarning("--squeeze-blank is not implemented\n");
+    if (pOpts->fNumberLines)
+        RTMsgWarning("--number is not implemented\n");
+    if (pOpts->fNumberNonBlankLines)
+        RTMsgWarning("--number-nonblank is not implemented\n");
+    return rtCmdCatShowRaw(hVfsOutput, hVfsSrc, pszSrc);
+}
+
+
+/**
+ * Opens the input file.
+ *
+ * @returns Command exit, error messages written using RTMsg*.
+ *
+ * @param   pszFile             The input filename.
+ * @param   phVfsIos            Where to return the input stream handle.
+ */
+static RTEXITCODE rtCmdCatOpenInput(const char *pszFile, PRTVFSIOSTREAM phVfsIos)
+{
+    int rc;
+
+    if (!strcmp(pszFile, "-"))
+    {
+        rc = RTVfsIoStrmFromStdHandle(RTHANDLESTD_INPUT,
+                                      RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,
+                                      true /*fLeaveOpen*/,
+                                      phVfsIos);
+        if (RT_FAILURE(rc))
+            return RTMsgErrorExitFailure("Error opening standard input: %Rrc", rc);
+    }
+    else
+    {
+        const char *pszError;
+        rc = RTVfsChainOpenIoStream(pszFile, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE, phVfsIos, &pszError);
+        if (RT_FAILURE(rc))
+        {
+            if (pszError && *pszError)
+                return RTMsgErrorExit(RTEXITCODE_FAILURE,
+                                      "RTVfsChainOpenIoStream failed with rc=%Rrc:\n"
+                                      "    '%s'\n"
+                                      "     %*s^\n",
+                                      rc, pszFile, pszError - pszFile, "");
+            return RTMsgErrorExit(RTEXITCODE_FAILURE,
+                                  "RTVfsChainOpenIoStream failed with rc=%Rrc: '%s'",
+                                  rc, pszFile);
+        }
+    }
+
+    return RTEXITCODE_SUCCESS;
+
+}
+
+
+/**
+ * A /bin/cat clone.
+ *
+ * @returns Program exit code.
+ *
+ * @param   cArgs               The number of arguments.
+ * @param   papszArgs           The argument vector.  (Note that this may be
+ *                              reordered, so the memory must be writable.)
+ */
+RTEXITCODE RTCmdCat(unsigned cArgs, char **papszArgs)
+{
+
+    /*
+     * Parse the command line.
+     */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--show-all",                         'A', RTGETOPT_REQ_NOTHING },
+        { "--number-nonblanks",                 'b', RTGETOPT_REQ_NOTHING },
+        { "--show-ends-and-nonprinting",        'e', RTGETOPT_REQ_NOTHING },
+        { "--show-ends",                        'E', RTGETOPT_REQ_NOTHING },
+        { "--advisory-output-lock",             'l', RTGETOPT_REQ_NOTHING },
+        { "--number",                           'n', RTGETOPT_REQ_NOTHING },
+        { "--squeeze-blank",                    's', RTGETOPT_REQ_NOTHING },
+        { "--show-tabs-and-nonprinting",        't', RTGETOPT_REQ_NOTHING },
+        { "--show-tabs",                        'T', RTGETOPT_REQ_NOTHING },
+        { "--unbuffered-output",                'u', RTGETOPT_REQ_NOTHING },
+        { "--show-nonprinting",                 'v', RTGETOPT_REQ_NOTHING },
+    };
+
+    RTCMDCATOPTS Opts;
+    Opts.fShowEnds              = false;
+    Opts.fShowNonPrinting       = false;
+    Opts.fShowTabs              = false;
+    Opts.fSqueezeBlankLines     = false;
+    Opts.fNumberLines           = false;
+    Opts.fNumberNonBlankLines   = false;
+    Opts.fAdvisoryOutputLock    = false;
+    Opts.fUnbufferedOutput      = false;
+
+    RTEXITCODE      rcExit      = RTEXITCODE_SUCCESS;
+    unsigned        cProcessed  = 0;
+    RTVFSIOSTREAM   hVfsOutput  = NIL_RTVFSIOSTREAM;
+    int rc = RTVfsIoStrmFromStdHandle(RTHANDLESTD_OUTPUT, RTFILE_O_WRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,
+                                      true /*fLeaveOpen*/, &hVfsOutput);
+    if (RT_FAILURE(rc))
+        return RTMsgErrorExitFailure("RTVfsIoStrmFromStdHandle: %Rrc", rc);
+
+    RTGETOPTSTATE GetState;
+    rc = RTGetOptInit(&GetState, cArgs, papszArgs, s_aOptions, RT_ELEMENTS(s_aOptions), 1,
+                      RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    if (RT_FAILURE(rc))
+        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "RTGetOptInit: %Rrc", rc);
+
+    for (;;)
+    {
+        RTGETOPTUNION ValueUnion;
+        int chOpt = RTGetOpt(&GetState, &ValueUnion);
+        switch (chOpt)
+        {
+            case 0:
+                /*
+                 * If we've processed any files we're done.  Otherwise take
+                 * input from stdin and write the output to stdout.
+                 */
+                if (cProcessed > 0)
+                    return rcExit;
+                ValueUnion.psz = "-";
+                /* Fall thru. */
+            case VINF_GETOPT_NOT_OPTION:
+            {
+                RTVFSIOSTREAM hVfsSrc;
+                RTEXITCODE rcExit2 = rtCmdCatOpenInput(ValueUnion.psz, &hVfsSrc);
+                if (rcExit2 == RTEXITCODE_SUCCESS)
+                {
+                    if (   Opts.fShowEnds
+                        || Opts.fShowTabs
+                        || Opts.fShowNonPrinting
+                        || Opts.fSqueezeBlankLines
+                        || Opts.fNumberLines
+                        || Opts.fNumberNonBlankLines)
+                        rcExit2 = rtCmdCatShowComplicated(hVfsOutput, hVfsSrc, ValueUnion.psz, &Opts);
+                    else
+                        rcExit2 = rtCmdCatShowRaw(hVfsOutput, hVfsSrc, ValueUnion.psz);
+                    RTVfsIoStrmRelease(hVfsSrc);
+                }
+                if (rcExit2 != RTEXITCODE_SUCCESS)
+                    rcExit = rcExit2;
+                cProcessed++;
+                break;
+            }
+
+            case 'A':
+                Opts.fShowNonPrinting       = true;
+                Opts.fShowEnds              = true;
+                Opts.fShowTabs              = true;
+                break;
+
+            case 'b':
+                Opts.fNumberNonBlankLines   = true;
+                break;
+
+            case 'e':
+                Opts.fShowNonPrinting       = true;
+                /* fall thru */
+            case 'E':
+                Opts.fShowEnds              = true;
+                break;
+
+            case 'l':
+                Opts.fAdvisoryOutputLock    = true;
+                break;
+
+            case 'n':
+                Opts.fNumberLines           = true;
+                Opts.fNumberNonBlankLines   = false;
+                break;
+
+            case 's':
+                Opts.fSqueezeBlankLines     = true;
+                break;
+
+            case 't':
+                Opts.fShowNonPrinting       = true;
+                /* fall thru */
+            case 'T':
+                Opts.fShowTabs              = true;
+                break;
+
+            case 'u': /* currently ignored */
+                Opts.fUnbufferedOutput      = true;
+                break;
+
+            case 'v':
+                Opts.fShowNonPrinting       = true;
+                break;
+
+            case 'h':
+                RTPrintf("Usage: to be written\nOption dump:\n");
+                for (unsigned i = 0; i < RT_ELEMENTS(s_aOptions); i++)
+                    RTPrintf(" -%c,%s\n", s_aOptions[i].iShort, s_aOptions[i].pszLong);
+                return RTEXITCODE_SUCCESS;
+
+            case 'V':
+                RTPrintf("%sr%d\n", RTBldCfgVersion(), RTBldCfgRevision());
+                return RTEXITCODE_SUCCESS;
+
+            default:
+                return RTGetOptPrintError(chOpt, &ValueUnion);
+        }
+    }
+}
+
+
+int main(int argc, char **argv)
+{
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+    return RTCmdCat(argc, argv);
+}
+
+
Index: /trunk/src/VBox/Runtime/tools/RTGzip.cpp
===================================================================
--- /trunk/src/VBox/Runtime/tools/RTGzip.cpp	(revision 66594)
+++ /trunk/src/VBox/Runtime/tools/RTGzip.cpp	(revision 66595)
@@ -519,5 +519,8 @@
                 if (!Opts.fStdOut && RTVfsChainIsSpec(ValueUnion.psz))
                     return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Must use standard out with VFS chain specifications");
-                if (Opts.fName)
+                if (   Opts.fName
+                    && !Opts.fList
+                    && !Opts.fTest
+                    && !Opts.fDecompress)
                     return RTMsgErrorExit(RTEXITCODE_SYNTAX, "The --name option has not yet been implemented. Use --no-name.");
                 if (Opts.fAscii)
