* as/hc08/lkaomf51.c (OutputName),
[fw/sdcc] / as / z80 / asmain.c
index 19099878803ec9f7c0b8dd06e4ccad382efae488..50ccb2b22e55cee6ccd5279f8a959521134bcd00 100644 (file)
  *             VOID    diag()          assubr.c
  *             VOID    err()           assubr.c
  *             int     fprintf()       c-library
- *             int     getline()       aslex.c
+ *             int     as_getline()    aslex.c
  *             VOID    list()          aslist.c
  *             VOID    lstsym()        aslist.c
  *             VOID    minit()         ___mch.c
@@ -160,6 +160,21 @@ main(int argc, char **argv)
        register int c, i;
        struct area *ap;
 
+       /* Check to make sure there are the right number of filenames */
+       /* before openning any of them */
+#ifdef SDK
+       inpfil = -2;
+#else /* SDK */
+       inpfil = -1;
+#endif /* SDK */
+       for (i=1; i<argc; ++i) {
+               p = argv[i];
+               if (*p != '-')
+                       inpfil++;
+       }
+       if (inpfil < 0)
+               usage();
+
 #ifdef SDK
        inpfil = -2;
 #else /* SDK */
@@ -296,7 +311,7 @@ main(int argc, char **argv)
                dot.s_area = &dca;
                symp = &dot;
                minit();
-               while (getline()) {
+               while (as_getline()) {
                        cp = cb;
                        cpt = cbt;
                        ep = eb;
@@ -478,7 +493,7 @@ asmbl()
 #ifdef SDK
        double f1, f2;
        unsigned int mantissa, exponent;
-       const signed char readbuffer[80];
+       const char readbuffer[80];
 #endif
        laddr = dot.s_addr;
        lmode = SLIST;
@@ -839,7 +854,7 @@ loop:
                break;
 
        case S_MODUL:
-               getst(id, -1);
+               getst(id, getnb()); // a module can start with a digit
                if (pass == 0) {
                        if (module[0]) {
                                err('m');
@@ -850,6 +865,19 @@ loop:
                lmode = SLIST;
                break;
 
+    case S_OPTSDCC:
+               p = optsdcc;
+               if ((c = getnb()) != 0) {
+                       do {
+                               if (p < &optsdcc[NINPUT-1])
+                                       *p++ = c;
+                       } while ((c = get()) != 0);
+               }
+               *p = 0;
+               unget(c);
+               lmode = SLIST;
+        break;
+
        case S_GLOBL:
                do {
                        getid(id, -1);