From 65e5e80f5bf2965e3bbda6338c703b4b77b6f4d5 Mon Sep 17 00:00:00 2001 From: kvigor Date: Tue, 6 Feb 2001 18:56:44 +0000 Subject: [PATCH] if argv[0] contained a path specifier, add that to the front of the search path for my_system() git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@595 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCmain.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 69687e93..b0527087 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -75,11 +75,7 @@ char *preOutName; // In MSC VC6 default search path for exe's to path for this -#if defined(_MSC_VER) - -char DefaultExePath[_MAX_PATH]; - -#endif +char DefaultExePath[128]; /* Far functions, far data */ #define OPTION_LARGE_MODEL "-model-large" @@ -1273,7 +1269,7 @@ char *try_dir[] = //char *try_dir[]= {SRCDIR "/bin",PREFIX "/bin", NULL}; char *try_dir[] = -{NULL}; +{NULL, NULL}; /* First entry may be overwritten, so use two. */ #endif @@ -1533,6 +1529,7 @@ linkEdit (char **envp) buildCmdLine (buffer, port->linker.cmd, srcFileName, NULL, NULL, NULL); if (my_system (buffer)) { + perror ("Cannot exec linker"); exit (1); } #else @@ -1565,6 +1562,7 @@ assemble (char **envp) buildCmdLine (buffer, port->assembler.cmd, srcFileName, NULL, NULL, asmOptions); if (my_system (buffer)) { + perror ("Cannot exec assembler"); exit (1); } #else @@ -1648,6 +1646,7 @@ preProcess (char **envp) preOutName, srcFileName, preArgv); if (my_system (buffer)) { + perror ("Cannot exec Preprocessor"); exit (1); } #else @@ -1737,6 +1736,14 @@ main (int argc, char **argv, char **envp) if (i == 0) DefaultExePath[0] = '\0'; } +#else + + if (strchr(argv[0], '/')) + { + strcpy(DefaultExePath, argv[0]); + *(strrchr(DefaultExePath, '/')) = 0; + try_dir[0] = DefaultExePath; + } #endif -- 2.47.2