Fix RMACPATH
authorJames Jones <atari@theinnocuous.com>
Thu, 27 Aug 2020 05:19:26 +0000 (22:19 -0700)
committerShamus Hammons <jlhamm@acm.org>
Tue, 29 Sep 2020 03:04:40 +0000 (22:04 -0500)
Commit 9ecc6f5e49e1740adee78dd45e1115c7e4fcc314
(Fix for bug #167) fixed specifying multiple
include directories on the command line, but in
doing so broke specifying any include directories
via the RMACPATH environment variable.  Fix this
by restoring the old behavior of searchpath being
NULL if -i/-I were not specified.

rmac.c

diff --git a/rmac.c b/rmac.c
index f43b83b8e6e2fb1047803e5d79c593aa035e9cd0..4772d203bd93d612f5e9e6a7121ae37e98fc9786 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -50,7 +50,8 @@ int endian;                                           // Host processor endianess (0 = LE, 1 = BE)
 char * objfname;                               // Object filename pointer
 char * firstfname;                             // First source filename
 char * cmdlnexec;                              // Executable name, pointer to ARGV[0]
-char searchpath[512] = { 0 };  // Search path for include files
+char searchpatha[512] = { 0 }; // Buffer to hold searchpath when specified
+char * searchpath = NULL;              // Search path for include files
 char defname[] = "noname.o";   // Default output filename
 int optim_flags[OPT_COUNT];            // Specific optimisations on/off matrix
 int activecpu = CPU_68000;             // Active 68k CPU (68000 by default)
@@ -410,8 +411,9 @@ int Process(int argc, char ** argv)
                        case 'i':                               // Set directory search path
                        case 'I':
                        {
-                               strcat(searchpath, argv[argno] + 2);
-                strcat(searchpath, ";");
+                               strcat(searchpatha, argv[argno] + 2);
+                               strcat(searchpatha, ";");
+                               searchpath = searchpatha;
 
                                // Check to see if include paths actually exist
                                char current_path[256];