diff --git a/config.h.in b/config.h.in index 5647ef6..191cef8 100644 --- a/config.h.in +++ b/config.h.in @@ -87,6 +87,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATFS_H diff --git a/configure b/configure index 411592d..0d31863 100755 --- a/configure +++ b/configure @@ -5585,7 +5585,7 @@ fi done -for ac_header in sys/ustat.h sys/sysmacros.h sys/syslog.h +for ac_header in sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 66afe85..eb73eae 100644 --- a/configure.ac +++ b/configure.ac @@ -63,7 +63,7 @@ AC_CHECK_HEADERS(sys/mount.h,,, #include #endif ]]) -AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h) +AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h) AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h) AC_CHECK_HEADERS(signum.h bits/signum.h, break ) AC_CHECK_HEADERS(stdarg.h varargs.h, break ) diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index eae67e0..ac7ed07 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -72,9 +72,13 @@ #endif #include #include -#include -#include -#include + +#if HAVE_SYS_SOCKET_H +# include +# include +# include +#endif + #include #include #include @@ -365,7 +369,11 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const th stat.size = statbuf.st_size; stat.uid = statbuf.st_uid; stat.blksize = statbuf.st_blksize; +#ifndef __DJGPP__ stat.blocks = statbuf.st_blocks; +#else + stat.blocks = 0; +#endif // set the file type if(S_ISREG(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_FILE; @@ -374,7 +382,9 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const th else if(S_ISBLK(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_BLOCKDEV; else if(S_ISCHR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_CHARDEV; else if(S_ISFIFO(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_FIFO; +#ifdef S_ISSOCK else if(S_ISSOCK(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_SOCK; +#endif #ifdef S_IFDOOR else if(S_ISDOOR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_DOOR; #endif @@ -399,7 +409,7 @@ void cUnixFSServices::GetMachineNameFullyQualified( TSTRING& strName ) const char buf[256]; if (gethostname(buf, 256) != 0) { -#if defined(SOLARIS_NO_GETHOSTBYNAME) || defined(_SORTIX_SOURCE) +#if defined(SOLARIS_NO_GETHOSTBYNAME) || defined(_SORTIX_SOURCE) || defined(__DJGPP__) strName = buf; return; #else @@ -454,7 +464,7 @@ bool cUnixFSServices::GetIPAddress( uint32& uiIPAddress ) bool fGotAddress = false; cDebug d( _T("cUnixFSServices::GetIPAddress") ); -#ifndef _SORTIX_SOURCE +#if !defined(_SORTIX_SOURCE) && !defined(__DJGPP__) struct utsname utsnameBuf; if( EFAULT != uname( &utsnameBuf) ) { @@ -557,6 +567,10 @@ bool cUnixFSServices::GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tst return( fSuccess ); } +#ifndef S_ISVTX // DOS/DJGPP doesn't have this +# define S_ISVTX 0 +#endif + //////////////////////////////////////////////////////////////////////// // Function name : cUnixFSServices::ConvertModeToString // Description : takes a TSTRING and fills it with an "ls -l" representation diff --git a/src/cryptlib/misc.h b/src/cryptlib/misc.h index 467a7a7..95a4711 100644 --- a/src/cryptlib/misc.h +++ b/src/cryptlib/misc.h @@ -9,7 +9,7 @@ #include #endif -#ifdef __MINT__ // has memory.h, but memset defined in string.h anyway. +#if defined(__MINT__) || defined(__MSDOS__) // has memory.h, but memset defined in string.h anyway. #include #endif diff --git a/src/tripwire/mailmessage.h b/src/tripwire/mailmessage.h index 866d389..e138258 100644 --- a/src/tripwire/mailmessage.h +++ b/src/tripwire/mailmessage.h @@ -37,9 +37,11 @@ #endif -#if IS_UNIX -#include -#define SOCKET int +#if IS_UNIX +# if HAVE_SYS_SOCKET_H +# include +# endif +# define SOCKET int #endif diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index ea01129..f57c39a 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -46,12 +46,14 @@ //All the spleck that it takes to run sockets in Unix... #include -#include +#if HAVE_SYS_SOCKET_H +# include +# include +# include +# include +#endif #include #include -#include -#include -#include #include #ifdef _SORTIX_SOURCE @@ -191,12 +193,16 @@ long cSMTPMailMessage::GetServerAddress() if (bIsNumeric) { +#ifndef HAVE_SYS_SOCKET_H + return 0; +#else // convert the numberic address to a long return mPfnInetAddr(sNarrowString.c_str()); +#endif } else { -#ifdef _SORTIX_SOURCE +#if defined(_SORTIX_SOURCE) || !defined(HAVE_SYS_SOCKET_H) return INADDR_NONE; #else // do a DNS lookup of the hostname and get the long @@ -216,6 +222,9 @@ long cSMTPMailMessage::GetServerAddress() // bool cSMTPMailMessage::OpenConnection() { +#ifndef HAVE_SYS_SOCKET_H + return false; +#else // Initialize the socket structure sockaddr_in sockAddrIn; memset(&sockAddrIn, 0, sizeof(sockaddr)); @@ -262,6 +271,7 @@ bool cSMTPMailMessage::OpenConnection() } return true; +#endif } @@ -485,6 +495,9 @@ bool cSMTPMailMessage::MailMessage() // bool cSMTPMailMessage::GetAcknowledgement() { +#ifndef HAVE_SYS_SOCKET_H + return false; +#else cDebug d( "cSMTPMailMessage::GetAcknowledgement" ); const int bufsize = 512; @@ -547,17 +560,19 @@ bool cSMTPMailMessage::GetAcknowledgement() throw eMailSMTPServer(estr.str()); return false; } +#endif } void cSMTPMailMessage::SendString( const std::string& str ) { cDebug d("util_SendString()"); - +#if HAVE_SYS_SOCKET_H if( str.length() < 800 ) d.TraceDebug( "Sending \"%s\"\n", str.c_str() ); else d.TraceDebug( "Sending (truncated in this debug output)\"%s\"\n", std::string( str.c_str(), 800 ).c_str() ); mPfnSend( mSocket, str.c_str(), str.length(), 0 ); +#endif } diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index 5b48b86..f21f9b1 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -284,7 +284,7 @@ void cTWInit::Init( const TSTRING& strArgv0 ) mpData->et.SetChild( &mpData->er ); errorQueue.SetChild( &mpData->et ); -#if IS_UNIX +#if IS_UNIX && !defined(__DJGPP__) // ignore SIGPIPE tw_sigign(SIGPIPE); //TODO: somebody add comment here!