diff --git a/src/core/coreerrors.cpp b/src/core/coreerrors.cpp index 2df59aa..2c249d0 100644 --- a/src/core/coreerrors.cpp +++ b/src/core/coreerrors.cpp @@ -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 diff --git a/src/core/debug.h b/src/core/debug.h index d7b0033..499fcf7 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -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!!! diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp index b6027e9..e0e1102 100644 --- a/src/core/displayencoder.cpp +++ b/src/core/displayencoder.cpp @@ -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( ch, std::locale() ) ); - #endif + return( ! std::isprint( ch, std::locale() ) ); #endif // USE_CLIB_LOCALE } diff --git a/src/core/errorutil.cpp b/src/core/errorutil.cpp index da4aff8..e4f7af5 100644 --- a/src/core/errorutil.cpp +++ b/src/core/errorutil.cpp @@ -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("")) diff --git a/src/core/file.h b/src/core/file.h index 1964e31..b261da2 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -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 { diff --git a/src/core/fixedfilebuf.h b/src/core/fixedfilebuf.h index adf7d00..8ce2d6e 100644 --- a/src/core/fixedfilebuf.h +++ b/src/core/fixedfilebuf.h @@ -45,10 +45,7 @@ #define __FIXED_FILEBUF_H #include - -#if IS_UNIX #define fixed_basic_ofstream std::basic_ofstream -#endif // IS_WIN32/IS_UNIX #endif//__FIXED_FILEBUF_H diff --git a/src/core/fsservices.h b/src/core/fsservices.h index 8c58a0e..0aed4c1 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -65,16 +65,15 @@ // STANDARD LIBRARY INCLUDES //========================================================================= -#if IS_UNIX - #if HAVE_SYS_PARAM_H - #include - #endif +#if HAVE_SYS_PARAM_H +# include +#endif #if HAVE_SYS_STAT_H -#include -#endif +# include #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 }; diff --git a/src/core/msystem.cpp b/src/core/msystem.cpp index 09a2653..5c3a4d4 100644 --- a/src/core/msystem.cpp +++ b/src/core/msystem.cpp @@ -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 - diff --git a/src/core/resources.h b/src/core/resources.h index 66333fe..6ef4161 100644 --- a/src/core/resources.h +++ b/src/core/resources.h @@ -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(); } diff --git a/src/core/tasktimer.h b/src/core/tasktimer.h index c0d7f9b..d65fbe6 100644 --- a/src/core/tasktimer.h +++ b/src/core/tasktimer.h @@ -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 cUnixTaskTimer; typedef cUnixTaskTimer cGenericTaskTimer; -#endif // IS_UNIX + //----------------------------------------------------------------------------- // inline implementation diff --git a/src/core/tchar.h b/src/core/tchar.h index d483883..2871a16 100644 --- a/src/core/tchar.h +++ b/src/core/tchar.h @@ -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 #include #include #include - - #define TCHAR char #define _tmain main @@ -129,7 +125,5 @@ typedef std::ifstream TIFSTREAM; #define __cdecl #endif -#endif // WIN32 - #endif // __TCHAR_H diff --git a/src/core/tw_signal.cpp b/src/core/tw_signal.cpp index 4ce122d..e13feb8 100644 --- a/src/core/tw_signal.cpp +++ b/src/core/tw_signal.cpp @@ -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 + diff --git a/src/core/unixexcept.cpp b/src/core/unixexcept.cpp index 5b89795..0ab1c19 100644 --- a/src/core/unixexcept.cpp +++ b/src/core/unixexcept.cpp @@ -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 diff --git a/src/core/unixfsservices.h b/src/core/unixfsservices.h index 4bde573..c0fd1bc 100644 --- a/src/core/unixfsservices.h +++ b/src/core/unixfsservices.h @@ -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 //========================================================================= diff --git a/src/fco/genreswitcher.cpp b/src/fco/genreswitcher.cpp index e3bee5e..1702f98 100644 --- a/src/fco/genreswitcher.cpp +++ b/src/fco/genreswitcher.cpp @@ -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 ); } diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 585df89..f575bfd 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -45,10 +45,7 @@ #include "fspropcalc.h" #include "fsobject.h" - -#if IS_UNIX #include -#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 } diff --git a/src/siggen/siggencmdline.cpp b/src/siggen/siggencmdline.cpp index 347f87c..370d965 100644 --- a/src/siggen/siggencmdline.cpp +++ b/src/siggen/siggencmdline.cpp @@ -46,8 +46,6 @@ #include // for the FileExists() stuff - -#if IS_UNIX #include #include #if SUPPORTS_TERMIOS @@ -56,7 +54,6 @@ #endif //#include 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 } diff --git a/src/siggen/siggenmain.cpp b/src/siggen/siggenmain.cpp index c669722..0427b71 100644 --- a/src/siggen/siggenmain.cpp +++ b/src/siggen/siggenmain.cpp @@ -55,10 +55,8 @@ #include #include -#if IS_UNIX #include "core/unixfsservices.h" #include -#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 ); // diff --git a/src/tripwire/mailmessage.h b/src/tripwire/mailmessage.h index b8ef197..dfec57c 100644 --- a/src/tripwire/mailmessage.h +++ b/src/tripwire/mailmessage.h @@ -36,13 +36,10 @@ #include "core/error.h" #endif - -#if IS_UNIX -# if HAVE_SYS_SOCKET_H -# include -# endif -# define SOCKET int +#if HAVE_SYS_SOCKET_H +# include #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 diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index 52c6adc..9e63bc7 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -40,8 +40,6 @@ #include "core/msystem.h" #include "core/file.h" -#if IS_UNIX - #include //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) } diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index a94d6c5..67a81f2 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -55,12 +55,8 @@ #include "fco/fcogenre.h" #include "fco/genreswitcher.h" -#if IS_UNIX #include "core/unixfsservices.h" #include -#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)) diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index dcd22d0..e6de6a4 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -78,11 +78,8 @@ #include "tasktimer.h" #endif -#if IS_UNIX #include "fs/fsdatasourceiter.h" // for cross file systems flag #include // 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; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/tw/textdbviewer.cpp b/src/tw/textdbviewer.cpp index 3b7647b..d6dd5c3 100644 --- a/src/tw/textdbviewer.cpp +++ b/src/tw/textdbviewer.cpp @@ -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 ) diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index f29a6f0..2d6986d 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -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 ) diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index 99e2947..cac48aa 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -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 @@ -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 ); diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 4172aaa..46b9ab8 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -71,13 +71,11 @@ #include "core/fsservices.h" // for the util_IsDir() stuff -#if IS_UNIX #include #include #if SUPPORTS_TERMIOS # include # include -#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 diff --git a/src/twadmin/keygeneration.cpp b/src/twadmin/keygeneration.cpp index f8843eb..600f3a8 100644 --- a/src/twadmin/keygeneration.cpp +++ b/src/twadmin/keygeneration.cpp @@ -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) { diff --git a/src/twadmin/twadminmain.cpp b/src/twadmin/twadminmain.cpp index 718ea82..b24fe6d 100644 --- a/src/twadmin/twadminmain.cpp +++ b/src/twadmin/twadminmain.cpp @@ -49,10 +49,7 @@ #include "twadmin.h" // for package initialization #include - -#if IS_UNIX #include -#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)) diff --git a/src/twprint/twprintmain.cpp b/src/twprint/twprintmain.cpp index 85fbe2a..c55631e 100644 --- a/src/twprint/twprintmain.cpp +++ b/src/twprint/twprintmain.cpp @@ -53,10 +53,8 @@ #include "twprint.h" // package initialization -#if IS_UNIX #include "core/unixfsservices.h" #include -#endif #include // for auto_ptr #include @@ -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)) diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index 617e54f..2770e28 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -32,9 +32,8 @@ // tasktimer_t -- test driver for cTaskTimer #include "core/stdcore.h" -#if IS_UNIX void TestTaskTimer() { } -#endif // IS_UNIX/WIN32 + diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 4bdc1df..88db4f0 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -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; diff --git a/src/twtest/test.h b/src/twtest/test.h index 83c36bd..6931009 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -48,10 +48,8 @@ #include "core/debug.h" #endif -#if IS_UNIX #include 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 diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index 3ed11e1..545c4bd 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -37,13 +37,9 @@ #include "twtest/test.h" #include - - -#if IS_UNIX //#include #include #include -#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 { diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index 09fb401..5f46f32 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -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 + diff --git a/src/util/fileutil.cpp b/src/util/fileutil.cpp index 1b9368f..69dd3a6 100644 --- a/src/util/fileutil.cpp +++ b/src/util/fileutil.cpp @@ -47,12 +47,11 @@ #include // for the FileExists() stuff -#if IS_UNIX #include #include #include #include -#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; }