#if GDEF_OS_WINDOWS
#include <direct.h>
#include <windows.h>
-#endif
-
-#if GDEF_OS_LINUX || GDEF_OS_MACOS
+#elif GDEF_OS_NEXT
+#include <libc.h>
+#else // OTHER OSES
#include <unistd.h>
-#endif
+#endif // OTHER OSES
-#ifdef NeXT
-#include <libc.h>
-#endif
+#if !GDEF_OS_WINDOWS
+#define strlwr strlower
+#endif // !GDEF_OS_WINDOWS
#define BASEDIRNAME "h"
-#define PATHSEPERATOR '/'
+#define PATHSEPERATOR '/'
extern qboolean verbose;
return p;
}
-#endif
+#endif // !SAFE_MALLOC
void *SafeMalloc( size_t n, char *desc ){
void *p;
return p;
}
-#if GDEF_OS_LINUX || GDEF_OS_MACOS
-void strlwr( char *conv_str ){
- int i;
-
- for ( i = 0; i < strlen( conv_str ); i++ )
- conv_str[i] = tolower( conv_str[i] );
-}
-#endif
-
-
// set these before calling CheckParm
int myargc;
char **myargv;
===================
*/
#define MAX_EX_ARGC 1024
+
int ex_argc;
char *ex_argv[MAX_EX_ARGC];
+
#if GDEF_OS_WINDOWS
#include "io.h"
void ExpandWildcards( int *argc, char ***argv ){
*argc = ex_argc;
*argv = ex_argv;
}
-#else
+#else // !GDEF_OS_WINDOWS
void ExpandWildcards( int *argc, char ***argv ){
}
-#endif
+#endif // !GDEF_OS_WINDOWS
/*
#if GDEF_OS_WINDOWS
_getcwd( out, 256 );
strcat( out, "\\" );
-#else
+#else // !GDEF_OS_WINDOWS
// Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow
getcwd( out, 256 );
strcat( out, "/" );
-#endif
+#endif // !GDEF_OS_WINDOWS
while ( out[i] != 0 )
{
if ( out[i] == '\\' ) {
if ( _mkdir( path ) != -1 ) {
return;
}
-#else
+#else // !GDEF_OS_WINDOWS
if ( mkdir( path, 0777 ) != -1 ) {
return;
}
-#endif
+#endif // !GDEF_OS_WINDOWS
if ( errno != EEXIST ) {
Error( "mkdir %s: %s",path, strerror( errno ) );
}
Extract file parts
====================
*/
+
// FIXME: should include the slash, otherwise
// backing to an empty path will be wrong when appending a slash
void ExtractFilePath( const char *path, char *dest ){
}
-#else
+#else // !GDEF_ARCH_ENDIAN_BIG
short BigShort( short l ){
return l;
}
-
-#endif
+#endif // ! GDEF_ARCH_ENDIAN_BIG
//=======================================================
olddrive = _getdrive();
_chdrive( toupper( path[0] ) - 'A' + 1 );
}
-#endif
+#endif // !GDEF_OS_WINDOWS
if ( path[1] == ':' ) {
path += 2;
if ( olddrive != -1 ) {
_chdrive( olddrive );
}
-#endif
+#endif // !GDEF_OS_WINDOWS
}
void Sys_Sleep( int n ){
#if GDEF_OS_WINDOWS
Sleep( n );
-#endif
-#if GDEF_OS_LINUX || GDEF_OS_MACOS
+#else // !GDEF_OS_WINDOWS
usleep( n * 1000 );
-#endif
+#endif // !GDEF_OS_WINDOWS
}