For clarity, remove a bunch of IS_UNIX ifdefs, since configure.ac always defines IS_UNIX to 1 no matter the OS.

This commit is contained in:
Brian Cox 2017-03-15 20:31:38 -07:00
parent b2f21c3d55
commit 1fb5f332e6
35 changed files with 51 additions and 243 deletions

View File

@ -98,11 +98,9 @@ TSS_REGISTER_ERROR( eFileFlush(), _T("File could not be flushed.") )
TSS_REGISTER_ERROR( eFileRewind(), _T("File could not be rewound.") )
/// Win32
#if IS_UNIX
/// General API failures
TSS_REGISTER_ERROR(eUnix(), _T("Unix API failure.") )
#endif
/// FSServices

View File

@ -208,16 +208,10 @@ inline void cDebug::DebugOut ( const char*, ... ) {}
// ASSERT macro
//////////////////////////////////////////////////////////////////////////////////
#if IS_UNIX
#define ASSERTMSG( exp, s ) assert( (exp) != 0 )
#define ASSERT( exp ) assert( (exp) != 0 )
// if we are not windows we will just use the standard assert()
#define TSS_DebugBreak() ASSERT( false );
#endif// IS_UNIX
#define ASSERTMSG( exp, s ) assert( (exp) != 0 )
#define ASSERT( exp ) assert( (exp) != 0 )
// if we are not windows we will just use the standard assert()
#define TSS_DebugBreak() ASSERT( false );
#ifndef ASSERT
#error ASSERT did not get defined!!!

View File

@ -506,11 +506,8 @@ bool cCharEncoderUtil::IsPrintable( TCHAR ch )
return( ! isprint( ch ) ); // kludge for KAI
#else // USE_CLIB_LOCALE
#if IS_UNIX
return( ! std::isprint<TCHAR>( ch, std::locale() ) );
#endif
return( ! std::isprint<TCHAR>( ch, std::locale() ) );
#endif // USE_CLIB_LOCALE
}

View File

@ -40,7 +40,6 @@
// class eInternal
//=============================================================================
#if IS_UNIX
namespace //unique
{
TCHAR* tw_itot( int value, TCHAR* string, int radix, int size)
@ -49,9 +48,6 @@ namespace //unique
return string;
}
}
#else
#define tw_itot _itot
#endif //IS_UNIX
eInternal::eInternal(TCHAR* sourceFile, int lineNum)
: eError(_T(""))

View File

