Patch to STk_whence for paths without "."

From: David Fox <fox_at_graphics.cs.nyu.edu>
Date: 17 Oct 1996 12:46:11 -0400

This patch lets STk built a value in STk_Argv0 even when the user's
$PATH doesn't contain ".". It also tends to handle relative pathnames
in argv[0] more correctly -- the original code can find the wrong
executable depending on the order of the path elements.

diff -ru STk-3.1/Src/unix.c~ STk-3.1/Src/unix.c
--- STk-3.1/Src/unix.c~ Sun Jul 21 11:22:37 1996
+++ STk-3.1/Src/unix.c Thu Oct 17 12:39:59 1996
_at_@ -445,6 +445,13 @@
     return;
   }
 
+ if (exec[0] == '.') {
+ getcwd(path, MAX_PATH_LENGTH);
+ strcat(path, "/");
+ strcat(path, exec);
+ return;
+ }
+
 #ifdef FREEBSD
   /* I don't understand why this is needed */
   if (access(path, X_OK) == 0) {
-- 
David Fox	   http://found.cs.nyu.edu/fox		xoF divaD
NYU Media Research Lab   fox_at_cs.nyu.edu    baL hcraeseR aideM UYN
Received on Thu Oct 17 1996 - 19:23:18 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST