RTGzip.cpp revision ad56312e8023a6cf380187ddce98a5dcb19f7c5a
/* $Id$ */
/** @file
* IPRT - GZIP Testcase Utility.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* 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 *
*******************************************************************************/
static bool isStdHandleATty(int fd)
{
/** @todo IPRT is missing this */
return false;
}
{
if (RT_FAILURE(rc))
return RTMsgInitFailure(rc);
/*
* Parse the command line.
*/
static const RTGETOPTDEF s_aOptions[]
{
};
bool fAscii = false;
bool fStdOut = false;
bool fDecompress = false;
bool fForce = false;
bool fList = false;
bool fName = true;
bool fQuiet = false;
bool fRecursive = false;
const char *pszSuff = ".gz";
bool fTest = false;
unsigned uLevel = 6;
unsigned cProcessed = 0;
for (;;)
{
switch (rc)
{
case 0:
{
/*
* If we've processed any files we're done. Otherwise take
* input from stdin and write the output to stdout.
*/
if (cProcessed)
return rcExit;
return RTMsgErrorExit(RTEXITCODE_SYNTAX,
"Yeah, right. I'm not %s any compressed data %s the terminal without --force.\n",
return rcExit;
}
case VINF_GETOPT_NOT_OPTION:
{
rc = RTVfsOpenIoStreamFromSpec(ValueUnion.psz, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hVfsSrc);
cProcessed++;
if (fDecompress)
{
}
else
{
return
{
}
}
break;
}
case 'a': fAscii = true; break;
case 'c': fStdOut = true; break;
case 'd': fDecompress = true; break;
case 'f': fForce = true; break;
case 'l': fList = true; break;
case 'n': fName = false; break;
case 'N': fName = true; break;
case 'q': fQuiet = true; break;
case 'r': fRecursive = true; break;
case 't': fTest = true; break;
case 'v': fQuiet = false; break;
default:
}
}
}