@ -74,12 +74,7 @@ struct cFile_i;
class cFile
{
public:
#if IS_UNIX
typedef off_t File_t;
#else //WIN32
typedef int64 File_t;
#endif // IS_UNIX
enum SeekFrom
{

View File

@ -45,10 +45,7 @@
#define __FIXED_FILEBUF_H
#include <fstream>
#if IS_UNIX
#define fixed_basic_ofstream std::basic_ofstream
#endif // IS_WIN32/IS_UNIX
#endif//__FIXED_FILEBUF_H

View File

@ -65,16 +65,15 @@
// STANDARD LIBRARY INCLUDES
//=========================================================================
#if IS_UNIX
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
# include <sys/stat.h>
#endif
//=========================================================================
// DEFINES AND MACROS
//=========================================================================
@ -209,13 +208,11 @@ class iFSServices
// maximum path length on platform
////////////////////////////////////////
enum
{
#if IS_UNIX
#ifdef MAXPATHLEN
{
#ifdef MAXPATHLEN
TW_MAX_PATH = MAXPATHLEN
#else
#else
TW_MAX_PATH = 1024
#endif
#endif
};

View File

@ -66,8 +66,6 @@
#include "stdcore.h"
#if IS_UNIX
/*
* set, reset environment to be passed to mpopem
*/
@ -1038,6 +1036,3 @@ int pid;
*/
return(status);
}
#endif //#if IS_UNIX

View File

@ -241,14 +241,9 @@ Resource_Class::Get( ConstKeyRef id ) const
if ( at == m_table.end() )
{
#if IS_UNIX
#ifdef _DEBUG
std::cerr << "*** Error Resource_Class::Get() [" __FILE__ ":" << __LINE__ << "]: Resource not found\n";
#endif
#else
ASSERTMSG( 0, "Resource does not exist!" );
#endif
// TSS_Raise( eInternal, "Resource does not exist!" );
return DefaultValueRef();
}

View File

@ -73,7 +73,6 @@ private:
};
#if IS_UNIX
///////////////////////////////////////////////////////////////////////////////
// cUnixTimeFn -- Unix version, inserts proper function call and overloads
// operator()
@ -98,7 +97,7 @@ private:
typedef cTaskTimer<cUnixTimeFn, cUnixTimeFn::DataType> cUnixTaskTimer;
typedef cUnixTaskTimer cGenericTaskTimer;
#endif // IS_UNIX
//-----------------------------------------------------------------------------
// inline implementation

View File

@ -60,16 +60,12 @@
// A little macro that's useful for finding the number of characters in a TCHAR ARRAY
#define countof( x ) ( sizeof( x ) / sizeof( x[0] ) )
#if IS_UNIX
#include <string.h>
#include <string>
#include <sstream>
#include <iostream>
#define TCHAR char
#define _tmain main
@ -129,7 +125,5 @@ typedef std::ifstream TIFSTREAM;
#define __cdecl
#endif
#endif // WIN32
#endif // __TCHAR_H

View File

@ -38,9 +38,7 @@
static void util_SignalHandler( int sig );
#if IS_UNIX
static void tw_psignal( int sig, const TCHAR* s );
#endif
tw_sighandler_t tw_signal(int sig, tw_sighandler_t pFunc)
{
@ -69,15 +67,10 @@ void util_SignalHandler( int sig )
{
//If we're on unix, let's print out a nice error message telling
//the user which signal we've recieved.
#if IS_UNIX
tw_psignal( sig, (TSS_GetString( cCore, core::STR_SIGNAL).c_str() ) );
#endif
exit( 8 );
}
#if IS_UNIX
/* For the morbidly curious, here's a thread where a POSIX standards committee
wrings its hands about how to define NSIG: http://austingroupbugs.net/view.php?id=741#c1834 */
#ifndef NSIG
@ -126,5 +119,5 @@ void tw_psignal(int sig, const TCHAR *str)
_ftprintf(stderr, _T("%s %s\n"), str, sig < NSIG ? siglist[sig] : siglist[0]);
}
#endif

View File

@ -41,7 +41,6 @@
eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCallGetLastError)
: eError( _T(""))
{
#if IS_UNIX
ASSERT( szFunctionName || szObjectName || fCallGetLastError );
//
// construct the error message:
@ -78,7 +77,6 @@ eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCall
mMsg += strErr;
}
}
#endif // IS_UNIX
}
// eof - unixexcept.cpp

View File

@ -39,7 +39,7 @@
#define __UNIXFSSERVICES_H
#if !IS_UNIX
#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h. Same goes for cWin32FSServices.
#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h.
#endif
//=========================================================================

View File

@ -143,12 +143,7 @@ bool cGenreSwitcher::IsGenreRegistered( cGenre::Genre g )
bool cGenreSwitcher::IsGenreAppropriate( cGenre::Genre g )
{
#if IS_UNIX
const uint32 platformMask = cGenre::PLATFORM_MASK_UNIX;
#else
#error who am I?
#endif
const uint32 platformMask = cGenre::PLATFORM_MASK_UNIX;
return( ( platformMask & g ) != 0 );
}

View File

@ -45,10 +45,7 @@
#include "fspropcalc.h"
#include "fsobject.h"
#if IS_UNIX
#include <unistd.h>
#endif
cFSPropCalc::cFSPropCalc() :
@ -93,11 +90,6 @@ static bool NeedsStat(const cFCOPropVector& v)
static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
{
#if !IS_WIN32
#ifdef _UNICODE
#error GetSymLinkStr in fspropcalc.cpp is not unicode compliant
#else // ifdef _UNICODE
char buf[1024];
#if defined(O_PATH)
int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(),
@ -116,11 +108,6 @@ static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
arch.WriteBlob(buf, rtn);
return true;
#endif // ifdef _UNICODE
#else // if !IS_WIN32
return false; // TODO: find better way to do this -- just a place holder
#endif // if !IS_WIN32
}

