]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/cmdlib.c
reduce more diff noise
[xonotic/netradiant.git] / tools / quake3 / common / cmdlib.c
index 5164001c04fae612b26de2758328c07e01fbfb03..b74c7b3362ba47b5bfeaa1edfff692bf8fbf5c63 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
    For a list of contributors, see the accompanying CONTRIBUTORS file.
 
    This file is part of GtkRadiant.
 // replaced qprintf with Sys_Printf
 
 #include "cmdlib.h"
+#include "globaldefs.h"
 #include "mathlib.h"
 #include "inout.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
@@ -95,7 +96,7 @@ char archivedir[1024];
 #define MAX_EX_ARGC 1024
 int ex_argc;
 char    *ex_argv[MAX_EX_ARGC];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void ExpandWildcards( int *argc, char ***argv ){
        struct _finddata_t fileinfo;
@@ -244,41 +245,14 @@ char *ExpandArg( const char *path ){
 
 char *ExpandPath( const char *path ){
        static char full[1024];
-       if ( !*qdir || path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
-               strcpy( full, path );
-               return full;
-       }
-       sprintf( full, "%s%s", qdir, path );
-       return full;
-}
-
-char *ExpandGamePath( const char *path ){
-       static char full[1024];
-       if ( !*gamedir ) {
-               Error( "ExpandGamePath called without gamedir set" );
-       }
        if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
                strcpy( full, path );
                return full;
        }
-       sprintf( full, "%s%s", gamedir, path );
+       sprintf( full, "%s%s", qdir, path );
        return full;
 }
 
-char *ExpandPathAndArchive( const char *path ){
-       char    *expanded;
-       char archivename[1024];
-
-       expanded = ExpandPath( path );
-
-       if ( archive ) {
-               sprintf( archivename, "%s/%s", archivedir, path );
-               QCopyFile( expanded, archivename );
-       }
-       return expanded;
-}
-
-
 char *copystring( const char *s ){
        char    *b;
        b = safe_malloc( strlen( s ) + 1 );
@@ -319,7 +293,7 @@ double I_FloatTime( void ){
 void Q_getwd( char *out ){
        int i = 0;
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        _getcwd( out, 256 );
        strcat( out, "\\" );
 #else
@@ -345,7 +319,7 @@ void Q_mkdir( const char *path ){
        int retry = 2;
        while ( retry-- )
        {
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
                const char *q = NULL;
                if ( _mkdir( path ) != -1 ) {
                        return;
@@ -909,11 +883,7 @@ int ParseNum( const char *str ){
    ============================================================================
  */
 
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort( short l ){
        byte b1,b2;
@@ -1085,7 +1055,7 @@ void    CreatePath( const char *path ){
        char c;
        char dir[1024];
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        int olddrive = -1;
 
        if ( path[1] == ':' ) {
@@ -1108,7 +1078,7 @@ void    CreatePath( const char *path ){
                }
        }
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        if ( olddrive != -1 ) {
                _chdrive( olddrive );
        }
@@ -1134,10 +1104,10 @@ void QCopyFile( const char *from, const char *to ){
 }
 
 void Sys_Sleep( int n ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        Sleep( n );
 #endif
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        usleep( n * 1000 );
 #endif
 }