From: Shamus Hammons Date: Fri, 28 Feb 2020 23:24:59 +0000 (-0600) Subject: Added check to see that include paths actually exist. X-Git-Tag: v2.1.0~35 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=3f6e05a96fd0a6c128f36ba75531e21830c579c5 Added check to see that include paths actually exist. RMAC will now yell at you if you give it a bogus include path. Thanks to ggn for the idea! Now at v2.0.11. --- diff --git a/rmac.c b/rmac.c index bcb587a..9f52e0b 100644 --- a/rmac.c +++ b/rmac.c @@ -50,7 +50,7 @@ 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; // Search path for include files +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 optim_pc = 0; // Enforce PC relative @@ -154,7 +154,7 @@ void DisplayHelp(void) " p: P56 (use this for DSP56001 only)\n" " l: LOD (use this for DSP56001 only)\n" " x: com/exe/xex (Atari 800)\n" - " r: absolute address" + " r: absolute address\n" " -i[path] Directory to search for include files\n" " -l[filename] Create an output listing file\n" " -l*[filename] Create an output listing file without pagination\n" @@ -393,8 +393,26 @@ int Process(int argc, char ** argv) break; case 'i': // Set directory search path case 'I': + { searchpath = argv[argno] + 2; + + // Check to see if include paths actually exist + if (strlen(searchpath) > 0) + { + DIR * test = opendir(searchpath); + + if (test == NULL) + { + printf("Invalid include path: %s\n", searchpath); + errcnt++; + return errcnt; + } + + closedir(test); + } + break; + } case 'l': // Produce listing file case 'L': if (*(argv[argno] + 2) == '*') diff --git a/rmac.h b/rmac.h index 1c6fcf1..3d23ed5 100644 --- a/rmac.h +++ b/rmac.h @@ -153,6 +153,7 @@ // Non-target specific stuff // #include +#include #include "symbol.h" #define BYTE uint8_t diff --git a/version.h b/version.h index 7d8787f..1346d16 100644 --- a/version.h +++ b/version.h @@ -15,7 +15,7 @@ #define MAJOR 2 // Major version number #define MINOR 0 // Minor version number -#define PATCH 10 // Patch release number +#define PATCH 11 // Patch release number #endif // __VERSION_H__