View File

@ -46,8 +46,6 @@
#include <fstream> // for the FileExists() stuff
#if IS_UNIX
#include <unistd.h>
#include <fcntl.h>
#if SUPPORTS_TERMIOS
@ -56,7 +54,6 @@
#endif
//#include <signal.h>
int _getch(void);
#endif
using namespace std;
@ -373,11 +370,6 @@ void PrintHeader( TSTRING filename)
bool util_FileExists(const TSTRING& fileName)
{
#if IS_UNIX
// for unix we may be able to use the same logic as above, but
// it is too close to 2.2.1 release to make that change w/o testing.
// I know the above works for windows.
return _taccess(fileName.c_str(), F_OK) == 0;
#endif
}

View File

@ -55,10 +55,8 @@
#include <iostream>
#include <exception>
#if IS_UNIX
#include "core/unixfsservices.h"
#include <unistd.h>
#endif
///////////////////////////////////////////////////////////////////////////////
// terminate and unexpected handlers
@ -93,9 +91,7 @@ static void SiggenInit()
//
// set up the file system services
//
#if IS_UNIX
static cUnixFSServices fss;
#endif
iFSServices::SetInstance( &fss );
//

View File

@ -36,13 +36,10 @@
#include "core/error.h"
#endif
#if IS_UNIX
# if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
# endif
# define SOCKET int
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#define SOCKET int
///////////////////////////////////////////////////////////////////////////////
@ -250,8 +247,6 @@ private:
};
//#ifdef IS_UNIX
///////////////////////////////////////////////////////////////////////////////
//
// This class implements sending a message through a unix pipe to a program

View File

