diff --git a/mozilla/lib/xp/xp_file.c b/mozilla/lib/xp/xp_file.c index 290f94df35a..7919e30c13a 100644 --- a/mozilla/lib/xp/xp_file.c +++ b/mozilla/lib/xp/xp_file.c @@ -33,6 +33,10 @@ #include "prefapi.h" #endif +#ifdef XP_BEOS +#include +#endif + #ifdef XP_MAC #include "xp_file_mac.h" #endif @@ -43,7 +47,7 @@ XP_BEGIN_PROTOS -#if defined (XP_MAC) || defined(XP_UNIX) +#if defined (XP_MAC) || defined(XP_UNIX) || defined(XP_BEOS) /* Now that Mac is using stdio, we can share some of this. Yay. Presumably Windows can share this too, but they keep these functions in the FE, so I don't know. @@ -66,7 +70,7 @@ XP_File XP_FileOpen( const char* name, XP_FileType type, { char* newName = WH_FileName(name, type); XP_File result; -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) XP_StatStruct st; XP_Bool make_private_p = FALSE; #endif @@ -78,7 +82,7 @@ XP_File XP_FileOpen( const char* name, XP_FileType type, if (newName == NULL) return NULL; -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) switch (type) { /* These files are always private: if the user chmods them, we @@ -187,9 +191,9 @@ XP_File XP_FileOpen( const char* name, XP_FileType type, } #endif -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) if (make_private_p && result) -#ifdef SCO_SV +#if defined(SCO_SV) || defined(XP_BEOS) chmod (newName, S_IRUSR | S_IWUSR); /* rw only by owner */ #else fchmod (fileno (result), S_IRUSR | S_IWUSR); /* rw only by owner */ @@ -218,7 +222,7 @@ extern XP_Bool XP_FileNameContainsBadChars (const char *name) #endif #endif /* XP_MAC || XP_UNIX */ -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) /* This is just like fclose(), except that it does fflush() and fsync() first, to ensure that the bits have made it to the disk before we return. @@ -258,7 +262,7 @@ int XP_FileClose(XP_File file) XP_END_PROTOS -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) #include /* for getpid */ @@ -1125,7 +1129,7 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) { extern void fe_GetProgramDirectory(char *path, int len); char *policyFN = "moz40p3"; - char *mozHome = getenv("MOZILLA_FIVE_HOME"); + char *mozHome = PR_GetEnv("MOZILLA_FIVE_HOME"); char *lang = getenv("LANG"); char dirName[1024]; @@ -1547,7 +1551,7 @@ XP_Dir XP_OpenDir(const char * name, XP_FileType type) #endif #endif /* XP_UNIX */ -#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) /* * Make all the directories specified in the path @@ -1562,7 +1566,7 @@ int XP_MakeDirectoryR(const char* name, XP_FileType type) #ifdef XP_WIN separator = '\\'; skipfirst = 3; -#elif defined XP_UNIX +#elif defined(XP_UNIX) || defined(XP_BEOS) separator = '/'; skipfirst = 1; #endif @@ -1720,6 +1724,27 @@ WH_TempName(XP_FileType type, const char * prefix) #define MOZ_USER_DIR ".mozilla" #endif +#if defined XP_BEOS +char *fe_GetConfigDir(void) +{ + char path[1024]; + if(find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, path, sizeof(path)) == B_OK) + { + char *config_dir; + + int len = strlen(path); + len += strlen("/mozilla"); + + config_dir = (char *)XP_CALLOC(len, sizeof(char)); + /* we really should use XP_STRN*_SAFE but this is MODULAR_NETLIB */ + XP_STRCPY(config_dir, path); + XP_STRCAT(config_dir, "/mozilla"); + return config_dir; + } + + return strdup("/tmp"); +} +#else char *fe_GetConfigDir(void) { char *home = getenv("HOME"); if (home) { @@ -1739,6 +1764,6 @@ char *fe_GetConfigDir(void) { return strdup("/tmp"); } - +#endif /* XP_BEOS */ /******************************************************************************/ diff --git a/mozilla/lib/xp/xp_linebuf.c b/mozilla/lib/xp/xp_linebuf.c index 0836506c13a..5b4667a4ec4 100644 --- a/mozilla/lib/xp/xp_linebuf.c +++ b/mozilla/lib/xp/xp_linebuf.c @@ -48,7 +48,7 @@ extern int MK_OUT_OF_MEMORY; # define LINEBREAK "\015\012" # define LINEBREAK_LEN 2 # else -# ifdef XP_UNIX +# if defined(XP_UNIX) || defined(XP_BEOS) # define LINEBREAK "\012" # define LINEBREAK_LEN 1 # endif /* XP_UNIX */ diff --git a/mozilla/lib/xp/xp_wrap.c b/mozilla/lib/xp/xp_wrap.c index b2176ba7eb5..a1dae9986f2 100644 --- a/mozilla/lib/xp/xp_wrap.c +++ b/mozilla/lib/xp/xp_wrap.c @@ -428,7 +428,7 @@ XP_WordWrapWithPrefix(int charset, unsigned char *str, int maxColumn, # define LINEBREAK "\015" #elif defined(XP_OS2) # define LINEBREAK "\015" -#elif defined(XP_UNIX) +#elif defined(XP_UNIX) || defined(XP_BEOS) # define LINEBREAK "\012" #endif diff --git a/mozilla/network/cnvts/cvmime.c b/mozilla/network/cnvts/cvmime.c index b1a4360c1aa..8eb98eb1bf0 100644 --- a/mozilla/network/cnvts/cvmime.c +++ b/mozilla/network/cnvts/cvmime.c @@ -435,7 +435,7 @@ net_RegisterDefaultDecoders (void) NET_RegisterContentTypeConverter (APPLICATION_APPLEFILE, FO_SAVE_AS, NULL, fe_MakeAppleSingleDecodeStream_1); #endif -#if defined(XP_MAC) || defined(XP_UNIX) || defined(XP_PC) +#if defined(XP_MAC) || defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS) /* the new apple single/double and binhex decode. 20oct95 */ NET_RegisterContentTypeConverter (APPLICATION_BINHEX, FO_PRESENT, NULL, fe_MakeBinHexDecodeStream); diff --git a/mozilla/network/main/mkgeturl.c b/mozilla/network/main/mkgeturl.c index 98c644fdebd..38acc50acb3 100644 --- a/mozilla/network/main/mkgeturl.c +++ b/mozilla/network/main/mkgeturl.c @@ -781,7 +781,7 @@ NET_InitNetLib(int socket_buffer_size, int max_number_of_connections) if(max_number_of_connections < 1) max_number_of_connections = 1; -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) signal(SIGPIPE, SIG_IGN); #endif diff --git a/mozilla/network/main/mkhelp.c b/mozilla/network/main/mkhelp.c index 67365ce7af1..42fbcb80a2d 100644 --- a/mozilla/network/main/mkhelp.c +++ b/mozilla/network/main/mkhelp.c @@ -768,7 +768,7 @@ PRIVATE void net_help_init_chrome(Chrome *window_chrome, int32 w, int32 h) { window_chrome->type = MWContextHTMLHelp; - #if defined(XP_WIN) || defined(XP_UNIX) + #if defined(XP_WIN) || defined(XP_UNIX) || defined(XP_BEOS) window_chrome->topmost = FALSE; #else window_chrome->topmost = TRUE; diff --git a/mozilla/network/main/mkparse.c b/mozilla/network/main/mkparse.c index fec3c5d80d3..e4d20b6124a 100644 --- a/mozilla/network/main/mkparse.c +++ b/mozilla/network/main/mkparse.c @@ -1260,7 +1260,7 @@ int NET_MakeRelativeURL( char *base_url, /* Test if drive is different */ if ( base_ptr && url_ptr && -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) /* Case-sensitive for UNIX */ *(url_ptr-1) != *(base_ptr-1) ) #else @@ -1287,7 +1287,7 @@ int NET_MakeRelativeURL( char *base_url, /*Find first mismatched character */ while ( -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_BEOS) /* Case-sensitive for UNIX */ *base_ptr == *url_ptr && #else