]> Shamusworld >> Repos - rln/blobdiff - rln.c
Fix for bug #132 (warnings for non-exclusive options).
[rln] / rln.c
diff --git a/rln.c b/rln.c
index b48764150ec30313ced1e459bd226b01011bb045..a0b5ab02aa040e7e4c071822b100bba2956addba 100644 (file)
--- a/rln.c
+++ b/rln.c
@@ -2851,6 +2851,10 @@ int doargs(int argc, char * argv[])
                        case 'e':
                        case 'E':                                       // Output COFF (absolute only)
                                cflag = 1;
+
+                               if (noheaderflag)
+                                       printf("Warning: -e overridden by -n, output will be headerless\n");
+
                                break;
                        case 'g':
                        case 'G':                                       // Output source level debugging
@@ -2909,6 +2913,9 @@ int doargs(int argc, char * argv[])
                                if (noheaderflag)
                                        warn('n', 1);
 
+                               if (cflag)
+                                       printf("Warning: -e overridden by -n, output will be headerless\n");
+
                                noheaderflag = 1;
                                break;
                        case 'o':
@@ -2977,6 +2984,22 @@ int doargs(int argc, char * argv[])
 
                                wflag = 1;
                                break;
+                       case 'y':
+                       case 'Y':
+                               if (i >= argc)
+                               {
+                                       printf("No directory filename following -y switch\n");
+                                       return 1;
+                               }
+
+                               if (strlen(argv[i]) > FARGSIZE * 3)
+                               {
+                                       printf("Directory file name too long (sorry!)\n");
+                                       return 1;
+                               }
+
+                               strcpy(libdir, argv[i++]);
+                               break;
                        case 'z':
                        case 'Z':                                       // Suppress banner flag
                                if (zflag)
@@ -3044,7 +3067,7 @@ void ShowHelp(void)
        printf("\n");
        printf("Options:\n");
        printf("   -? or -h                display usage information\n");
-       printf("   -a <text> <data> <bss>  output absolute file\n");
+       printf("   -a <text> <data> <bss>  output absolute file (default: ABS)\n");
        printf("                           hex value: segment address\n");
        printf("                           r: relocatable segment\n");
        printf("                           x: contiguous segment\n");
@@ -3057,7 +3080,7 @@ void ShowHelp(void)
        printf("   -ii <fname> <label>     incbin <fname> and set <label> (no truncation)\n");
        printf("   -l                      add local symbols\n");
        printf("   -m                      produce load symbols map\n");
-       printf("   -n                      output no file header to absolute file\n");
+       printf("   -n                      output no file header to absolute file (overrides -e)\n");
        printf("   -o <fname>              set output name\n");
        printf("   -r<size>                section alignment size\n");
        printf("                           w: word (2 bytes)\n");
@@ -3069,6 +3092,7 @@ void ShowHelp(void)
        printf("   -u                      allow unresolved symbols (experimental)\n");
        printf("   -v                      set verbose mode\n");
        printf("   -w                      show linker warnings\n");
+       printf("   -y <fname>              set include path (also set by RLNPATH)\n");
        printf("   -z                      suppress banner\n");
        printf("\n");
 }
@@ -3115,6 +3139,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