@ -40,8 +40,6 @@
#include "core/msystem.h"
#include "core/file.h"
#if IS_UNIX
#include <time.h>
//All the spleck that it takes to run sockets in Unix...
@ -106,24 +104,24 @@ static int gethostname( char* name, int namelen )
#endif
}
#endif
// Unix does not require us to go though any silly DLL hoops, so we'll
// just #define the pointers to functions needed by Windows to be the
// berkely functions.
#define mPfnSocket socket
#define mPfnInetAddr inet_addr
#define mPfnGethostname gethostname
#define mPfnGethostbyname gethostbyname
#define mPfnConnect connect
#define mPfnCloseSocket close
#define mPfnSend send
#define mPfnRecv recv
#define mPfnSelect select
#define mPfnNtohl ntohl
#define mPfnHtonl htonl
#define mPfnNtohs ntohs
#define mPfnHtons htons
#endif
#endif //HAVE_GETHOSTNAME
// Unix does not require us to go though any silly DLL hoops, so we'll
// just #define the pointers to functions needed by Windows to be the
// berkely functions.
#define mPfnSocket socket
#define mPfnInetAddr inet_addr
#define mPfnGethostname gethostname
#define mPfnGethostbyname gethostbyname
#define mPfnConnect connect
#define mPfnCloseSocket close
#define mPfnSend send
#define mPfnRecv recv
#define mPfnSelect select
#define mPfnNtohl ntohl
#define mPfnHtonl htonl
#define mPfnNtohs ntohs
#define mPfnHtons htons
//
// TODO - maybe convert this SMTP code to non-blocking socket calls, or use
@ -215,9 +213,8 @@ bool cSMTPMailMessage::OpenConnection()
sockAddrIn.sin_port = mPfnHtons(mPortNumber);
uint32 iServerAddress = GetServerAddress();
#if IS_UNIX
sockAddrIn.sin_addr.s_addr = iServerAddress;
#endif
if ( iServerAddress == INADDR_NONE )
{
DecodeError();
@ -494,14 +491,8 @@ bool cSMTPMailMessage::GetAcknowledgement()
// need comment
timeval tv;
#if IS_UNIX
FD_ZERO( &socketSet );
FD_SET( mSocket, &socketSet );
#else
socketSet.fd_count = 1;
socketSet.fd_array[0] = mSocket;
#endif
// set the timeout time to sixty seconds
tv.tv_sec = 60;
@ -567,15 +558,9 @@ void cSMTPMailMessage::SendString( const std::string& str )
void cSMTPMailMessage::DecodeError()
{
#if defined(_DEBUG)
#if IS_UNIX
//
// TODO - Write what ever error reporting will be needed under unix.
//
#endif // IS_UNIX
#endif // defined(_DEBUG)
}

View File

@ -55,12 +55,8 @@
#include "fco/fcogenre.h"
#include "fco/genreswitcher.h"
#if IS_UNIX
#include "core/unixfsservices.h"
#include <unistd.h>
#else
#error Who the hell am I?
#endif
static TSTRING util_GetWholeCmdLine( int argc, const TCHAR *argv[] );
@ -171,13 +167,11 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
TSTRING commandLine = util_GetWholeCmdLine( argc, argv );
#if IS_UNIX
// erase the command line
// TODO: it might be a good idea to move this to cTWUtil
int i;
for (i = 1; i < argc; ++i)
memset((char*)argv[i], 0, strlen(argv[i])*sizeof(TCHAR));
#endif
cCmdLineIter iter(cmdLine);
if (iter.SeekToArg(cTWCmdLine::HELP))

View File

@ -78,11 +78,8 @@
#include "tasktimer.h"
#endif
#if IS_UNIX
#include "fs/fsdatasourceiter.h" // for cross file systems flag
#include <unistd.h> // for _exit()
#endif
//-----------------------------------------------------------------------------
// #defines
@ -277,15 +274,10 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
}
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
{
#if IS_UNIX
// We do not support reset access time on Unix, so we issue a warning.
// This used to be a fatal error, however this prevents
// cross platform config files.
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
#endif
}
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str))
{
@ -649,12 +641,9 @@ bool cTWModeDbInit::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true;
return true;
}
///////////////////////////////////////////////////////////////////////////////
@ -1021,13 +1010,10 @@ bool cTWModeIC::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
//
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true;
return true;
}
@ -1586,12 +1572,9 @@ bool cTWModeDbUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true;
return true;
}
void cTWModeDbUpdate::Init(const cTWModeIC_i* pICData, cFCODatabaseFile* dbFile, cFCOReportHeader* prh, cFCOReport* pReport, bool bEncryptDb)
@ -1958,12 +1941,9 @@ bool cTWModePolUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true;
return true;
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -283,8 +283,6 @@ static void OutputDatabaseHeader( const cFCODbHeader& dbHeader, TOSTREAM* pOut )
(*pOut) << TSS_GetString( cTW, tw::STR_HOST_IP ) << dbHeader.GetIPAddress() << endl;
// only output host ID on UNIX systems
#if IS_UNIX
(*pOut).width(headerColumnWidth);
(*pOut) << TSS_GetString( cTW, tw::STR_HOST_ID );
@ -292,7 +290,7 @@ static void OutputDatabaseHeader( const cFCODbHeader& dbHeader, TOSTREAM* pOut )
(*pOut) << dbHeader.GetHostID() << endl;
else
(*pOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl;
#endif
(*pOut) << setw(headerColumnWidth)
<< TSS_GetString( cTW, tw::STR_POLICY_FILE_USED )

View File

@ -696,9 +696,6 @@ bool cTextReportViewer::LaunchEditorOnFile( const TSTRING& strFilename, const TS
// make sure we can read from this file
cFileUtil::TestFileReadable( strFilename );
#if IS_UNIX
// editor is going to need terminal type, so tell msystem to include
// it in environment when it makes its system call.
le_set("TERM");
@ -720,8 +717,6 @@ bool cTextReportViewer::LaunchEditorOnFile( const TSTRING& strFilename, const TS
//ASSERT( false );
throw eTextReportViewerEditorLaunch( edName );
}
#endif //if IS_WIN32
return( fRanViewer );
}
@ -1166,8 +1161,6 @@ void cTextReportViewer::OutputReportHeader()
(*mpOut).width(headerColumnWidth);
(*mpOut) << TSS_GetString( cTW, tw::STR_HOST_IP ) << mpHeader->GetIPAddress() << endl;
// only output host ID on UNIX systems
#if IS_UNIX
(*mpOut).width(headerColumnWidth);
(*mpOut) << TSS_GetString( cTW, tw::STR_HOST_ID );
@ -1175,8 +1168,6 @@ void cTextReportViewer::OutputReportHeader()
(*mpOut) << mpHeader->GetHostID() << endl;
else
(*mpOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl;
#endif
(*mpOut) << setw(headerColumnWidth)
<< TSS_GetString( cTW, tw::STR_POLICY_FILE_USED )

View File

@ -74,10 +74,8 @@
#include "fco/fconame.h"
#include "fs/fs.h" // object initialization
#if IS_UNIX
#include "core/unixfsservices.h"
#include "core/tw_signal.h" // to ignore SIGPIPE
#endif
#if IS_AROS
#include <errno.h>
@ -252,9 +250,7 @@ void cTWInit::Init( const TSTRING& strArgv0 )
//
// set up the file system services
//
#if IS_UNIX
mpData->pFSServices = new cUnixFSServices;
#endif
ASSERT( mpData->pFSServices != 0 );
iFSServices::SetInstance( mpData->pFSServices );

View File

@ -71,13 +71,11 @@
#include "core/fsservices.h" // for the util_IsDir() stuff
#if IS_UNIX
#include <unistd.h>
#include <fcntl.h>
#if SUPPORTS_TERMIOS
# include <termios.h>
# include <sys/ioctl.h>
#endif
#include "core/tw_signal.h"
int _getch(void);
@ -1117,8 +1115,6 @@ void cTWUtil::CreatePrivateKey(cPrivateKeyProxy& proxy, cKeyFile& keyFile, const
// GetStringNoEcho -- Get a string from the user without echoing it
///////////////////////////////////////////////////////////////////////////////
#if IS_UNIX
static void (*old_SIGINT)(int);
static void (*old_SIGQUIT)(int);
@ -1216,7 +1212,6 @@ void cTWUtil::GetStringNoEcho(wc16_string& ret)
NoEcho noEcho;
GetString(ret);
}
#endif
///////////////////////////////////////////////////////////////////////////////
// ParseObjectList

View File

@ -143,18 +143,14 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig
iUserNotify::GetInstance()->Notify(iUserNotify::V_NORMAL, TSS_GetString(cTWAdmin, twadmin::STR_GENERATING_KEYS).c_str());
#if IS_UNIX
fflush(stdout);
#endif
tGK gk;
gk.passphrase = (int8*)passphrase.data();
gk.passphraseLen = passphrase.length() * sizeof(WCHAR16);
gk.keyPath = keyPath;
#if IS_UNIX
GeneratePublicPrivateKeys(&gk, key_size);
#endif
if (gk.retValue != tGK::OK)
{

View File

@ -49,10 +49,7 @@
#include "twadmin.h" // for package initialization
#include <exception>
#if IS_UNIX
#include <unistd.h>
#endif
///////////////////////////////////////////////////////////////////////////////
// terminate and unexpected handlers
@ -131,13 +128,11 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ], const TCHAR* envp[ ] )
goto exit;
}
#if IS_UNIX
// erase the command line
// TODO: it might be a good idea to move this to cTWUtil
int i;
for (i = 1; i < argc; ++i)
memset((char*)argv[i], 0, strlen(argv[i])*sizeof(TCHAR));
#endif
cCmdLineIter iter(cmdLine);
if (iter.SeekToArg(cTWAdminCmdLine::HELP))

