r589 - trunk/code/unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Feb 26 16:22:12 EST 2006


Author: tma
Date: 2006-02-26 16:22:12 -0500 (Sun, 26 Feb 2006)
New Revision: 589

Modified:
   trunk/code/unix/unix_main.c
Log:
* Lets try that again


Modified: trunk/code/unix/unix_main.c
===================================================================
--- trunk/code/unix/unix_main.c	2006-02-26 20:01:45 UTC (rev 588)
+++ trunk/code/unix/unix_main.c	2006-02-26 21:22:12 UTC (rev 589)
@@ -1346,38 +1346,24 @@
 */
 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;




More information about the quake3-commits mailing list