aboutsummaryrefslogtreecommitdiffstats
path: root/code/unix/unix_main.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-26 21:22:12 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-26 21:22:12 +0000
commit190a18fba96162391f1feecd8c196dc94fbcd548 (patch)
tree6c9dd5e7920728c566141bbdc9ce53aa528972b7 /code/unix/unix_main.c
parent76a733c89276a52553b683ca24509f31af0cd72a (diff)
downloadioquake3-aero-190a18fba96162391f1feecd8c196dc94fbcd548.tar.gz
ioquake3-aero-190a18fba96162391f1feecd8c196dc94fbcd548.zip
* Lets try that again
git-svn-id: svn://svn.icculus.org/quake3/trunk@589 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/unix/unix_main.c')
-rw-r--r--code/unix/unix_main.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index b60a326..47746ab 100644
--- a/code/unix/unix_main.c
+++ b/code/unix/unix_main.c
@@ -1346,38 +1346,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;