diff --git a/src/core/file.h b/src/core/file.h index 29f0630..3289660 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -73,8 +73,7 @@ class cFile { public: #if IS_UNIX - typedef off_t File_t; - + typedef off_t File_t; #else //WIN32 typedef int64 File_t; @@ -140,5 +139,16 @@ public: bool isWritable; }; + +#ifdef __AROS__ +class cArosPath +{ +public: + static TSTRING AsPosix(const TSTRING& in); + static TSTRING AsNative(const TSTRING& in); +}; +#endif + + #endif //__FILE_H diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index d63ed5f..94b92db 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -119,8 +119,15 @@ cFile::~cFile() /////////////////////////////////////////////////////////////////////////////// // Open /////////////////////////////////////////////////////////////////////////////// + +#ifndef __AROS void cFile::Open( const TSTRING& sFileName, uint32 flags ) { +#else +void cFile::Open( const TSTRING& sFileNameC, uint32 flags ) +{ + TSTRING sFileName = cArosPath::AsNative(sFileNameC); +#endif mode_t openmode = 0664; if ( mpData->mpCurrStream != NULL ) Close(); @@ -161,6 +168,7 @@ void cFile::Open( const TSTRING& sFileName, uint32 flags ) if ( flags & OPEN_CREATE ) perm |= O_CREAT; + // // actually open the file // @@ -169,6 +177,8 @@ void cFile::Open( const TSTRING& sFileName, uint32 flags ) { throw( eFileOpen( sFileName, iFSServices::GetInstance()->GetErrString() ) ); } + +#ifndef __AROS__ if( flags & OPEN_LOCKED_TEMP ) { // unlink this file @@ -176,9 +186,10 @@ void cFile::Open( const TSTRING& sFileName, uint32 flags ) { // we weren't able to unlink file, so close handle and fail close( fh ); - throw( eFileOpen( sFileName, iFSServices::GetInstance()->GetErrString() ) ); + throw( eFileOpen( sFileName, iFSServices::GetInstance()->GetErrString() ) ); } } +#endif // // turn the file handle into a FILE* @@ -369,3 +380,31 @@ void cFile::Truncate( File_t offset ) // throw(eFile) throw( eFileTrunc( mpData->mFileName, iFSServices::GetInstance()->GetErrString() ) ); } + +#ifdef __AROS__ +TSTRING cArosPath::AsPosix( const TSTRING& in ) +{ + if (in[0] == '/') + return in; + + TSTRING out = '/' + in; + std::replace(out.begin(), out.end(), ':', '/'); + + return out; +} + +TSTRING cArosPath::AsNative( const TSTRING& in ) +{ + if (in[0] != '/') + return in; + + int x; + for (x=1; in[x] == '/' && x &v, bool bFullPaths) const throw(eFSServices) { +#else +void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector& v, bool bFullPaths) const throw(eFSServices) +{ + TSTRING strFilename = cArosPath::AsNative(strFilenameC); +#endif + //Get all the filenames DIR* dp; dp = opendir( strFilename.c_str() ); @@ -328,8 +335,14 @@ void cUnixFSServices::SetTempDirName(TSTRING& tmpPath) { } +#ifndef __AROS__ void cUnixFSServices::Stat( const TSTRING& strName, cFSStatArgs &stat ) const throw(eFSServices) { +#else +void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const throw(eFSServices) +{ + TSTRING strName = cArosPath::AsNative(strNameC); +#endif //local variable for obtaining info on file. struct stat statbuf; diff --git a/src/db/hierdbnode.h b/src/db/hierdbnode.h index 51636d4..a3b58d5 100644 --- a/src/db/hierdbnode.h +++ b/src/db/hierdbnode.h @@ -143,7 +143,7 @@ public: class cHierRoot : public cHierNode { public: - cHierRoot() : cHierNode( TYPE_ROOT ) {} + cHierRoot() : cHierNode( TYPE_ROOT ), mbCaseSensitive(true), mDelimitingChar('/') {} cHierAddr mChild; // points to a cHierArray or an invalid address bool mbCaseSensitive; // determines the case-sensitiveness of lookups, ordering, etc. @@ -177,10 +177,11 @@ public: } mChild.Read ( arch ); int32 cs; - arch.ReadInt32 ( cs ); + arch.ReadInt32(cs); mbCaseSensitive = cs ? true : false; TSTRING dc; - arch.ReadString ( dc ); + arch.ReadString(dc); + if( dc.length() != 1 ) { ASSERT( false ); diff --git a/src/fco/fcodatasourceiterimpl.cpp b/src/fco/fcodatasourceiterimpl.cpp index a9846db..7c8b9ec 100644 --- a/src/fco/fcodatasourceiterimpl.cpp +++ b/src/fco/fcodatasourceiterimpl.cpp @@ -200,10 +200,7 @@ void cFCODataSourceIterImpl::Next() iFCO* cFCODataSourceIterImpl::CreateFCO() //throw (eError) { ASSERT( ! Done() ); - - if( ! InitializeTypeInfo( *mCurPos ) ) - return 0; - + InitializeTypeInfo( *mCurPos ); (*mCurPos)->AddRef(); return *mCurPos; } diff --git a/src/fco/fconame.cpp b/src/fco/fconame.cpp index 312c94b..3220c82 100644 --- a/src/fco/fconame.cpp +++ b/src/fco/fconame.cpp @@ -93,7 +93,7 @@ void cFCOName::ClearNameTable() // ctor, dtor /////////////////////////////////////////////////////////////////////////////// cFCOName::cFCOName(iFCONameInfo* pNI) : - mpPathName(0) + mpPathName(0), mDelimiter('/') { SetNameInfo(pNI); mpPathName = new cFCOName_i; @@ -118,7 +118,7 @@ cFCOName::cFCOName(const cFCOName& rhs) : } cFCOName::cFCOName(const TSTRING& rhs, iFCONameInfo* pNI) : - mpPathName(0) + mpPathName(0), mDelimiter('/') { SetNameInfo(pNI); mpPathName = new cFCOName_i; @@ -132,7 +132,7 @@ cFCOName::cFCOName(const TSTRING& rhs, iFCONameInfo* pNI) : } cFCOName::cFCOName(const TCHAR* rhs, iFCONameInfo* pNI) : - mpPathName(0) + mpPathName(0), mDelimiter('/') { SetNameInfo(pNI); mpPathName = new cFCOName_i; @@ -211,88 +211,43 @@ void cFCOName::operator = (const TCHAR* rhs) #endif } -/////////////////////////////////////////////////////////////////////////////// -// ParseString -// here is how the string is broken down: between every item in -// mpPathName.mNames, there is assumed to be a delimiter. It is assumed there -// is no delimiter at the beginning of the path. If there is, or if -// double delimiters appear anywhere, that is signified by putting an empty -// string into the list. Any delimiter that appears at the end of the string -// is removed (so that /etc/ becomes /etc) -/////////////////////////////////////////////////////////////////////////////// - -#define RADS_NTMBS_VER // Try it out first -#ifndef RADS_NTMBS_VER - -void cFCOName::ParseString(const TCHAR* str) -{ - ASSERT(mpPathName); - mpPathName->ClearList(); - int len = _tcslen(str); - - TSTRING name; - const TCHAR* pEnd = str + len; - const TCHAR* pChar = str; - - // break off the next word to add.. - const TCHAR* pBegin = pChar; - while(pChar < pEnd) - { - while((*pChar != mDelimiter) && (pChar < pEnd)) - pChar++; - // if pChar == pBegin, then we have an extra delimiter; add it. - // TODO -- right now, I will suppress the final delimiter; I don't know if this is the - // right thing to do - if(pChar == pBegin) - { - // NOTE -- there is a special case here -- "/" (the root directory); it will be represented - // as a single empty node. This is handled by the (pChar != str) below. - if((pChar + 1 >= pEnd) && (pChar != str)) - // don't add the trailing slash - break; - name = _T(""); - } - else - name.assign(pBegin, (pChar - pBegin)); - cFCONameTblNode* pNode = cFCOName_i::msNameTbl.CreateNode(name); - mpPathName->mNames.push_back(pNode); - pBegin = ++pChar; - } -} - -#else//RADS_NTMBS_VER - - void cFCOName::ParseString( const TCHAR* pszin ) { - ASSERT( mpPathName != 0); - - mpPathName->ClearList(); - - TSTRING ats = const_cast(pszin + 0); - TSTRING::const_iterator at = ats.begin(); - TSTRING::const_iterator end = at; - while ( *end ) ++end; // NOTE: Find end + ASSERT(mpPathName != 0); + ASSERT(pszin != 0); + + mpPathName->ClearList(); + + const TCHAR* at = (pszin + 0); + const TCHAR* begin = at; + const TCHAR* end = at; + int components = 0; - TSTRING::const_iterator beg = at; - while ( at < end ) - { - while ( !(*at == mDelimiter) && at < end ) - at = *at ? at + 1 : at; + while (*end) + ++end; - if ( at == beg && (*at ? at + 1 : at) >= end && at != ats.begin() ) - break; + while (at < end) + { + while (*at && !(*at == mDelimiter) && (at < end)) + at++; - cFCONameTblNode* pNode = - cFCOName_i::msNameTbl.CreateNode( TSTRING( beg, at ) ); + TSTRING name(begin, at); - mpPathName->mNames.push_back( pNode ); - - beg = ( at = (*at ? at + 1 : at) ); - } + if (name.length() > 0 || components == 0) + { + cFCONameTblNode* pNode = + cFCOName_i::msNameTbl.CreateNode(name); + + mpPathName->mNames.push_back(pNode); + } + + components++; + at++; + begin=at; + //begin = (at = tss::strinc(at)); + } } -#endif//RADS_NTMBS_VER /////////////////////////////////////////////////////////////////////////////// // AsString @@ -317,14 +272,15 @@ TSTRING cFCOName::AsString() const return str; } // end ugly root dir hacks ... - ListType::iterator i = mpPathName->mNames.begin(); while(i != mpPathName->mNames.end()) { + TSTRING current = (*i)->GetString(); // the loop is constructed in this odd fashion because I don't want a trailing mDelimiter - str += (*i)->GetString(); + str += current; i++; - if(i != mpPathName->mNames.end()) + + if(i != mpPathName->mNames.end() && current != "/") str += mDelimiter; } @@ -411,17 +367,15 @@ void cFCOName::Read(iSerializer* pSerializer, int32 version) TSTRING str; pSerializer->ReadString(str); + int16 dummy = 0; // serialize the delimiter #ifdef _UNICODE pSerializer->ReadInt16( (int16&)mDelimiter ); #else - pSerializer->ReadInt16( dummy ); - const wchar_t wc = dummy; - size_t N = ::wcstombs( &mDelimiter, &wc, 1 ); - if ( N == (size_t)-1 ) - throw eCharacterEncoding(); + pSerializer->ReadInt16( dummy ); // delimiter, but it's always '/' anyway in OST. + mDelimiter = '/'; #endif // read the case-sensitiveness @@ -450,8 +404,7 @@ void cFCOName::Write(iSerializer* pSerializer) const #ifdef _UNICODE pSerializer->WriteInt16(mDelimiter); #else - wchar_t wc; - mbtowc(&wc, &mDelimiter, 1); + unsigned short wc = (unsigned short)'/'; pSerializer->WriteInt16(wc); #endif diff --git a/src/fco/fconame.h~ b/src/fco/fconame.h~ deleted file mode 100644 index 3e07ad0..0000000 --- a/src/fco/fconame.h~ +++ /dev/null @@ -1,231 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// fconame.h -// -// cFCOName -- represents the name of an FCO -#ifndef __FCONAME_H -#define __FCONAME_H - -#ifndef __SERIALIZABLE_H -#include "core/serializable.h" -#endif -#ifndef __FCONAMEINFO_H -#include "fconameinfo.h" -#endif - -/////////////////////////////////////////////////////////////////////////////// -// class cFCOName -- How we name a FCO. The implementation has ended up being -// a wrapper around a standard string. -/////////////////////////////////////////////////////////////////////////////// -class cFCONameTblNode; -class cFCONameIter; - -class cFCOName : public iTypedSerializable -{ - DECLARE_TYPEDSERIALIZABLE() - -public: - typedef cFCONameIter iterator; - - cFCOName(iFCONameInfo* iNI = NULL); - cFCOName(const cFCOName& rhs); - - explicit cFCOName(const TSTRING& rhs, iFCONameInfo* iNI = NULL); - explicit cFCOName(const TCHAR* rhs, iFCONameInfo* iNI = NULL); - // these ctors are explicit because it is expensive to create these things, so we don't want to - // do it unexpectedly - virtual ~cFCOName(); - - void operator = (const cFCOName& rhs); - void operator = (const TSTRING& rhs); - void operator = (const TCHAR* rhs); - - bool operator < (const cFCOName& rhs) const; - // defines an arbitrary order for cFCONames. This is so that names can - // be stored in trees and other ordered data structures in order to facilitate - // fast lookups. - - bool operator == (const cFCOName& rhs) const; - bool operator != (const cFCOName& rhs) const; - bool IsEqual (const cFCOName& rhs) const; - // both of these are synonyms for (GetRelationship(rhs) == REL_EQUAL) - - TSTRING AsString() const; - // return a string representation of the string - - bool IsCaseSensitive() const; - void SetCaseSensitive(bool val); - // determines how name comparisons are done. If two cFCONames are compared who are - // both case insensitive, a case insensitive compare is done. If both are case sensitive, - // a case sensitive compare is done. If one is and one isn't case sensitive (? TODO: what - // is the right thing to do in this case? ASSERT(0)? do a case sensitive compare??) - TCHAR GetDelimiter() const; - void SetDelimiter(TCHAR delimiter); - // defines what the path-delimiting character is - - void Push(const TSTRING& str); - // pushes the named string onto the end of the path. A delimiter is implicitely placed between the old end - // and the new string. if debug is defined, it is asserted that the new string does not contain the - // delimiting character - const TCHAR* Pop(); - // removes the last part of the path from the name and returns it. ASSERTS and returns an undefined value if - // the path is empty - const TCHAR* PopFront(); - // removes the first part of the path from the name and returns it. ASSERTS and returns an undefined value if - // the path is empty - void Clear(); - // removes all elements from the name; after this, GetSize() == 0. - const TCHAR* GetShortName() const; - // this will return the final string in the vector. It will assert that the name is not empty. - int GetSize() const; - // returns the number of path items (strings between delimiters) that are in the fco name. It is always equal - // to the number of delimiters in the path plus one. - - enum Relationship - { - REL_BELOW, // an fco is below another (/etc/passwd is below /etc) - REL_ABOVE, // an fco is above another (/etc is above /etc/passwd) - REL_EQUAL, // the fcos are equal (/etc/passwd is equal to /etc/passwd) - REL_UNRELATED // the fcos are unrelated (/var/spool/mail is unrelated to /var/log/pig.log) - }; - Relationship GetRelationship(const cFCOName& rhs) const; - // returns the relationship of _this_ name to the one passed in (ie -- if REL_BELOW is returned, - // this fco name is below the one passed in) - - virtual void Read (iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) - virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) - - ////////////////////////////////// - // Debugging method - ////////////////////////////////// - static void ClearNameTable(); - // this method should _only_ be called when the program is exiting, and you are positively sure you - // will not be using or creating any more cFCONames. Violating this rule will result in unpredictable - // results. This clears out the cFCOName internal name table, making memory leaks easier to find. -protected: - friend class cFCOName_i; - friend class cFCONameIter; - - void ParseString(const TCHAR* str); - // helper function that takes the pathname pointer to by str and fills out mpPathName - void CopyOnModify(); - // if the fconame is modified and mpPathName is shared by more than one object, this will - // release mpPathName and create a new one, so we don't change any other object's data - void SetNameInfo(iFCONameInfo* pNI); - // sets the delimiter and case sensitiveness to the name info's - - cFCOName_i* mpPathName; - TCHAR mDelimiter; // the delimiting character in names (ie -- in file systems, it is '/') - bool mbCaseSensitive; // determines whether name compares are case sensitive of not - - // this is what type of structure holds the elements of the name - // - typedef std::vector ListType; - -#ifdef _DEBUG - TSTRING mDebugStrName; // so we can see this guy's value in the debug window -#endif -}; - -//----------------------------------------------------------------------------- -// cFCONameIter -//----------------------------------------------------------------------------- -class cFCONameIter_i; -class cFCONameIter -{ -public: - cFCONameIter(const cFCOName& name); - ~cFCONameIter(); - - int GetSize() const; // returns the number of entries in the fco name - void SeekBegin(); - void Next(); - void Prev(); - bool Done() const; - - int Index() const; - // return the current offset from the beginning of the short name list - void SeekTo( int index ); - // seeks to the given index. asserts that the index is appropriate for the - // current fco name. - - const TCHAR* GetName() const; -private: - void operator=(const cFCONameIter& rhs); // not impl - cFCONameIter(const cFCONameIter& rhs); // not impl - - // the data... - // - const cFCOName& mName; - cFCOName::ListType::const_iterator mIter; -}; - -//############################################################################# -// inline implementation -inline bool cFCOName::IsCaseSensitive() const -{ - return mbCaseSensitive; -} -inline void cFCOName::SetCaseSensitive(bool val) -{ - mbCaseSensitive = val; -} -inline TCHAR cFCOName::GetDelimiter() const -{ - return mDelimiter; -} -inline void cFCOName::SetDelimiter(TCHAR delimiter) -{ - mDelimiter = delimiter; -} - -/////////////////////////////////////////////////////////////////////////////// -// IsEqual -/////////////////////////////////////////////////////////////////////////////// -inline bool cFCOName::IsEqual(const cFCOName& rhs) const -{ - return (GetRelationship(rhs) == cFCOName::REL_EQUAL); -} - -inline bool cFCOName::operator==(const cFCOName& rhs) const -{ - return IsEqual(rhs); -} -inline bool cFCOName::operator!=(const cFCOName& rhs) const -{ - return (! IsEqual(rhs)); -} - - -#endif //__FCONAME_H - diff --git a/src/fco/fcosetimpl.h~ b/src/fco/fcosetimpl.h~ deleted file mode 100644 index 90d7c19..0000000 --- a/src/fco/fcosetimpl.h~ +++ /dev/null @@ -1,128 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// fcosetimpl.h -// -// class cFCOSetImpl -- concrete implementation of an FCO set -// class cFCOIterImpl -- the iterator over the set -#ifndef __FCOSETIMPL_H -#define __FCOSETIMPL_H - -#ifndef __FCO_H -#include "fco.h" -#endif -#include "fconame.h" - -#ifndef __FCONAME_H -#include "fconame.h" -#endif - -class cFCOSetImpl : public iFCOSet -{ - friend class cFCOIterImpl; - DECLARE_TYPEDSERIALIZABLE() - -public: - cFCOSetImpl(); - cFCOSetImpl(const cFCOSetImpl& rhs); - virtual ~cFCOSetImpl(); - void operator=(const cFCOSetImpl& rhs); - - virtual const iFCOIter* Lookup(const cFCOName& name) const; - virtual iFCOIter* Lookup(const cFCOName& name); - virtual const iFCOIter* GetIter() const; - virtual iFCOIter* GetIter(); - virtual void Insert(iFCO* pFCO); - virtual void Clear(); - virtual bool IsEmpty() const; - virtual int Size() const { return mFCOSet.size(); }; - virtual void TraceContents(int dl = -1) const; - - // iSerializable interface - virtual void Read (iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) - virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) -private: - void ReturnIter(const cFCOIterImpl* pIter) const; - // returns the iterator to its owner; the reciprocal action - // to Lookup() or GetIter(); called by the iterator when it is destroyed - - // class we store in the set below; it is a hack that allows us to - // look up iFCOs using cFCONames in a std::set - class cFCONode - { - public: - iFCO* mpFCO; - const cFCOName* mpFCOName; - - cFCONode() : mpFCO(0), mpFCOName(0) {} - cFCONode(iFCO* pFCO) : mpFCO(pFCO), mpFCOName(&pFCO->GetName()) {} - cFCONode(const cFCOName& name) : mpFCO(0), mpFCOName(&name) {} - cFCONode(const cFCONode& rhs) : mpFCO(rhs.mpFCO), mpFCOName(rhs.mpFCOName) {} - bool operator < (const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName < *rhs.mpFCOName); else return false; } - bool operator ==(const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName == *rhs.mpFCOName); else return false; } - }; - - std::set mFCOSet; - // this is what actually stores the iFCOs. -}; - -class cFCOIterImpl : public iFCOIter -{ - friend class cFCOSetImpl; - -public: - cFCOIterImpl(cFCOSetImpl* pSet); - cFCOIterImpl(const cFCOSetImpl* pSet); - - virtual void SeekBegin() const; - virtual bool Done() const; - virtual bool IsEmpty() const; - virtual void Next() const; - virtual const iFCO* FCO() const; - virtual iFCO* FCO(); - virtual bool SeekToFCO(const cFCOName& name) const; - - virtual void Remove(); - virtual void Remove() const; - virtual void DestroyIter() const; -private: - virtual ~cFCOIterImpl() ; - - cFCOSetImpl* mpSet; - mutable std::set::iterator mIter; - // the definition of a const iterator is not that its position cannot change, - // but that it cannot modify the set it is iterating over, hence the "mutable" -}; - - -#endif //__FCOSETIMPL_H - diff --git a/src/fs/fsparserutil.cpp b/src/fs/fsparserutil.cpp index 0c08e50..163fc76 100644 --- a/src/fs/fsparserutil.cpp +++ b/src/fs/fsparserutil.cpp @@ -41,6 +41,7 @@ #include "fsparserutil.h" #include "core/fsservices.h" +#include "core/file.h" #include "fspropset.h" #include "fsstrings.h" #include "fco/fcopropvector.h" @@ -136,6 +137,10 @@ void cFSParserUtil::InterpretFCOName( const std::list& l, cFCOName& nam for( std::list::const_iterator i = l.begin(); i != l.end(); i++ ) strT += *i; +#ifdef __AROS__ + strT = cArosPath::AsPosix(strT); +#endif + // let cFCOName handle interpretation nameOut = strT; } diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index a5bd3c9..c838c53 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -70,6 +70,12 @@ #define INVALID_SOCKET -1 +#ifdef __AROS__ + #ifndef HAVE_GETHOSTNAME + #define HAVE_GETHOSTNAME 1 + #endif +#endif + #ifndef HAVE_GETHOSTNAME static int gethostname( char* name, int namelen ) { @@ -91,7 +97,6 @@ static int gethostname( char* name, int namelen ) } } #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. diff --git a/src/tripwire/syslog_trip.cpp b/src/tripwire/syslog_trip.cpp index dab273a..c70681d 100644 --- a/src/tripwire/syslog_trip.cpp +++ b/src/tripwire/syslog_trip.cpp @@ -54,6 +54,12 @@ #include "tw/twerrors.h" #include "tw/twstrings.h" +#ifdef __AROS__ + #include + #define openlog(a,b,c) + #define closelog() +#endif + /////////////////////////////////////////////////////////////////////////////// // Syslog /////////////////////////////////////////////////////////////////////////////// diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 6d50bf3..cfccb72 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -304,6 +304,12 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) // make sure it exists... // + + +#ifdef __AROS__ + str = cArosPath::AsNative(str); +#endif + if (access(str.c_str(), F_OK) != 0) { TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY ); TSTRING tmpStr = _T("Directory: "); diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index 5e1af78..8747f7e 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -79,6 +79,13 @@ #include "core/tw_signal.h" // to ignore SIGPIPE #endif +#ifdef __AROS__ +#include +#include +#include + +static bool aros_socketbase_init(); +#endif //============================================================================= // cTWInit_i @@ -238,6 +245,9 @@ void cTWInit::Init( const TSTRING& strArgv0 ) // END:RAD // ------------------------------------------------------------ +#ifdef __AROS__ + aros_socketbase_init(); +#endif // // set up the file system services // @@ -305,4 +315,27 @@ void cTWInit::Init( const TSTRING& strArgv0 ) } +#ifdef __AROS__ +struct Library* SocketBase=0; + +bool aros_socketbase_init() +{ + if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) + { + printf("Failed to load socket library"); + return 0; + } + + if (SocketBaseTags( + SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR)&errno, + SBTM_SETVAL(SBTC_HERRNOLONGPTR), (IPTR)&errno, + TAG_DONE)) + { + printf("Failed to init socket library"); + return 0; + } + return 1; +} +#endif +