summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-02-26 21:27:02 +0000
committerTim Angus <tim@ngus.net>2006-02-26 21:27:02 +0000
commitb8d0da94c3014753ce948f5d861ebfebb467eafe (patch)
tree386eeafee16f054abd7ce57dd195af030eaf1159 /src
parent310effbb68b3e335574b682bb4359d8e29f3430b (diff)
* Merged ioq3-r589
Diffstat (limited to 'src')
-rw-r--r--src/qcommon/q_shared.h4
-rw-r--r--src/qcommon/vm.c2
-rw-r--r--src/unix/unix_main.c38
3 files changed, 16 insertions, 28 deletions
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 518eab41..0059cdfa 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -105,7 +105,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef Q3_VM
typedef int intptr_t;
#else
-#include <inttypes.h>
+# ifndef _MSC_VER
+# include <stdint.h>
+# endif
#endif
typedef unsigned char byte;
diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c
index 515afc9b..27f30f09 100644
--- a/src/qcommon/vm.c
+++ b/src/qcommon/vm.c
@@ -887,6 +887,6 @@ void VM_LogSyscalls( int *args ) {
f = fopen("syscalls.log", "w" );
}
callnum++;
- fprintf(f, "%i: %"PRIiPTR" (%i) = %i %i %i %i\n", callnum, (intptr_t)(args - (int *)currentVM->dataBase),
+ fprintf(f, "%i: %p (%i) = %i %i %i %i\n", callnum, (void*)(args - (int *)currentVM->dataBase),
args[0], args[1], args[2], args[3], args[4] );
}
diff --git a/src/unix/unix_main.c b/src/unix/unix_main.c
index c9b0a781..eb815685 100644
--- a/src/unix/unix_main.c
+++ b/src/unix/unix_main.c
@@ -1347,38 +1347,24 @@ to symlink to binaries and /not/ have the links resolved.
*/
char *Sys_BinName( const char *arg0 )
{
-#ifdef NDEBUG
- int n;
- char src[ PATH_MAX ];
- char dir[ PATH_MAX ];
- qboolean links = qfalse;
-#endif
-
static char dst[ PATH_MAX ];
- Q_strncpyz( dst, arg0, PATH_MAX );
-
#ifdef NDEBUG
- while( ( n = readlink( dst, src, PATH_MAX ) ) >= 0 )
- {
- src[ n ] = '\0';
- Q_strncpyz( dir, dirname( dst ), PATH_MAX );
- Q_strncpyz( dst, dir, PATH_MAX );
- Q_strcat( dst, PATH_MAX, "/" );
- Q_strcat( dst, PATH_MAX, src );
+#ifdef __linux__
+ int n = readlink( "/proc/self/exe", dst, PATH_MAX - 1 );
- links = qtrue;
- }
+ if( n >= 0 && n < PATH_MAX )
+ dst[ n ] = '\0';
+ else
+ Q_strncpyz( dst, arg0, PATH_MAX );
+#else
+#warning Sys_BinName not implemented
+ Q_strncpyz( dst, arg0, PATH_MAX );
+#endif
- if( links )
- {
- Q_strncpyz( dst, Sys_Cwd( ), PATH_MAX );
- Q_strcat( dst, PATH_MAX, "/" );
- Q_strcat( dst, PATH_MAX, dir );
- Q_strcat( dst, PATH_MAX, "/" );
- Q_strcat( dst, PATH_MAX, src );
- }
+#else
+ Q_strncpyz( dst, arg0, PATH_MAX );
#endif
return dst;