VBoxServiceToolBox.cpp revision 6dce8fd327b706965b74230e1036ed3b71e537b9
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * VBoxServiceToolBox - Internal (BusyBox-like) toolbox.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * Copyright (C) 2011 Oracle Corporation
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * available from http://www.virtualbox.org. This file is free software;
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * you can redistribute it and/or modify it under the terms of the GNU
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * General Public License (GPL) as published by the Free Software
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/*******************************************************************************
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync* Header Files *
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync*******************************************************************************/
typedef enum VBOXSERVICETOOLBOXLSFLAG
#ifdef DEBUG
typedef struct VBOXSERVICETOOLBOXPATHENTRY
char *pszName;
typedef struct VBOXSERVICETOOLBOXDIRENTRY
static void VBoxServiceToolboxShowUsage(void)
static void VBoxServiceToolboxShowVersion(void)
return VERR_INVALID_PARAMETER;
while (pNode)
? NULL
PVBOXSERVICETOOLBOXPATHENTRY pNode = (PVBOXSERVICETOOLBOXPATHENTRY)RTMemAlloc(sizeof(VBOXSERVICETOOLBOXPATHENTRY));
if (pNode)
return rc;
cbRead = 0;
return rc;
int ch;
#ifdef VBOXSERVICE_TOOLBOX_DEBUG
bool fUsageOK = true;
switch (ch)
return RTEXITCODE_SUCCESS;
return RTEXITCODE_SUCCESS;
case VINF_GETOPT_NOT_OPTION:
if (pMsg)
char cFileType;
szTimeBirth, 0,
szTimeChange, 0,
szTimeAccess, 0);
return VINF_SUCCESS;
return rc;
return rc;
PVBOXSERVICETOOLBOXDIRENTRY pNode = (PVBOXSERVICETOOLBOXDIRENTRY)RTMemAlloc(sizeof(VBOXSERVICETOOLBOXDIRENTRY));
if (pNode)
case RTFS_TYPE_SYMLINK:
case RTFS_TYPE_DIRECTORY:
return rc;
int ch;
#ifdef VBOXSERVICE_TOOLBOX_DEBUG
bool fVerbose = false;
switch (ch)
return RTEXITCODE_SUCCESS;
case LS_OPT_MACHINE_READABLE:
fVerbose = true;
return RTEXITCODE_SUCCESS;
case VINF_GETOPT_NOT_OPTION:
else if (fVerbose)
int ch;
#ifdef VBOXSERVICE_TOOLBOX_DEBUG
bool fMakeParentDirs = false;
bool fVerbose = false;
switch (ch)
return RTEXITCODE_SUCCESS;
fMakeParentDirs = true;
return RTEXITCODE_SYNTAX;
fVerbose = true;
return RTEXITCODE_SUCCESS;
case VINF_GETOPT_NOT_OPTION:
#ifndef RT_OS_WINDOWS
if (newMode)
if (pMsg)
else if (fVerbose)
int ch;
#ifdef VBOXSERVICE_TOOLBOX_DEBUG
bool fVerbose = false;
switch (ch)
return RTEXITCODE_SUCCESS;
fVerbose = true;
return RTEXITCODE_SUCCESS;
case VINF_GETOPT_NOT_OPTION:
else if (fVerbose)
int iCmdIdx = 0;
#ifdef VBOXSERVICE_TOOLBOX_DEBUG