--- ray/src/common/paths.h 2016/03/06 01:13:17 2.27 +++ ray/src/common/paths.h 2025/06/03 21:31:51 2.32 @@ -1,4 +1,4 @@ -/* RCSid $Id: paths.h,v 2.27 2016/03/06 01:13:17 schorsch Exp $ */ +/* RCSid $Id: paths.h,v 2.32 2025/06/03 21:31:51 greg Exp $ */ /* * Definitions for paths on different machines */ @@ -20,7 +20,10 @@ #define access _access #define mkdir(dirname,perms) _mkdir(dirname) - #ifdef _MSC_VER + /* The windows _popen with the native shell breaks '\\\n' escapes. + * RT_WINPROC (used by SCons) enables our replacement functions to fix that. + * XXX This should really not depend on the compiler used! */ + #if 1 /* defined(_MSC_VER) && !defined(RT_WINPROC) */ #define popen(cmd,mode) _popen(cmd,mode) #define pclose(p) _pclose(p) #else @@ -89,7 +92,6 @@ #ifndef DEFPATH #define DEFPATH ";/ray/lib" #endif - #define fixargv0(a0) (a0) #else @@ -103,7 +105,7 @@ #define CURDIR '.' #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} #define TEMPLATE "/tmp/rtXXXXXX" - #define TEMPLEN 17 + #define TEMPLEN 13 #define ULIBVAR "RAYPATH" #ifndef DEFPATH #define DEFPATH ":/usr/local/lib/ray" @@ -111,7 +113,6 @@ #define SPECIALS " \t\n'\"()${}*?[];|&" #define QUOTCHAR '\'' #define ALTQUOT '"' - #define fixargv0(a0) (a0) #endif #endif @@ -130,8 +131,11 @@ extern "C" { #if defined(_WIN32) || defined(_WIN64) extern FILE *win_popen(char *command, char *type); extern int win_pclose(FILE *p); - extern char *fixargv0(); #endif + +/* Set global progname and return path-free version of argv[0] */ +extern char *fixargv0(char *arg0); +extern char *progname; /* Check if any of the characters in str2 are found in str1 */ extern int matchany(const char *str1, const char *str2);