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.") ) TSS_REGISTER_ERROR( eFileRewind(), _T("File could not be rewound.") )
/// Win32 /// General API failures
#if IS_UNIX
TSS_REGISTER_ERROR(eUnix(), _T("Unix API failure.") ) TSS_REGISTER_ERROR(eUnix(), _T("Unix API failure.") )
#endif
/// FSServices /// FSServices

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,16 +65,15 @@
// STANDARD LIBRARY INCLUDES // STANDARD LIBRARY INCLUDES
//========================================================================= //=========================================================================
#if IS_UNIX #if HAVE_SYS_PARAM_H
#if HAVE_SYS_PARAM_H # include <sys/param.h>
#include <sys/param.h> #endif
#endif
#if HAVE_SYS_STAT_H #if HAVE_SYS_STAT_H
#include <sys/stat.h> # include <sys/stat.h>
#endif
#endif #endif
//========================================================================= //=========================================================================
// DEFINES AND MACROS // DEFINES AND MACROS
//========================================================================= //=========================================================================
@ -210,12 +209,10 @@ class iFSServices
//////////////////////////////////////// ////////////////////////////////////////
enum enum
{ {
#if IS_UNIX #ifdef MAXPATHLEN
#ifdef MAXPATHLEN
TW_MAX_PATH = MAXPATHLEN TW_MAX_PATH = MAXPATHLEN
#else #else
TW_MAX_PATH = 1024 TW_MAX_PATH = 1024
#endif
#endif #endif
}; };

View File

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

View File

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

View File

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

View File

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

View File

@ -38,9 +38,7 @@
static void util_SignalHandler( int sig ); static void util_SignalHandler( int sig );
#if IS_UNIX
static void tw_psignal( int sig, const TCHAR* s ); static void tw_psignal( int sig, const TCHAR* s );
#endif
tw_sighandler_t tw_signal(int sig, tw_sighandler_t pFunc) 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 //If we're on unix, let's print out a nice error message telling
//the user which signal we've recieved. //the user which signal we've recieved.
#if IS_UNIX
tw_psignal( sig, (TSS_GetString( cCore, core::STR_SIGNAL).c_str() ) ); tw_psignal( sig, (TSS_GetString( cCore, core::STR_SIGNAL).c_str() ) );
#endif
exit( 8 ); exit( 8 );
} }
#if IS_UNIX
/* For the morbidly curious, here's a thread where a POSIX standards committee /* 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 */ wrings its hands about how to define NSIG: http://austingroupbugs.net/view.php?id=741#c1834 */
#ifndef NSIG #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]); _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) eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCallGetLastError)
: eError( _T("")) : eError( _T(""))
{ {
#if IS_UNIX
ASSERT( szFunctionName || szObjectName || fCallGetLastError ); ASSERT( szFunctionName || szObjectName || fCallGetLastError );
// //
// construct the error message: // construct the error message:
@ -78,7 +77,6 @@ eUnix::eUnix( const TCHAR* szFunctionName, const TCHAR* szObjectName, bool fCall
mMsg += strErr; mMsg += strErr;
} }
} }
#endif // IS_UNIX
} }
// eof - unixexcept.cpp // eof - unixexcept.cpp

View File

@ -39,7 +39,7 @@
#define __UNIXFSSERVICES_H #define __UNIXFSSERVICES_H
#if !IS_UNIX #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 #endif
//========================================================================= //=========================================================================

View File

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

View File

@ -45,10 +45,7 @@
#include "fspropcalc.h" #include "fspropcalc.h"
#include "fsobject.h" #include "fsobject.h"
#if IS_UNIX
#include <unistd.h> #include <unistd.h>
#endif
cFSPropCalc::cFSPropCalc() : cFSPropCalc::cFSPropCalc() :
@ -93,11 +90,6 @@ static bool NeedsStat(const cFCOPropVector& v)
static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch) 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]; char buf[1024];
#if defined(O_PATH) #if defined(O_PATH)
int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(), 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); arch.WriteBlob(buf, rtn);
return true; 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 #include <fstream> // for the FileExists() stuff
#if IS_UNIX
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#if SUPPORTS_TERMIOS #if SUPPORTS_TERMIOS
@ -56,7 +54,6 @@
#endif #endif
//#include <signal.h> //#include <signal.h>
int _getch(void); int _getch(void);
#endif
using namespace std; using namespace std;
@ -373,11 +370,6 @@ void PrintHeader( TSTRING filename)
bool util_FileExists(const 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; return _taccess(fileName.c_str(), F_OK) == 0;
#endif
} }

View File

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

View File

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

View File

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

View File

@ -78,11 +78,8 @@
#include "tasktimer.h" #include "tasktimer.h"
#endif #endif
#if IS_UNIX
#include "fs/fsdatasourceiter.h" // for cross file systems flag #include "fs/fsdatasourceiter.h" // for cross file systems flag
#include <unistd.h> // for _exit() #include <unistd.h> // for _exit()
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// #defines // #defines
@ -277,15 +274,10 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
} }
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str)) if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
{ {
#if IS_UNIX
// We do not support reset access time on Unix, so we issue a warning. // We do not support reset access time on Unix, so we issue a warning.
// This used to be a fatal error, however this prevents // This used to be a fatal error, however this prevents
// cross platform config files. // cross platform config files.
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL)); cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
#endif
} }
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str)) if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str))
{ {
@ -649,11 +641,8 @@ bool cTWModeDbInit::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false) if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG)); cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately. // Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems); cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true; return true;
} }
@ -1022,11 +1011,8 @@ bool cTWModeIC::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false) if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG)); cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately. // Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems); cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true; return true;
} }
@ -1586,11 +1572,8 @@ bool cTWModeDbUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine)
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false) if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG)); cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately. // Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems); cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems);
#endif
return true; return true;
} }
@ -1958,11 +1941,8 @@ bool cTWModePolUpdate::Init(const cConfigFile& cf, const cCmdLineParser& cmdLine
if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false) if (cTWUtil::VerifyCfgSiteKey( mstrConfigFile, mpData->mSiteKeyFile ) == false)
cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG)); cTWUtil::PrintErrorMsg(eTWCfgUnencrypted(_T(""), eError::NON_FATAL|eError::SUPRESS_THIRD_MSG));
#if IS_UNIX
// Set the cross file systems flag appropriately. // Set the cross file systems flag appropriately.
cFSDataSourceIter::SetFileSystemCrossing(mpData->mbCrossFileSystems); 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; (*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).width(headerColumnWidth);
(*pOut) << TSS_GetString( cTW, tw::STR_HOST_ID ); (*pOut) << TSS_GetString( cTW, tw::STR_HOST_ID );
@ -292,7 +290,7 @@ static void OutputDatabaseHeader( const cFCODbHeader& dbHeader, TOSTREAM* pOut )
(*pOut) << dbHeader.GetHostID() << endl; (*pOut) << dbHeader.GetHostID() << endl;
else else
(*pOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl; (*pOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl;
#endif
(*pOut) << setw(headerColumnWidth) (*pOut) << setw(headerColumnWidth)
<< TSS_GetString( cTW, tw::STR_POLICY_FILE_USED ) << 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 // make sure we can read from this file
cFileUtil::TestFileReadable( strFilename ); cFileUtil::TestFileReadable( strFilename );
#if IS_UNIX
// editor is going to need terminal type, so tell msystem to include // editor is going to need terminal type, so tell msystem to include
// it in environment when it makes its system call. // it in environment when it makes its system call.
le_set("TERM"); le_set("TERM");
@ -721,8 +718,6 @@ bool cTextReportViewer::LaunchEditorOnFile( const TSTRING& strFilename, const TS
throw eTextReportViewerEditorLaunch( edName ); throw eTextReportViewerEditorLaunch( edName );
} }
#endif //if IS_WIN32
return( fRanViewer ); return( fRanViewer );
} }
@ -1166,8 +1161,6 @@ void cTextReportViewer::OutputReportHeader()
(*mpOut).width(headerColumnWidth); (*mpOut).width(headerColumnWidth);
(*mpOut) << TSS_GetString( cTW, tw::STR_HOST_IP ) << mpHeader->GetIPAddress() << endl; (*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).width(headerColumnWidth);
(*mpOut) << TSS_GetString( cTW, tw::STR_HOST_ID ); (*mpOut) << TSS_GetString( cTW, tw::STR_HOST_ID );
@ -1175,8 +1168,6 @@ void cTextReportViewer::OutputReportHeader()
(*mpOut) << mpHeader->GetHostID() << endl; (*mpOut) << mpHeader->GetHostID() << endl;
else else
(*mpOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl; (*mpOut) << TSS_GetString( cTW, tw::STR_NONE ) << endl;
#endif
(*mpOut) << setw(headerColumnWidth) (*mpOut) << setw(headerColumnWidth)
<< TSS_GetString( cTW, tw::STR_POLICY_FILE_USED ) << TSS_GetString( cTW, tw::STR_POLICY_FILE_USED )

View File

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

View File

@ -71,13 +71,11 @@
#include "core/fsservices.h" // for the util_IsDir() stuff #include "core/fsservices.h" // for the util_IsDir() stuff
#if IS_UNIX
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#if SUPPORTS_TERMIOS #if SUPPORTS_TERMIOS
# include <termios.h> # include <termios.h>
# include <sys/ioctl.h> # include <sys/ioctl.h>
#endif
#include "core/tw_signal.h" #include "core/tw_signal.h"
int _getch(void); 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 // GetStringNoEcho -- Get a string from the user without echoing it
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if IS_UNIX
static void (*old_SIGINT)(int); static void (*old_SIGINT)(int);
static void (*old_SIGQUIT)(int); static void (*old_SIGQUIT)(int);
@ -1216,7 +1212,6 @@ void cTWUtil::GetStringNoEcho(wc16_string& ret)
NoEcho noEcho; NoEcho noEcho;
GetString(ret); GetString(ret);
} }
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// ParseObjectList // 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()); iUserNotify::GetInstance()->Notify(iUserNotify::V_NORMAL, TSS_GetString(cTWAdmin, twadmin::STR_GENERATING_KEYS).c_str());
#if IS_UNIX
fflush(stdout); fflush(stdout);
#endif
tGK gk; tGK gk;
gk.passphrase = (int8*)passphrase.data(); gk.passphrase = (int8*)passphrase.data();
gk.passphraseLen = passphrase.length() * sizeof(WCHAR16); gk.passphraseLen = passphrase.length() * sizeof(WCHAR16);
gk.keyPath = keyPath; gk.keyPath = keyPath;
#if IS_UNIX
GeneratePublicPrivateKeys(&gk, key_size); GeneratePublicPrivateKeys(&gk, key_size);
#endif
if (gk.retValue != tGK::OK) if (gk.retValue != tGK::OK)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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