View File

@ -53,10 +53,8 @@
#include "twprint.h" // package initialization
#if IS_UNIX
#include "core/unixfsservices.h"
#include <unistd.h>
#endif
#include <memory> // for auto_ptr
#include <iostream>
@ -155,13 +153,11 @@ int __cdecl _tmain( int argc, const TCHAR* argv[ ] )
goto exit;
}
#if IS_UNIX
// erase the command line
// TODO: it might be a good idea to move this to cTWUtil
int i;
for (i = 1; i < argc; ++i)
memset((char*)argv[i], 0, strlen(argv[i])*sizeof(char));
#endif
cCmdLineIter iter(cmdLine);
if (iter.SeekToArg(cTWPrintCmdLine::HELP))

View File

@ -32,9 +32,8 @@
// tasktimer_t -- test driver for cTaskTimer
#include "core/stdcore.h"
#if IS_UNIX
void TestTaskTimer()
{
}
#endif // IS_UNIX/WIN32

View File

@ -91,9 +91,7 @@ void TestSerializerImpl();
void TestRefCountObj();
void TestSignature();
void TestSerRefCountObj();
#if IS_UNIX
void TestUnixFSServices();
#endif
//void TestFCODatabase();
void TestError();
void TestDebug();
@ -203,9 +201,7 @@ static void Test(int testID)
//case 41: TestFCODatabase(); break;
case 42: TestHashTable(); break;
case 43: TestTCHAR(); break;
#if IS_UNIX
case 44: TestUnixFSServices(); break;
#endif
case 46: TestConfigFile(); break;
#ifdef PARSER_PRESENT
case 47: TestPolicyParser(); break;

