Fix to test to see if include paths actually exist.
authorShamus Hammons <jlhamm@acm.org>
Fri, 28 Feb 2020 22:54:05 +0000 (16:54 -0600)
committerShamus Hammons <jlhamm@acm.org>
Fri, 28 Feb 2020 22:54:05 +0000 (16:54 -0600)
RLN will now yell at you if you give it an include path that doesn't
exist.  Thanks to ggn for the idea!  :-)

rln.c
rln.h

diff --git a/rln.c b/rln.c
index b48764150ec30313ced1e459bd226b01011bb045..23b2fea77f8df642a65f53f03cb118a47c32f0c8 100644 (file)
--- a/rln.c
+++ b/rln.c
@@ -3115,6 +3115,21 @@ int main(int argc, char * argv[])
                ExitLinker();
        }
 
+       // Check to see if include paths actually exist
+       if (strlen(libdir) > 0)
+       {
+               DIR * test = opendir(libdir);
+
+               if (test == NULL)
+               {
+                       printf("Invalid include path: %s\n", libdir);
+                       errflag = 1;
+                       ExitLinker();
+               }
+
+               closedir(test);
+       }
+
        if (!zflag && !vflag)
        {
                ShowVersion();                          // Display version information
diff --git a/rln.h b/rln.h
index ac7e20a9ca2d4b99adf314aac18fc13c227cd25b..6e2b0925d1164bbea5ff04a9643fcca155fbd613 100644 (file)
--- a/rln.h
+++ b/rln.h
@@ -44,7 +44,7 @@
 
 #define MAJOR   1                      // Major version number
 #define MINOR   6                      // Minor version number
-#define PATCH   2                      // Patch release number
+#define PATCH   3                      // Patch release number
 
 #ifdef WIN32
 #define PLATFORM     "Win32"           // Release platform - Windows
@@ -81,6 +81,7 @@
 // Rather than rely on dodgy compilers for something that's now a C99 standard,
 // let's do this:
 #include <stdint.h>
+#include <dirent.h>
 
 struct OHEADER
 {