View File

@ -48,10 +48,8 @@
#include "core/debug.h"
#endif
#if IS_UNIX
#include <iostream>
using namespace std;
#endif
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Dependencies
@ -68,23 +66,16 @@ TSS_EndPackage( cTest )
///////////////////////////////////////////////////////////////////////////////
// TEST() -- Works like ASSERT() but it also breaks during release mode
#if IS_UNIX
#define TEST(exp) if (!(exp)) \
{ \
std::cerr<<"TEST(" << #exp << ") failure, file " << __FILE__ << " line " << __LINE__ << std::endl; \
exit(-1); \
}
#endif
///////////////////////////////////////////////////////////////////////////////
// Platform dependancies
#if IS_UNIX
#define TEMP_DIR _T("/tmp")
#define TEMP_DIR_N "/tmp"
#endif
#endif // __TEST_H

View File

@ -37,13 +37,9 @@
#include "twtest/test.h"
#include <fstream>
#if IS_UNIX
//#include <statbuf.h>
#include <unistd.h>
#include <sys/stat.h>
#endif
std::string WideToNarrow( const TSTRING& strWide );
@ -69,12 +65,7 @@ void TestTWUtil()
tmpFN += _T("/fileexiststest.tmp");
// make a subdir in the TEMP_DIR
#if IS_UNIX
_tmkdir(tmpDir.c_str(), 0700);
#else
_tmkdir(tmpDir.c_str());
#endif
_tchmod(tmpDir.c_str(), 0700);
// make sure file is not there
@ -88,11 +79,10 @@ void TestTWUtil()
TEST(cTWUtil::FileExists(tmpFN) == false);
// make the dir read only and make sure write tests false
#if IS_UNIX // windows fails this test, perhaps because I am an administrator?
// windows fails this test, perhaps because I am an administrator?
_tchmod(tmpDir.c_str(), 0500);
TEST(cTWUtil::FileWritable(tmpFN) == false);
_tchmod(tmpDir.c_str(), 0700);
#endif
// create the file
{

View File

@ -38,8 +38,6 @@
#include "core/archive.h"
#include "fco/fconame.h"
#if IS_UNIX
#ifndef __TEST_H
#include "twtest/test.h"
#endif
@ -182,7 +180,7 @@ void TestUnixFSServices()
}
}
#endif // IS_UNIX

View File

@ -47,12 +47,11 @@
#include <fstream> // for the FileExists() stuff
#if IS_UNIX
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#endif
///////////////////////////////////////////////////////////////////////////////
@ -237,8 +236,6 @@ bool cFileUtil::BackupFile(const TSTRING& filename, bool printWarningOnFailure)
bool cFileUtil::Copy(const TSTRING& src_path, const TSTRING& dest_path)
{
#if IS_UNIX
enum { BUF_SIZE = 4096 };
int8 buf[BUF_SIZE];
int nBytesRead;
@ -266,8 +263,6 @@ bool cFileUtil::Copy(const TSTRING& src_path, const TSTRING& dest_path)
srcFile.Close();
destFile.Close();
#endif
return true;
}