X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Fz80%2Fasmain.c;h=50ccb2b22e55cee6ccd5279f8a959521134bcd00;hb=90bdb43b342189fcb94a398855d43f3f47f96738;hp=e1686ccc8c76b33d9d9b65554efc50d30b40a1e2;hpb=15cab71c69a8d394a4babc68334dac7f405dca8f;p=fw%2Fsdcc diff --git a/as/z80/asmain.c b/as/z80/asmain.c index e1686ccc..50ccb2b2 100644 --- a/as/z80/asmain.c +++ b/as/z80/asmain.c @@ -16,13 +16,14 @@ #include #include #include -#include + #ifdef SDK #include #include #undef HUGE #endif #include "asm.h" +#include "z80.h" /*)Module asmain.c * @@ -87,7 +88,7 @@ * int fflag -f(f), relocations flagged flag * int flevel IF-ELSE-ENDIF flag will be non * zero for false conditional case - * addr_t fuzz tracks pass to pass changes in the + * Addr_T fuzz tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats * int gflag -g, make undefined symbols global flag @@ -134,7 +135,7 @@ * 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 @@ -159,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 &afn[FILSPC-4]) // truncate filename, if it's too long + p2 = &afn[FILSPC-4]; *p2++ = FSEPX; - if (*p3 == 0) { - if (c == FSEPX) { - p3 = p1; - } else { - p3 = dsft; - } + + // choose a file-extension + if (*p3 == 0) { // extension supplied? + p3 = strrchr (fn, FSEPX); // no: extension in fn? + if (p3) + ++p3; + else + p3 = dsft; // no: default extension } - while ((c = *p3++) != 0) { + + while ((c = *p3++) != 0) { // strncpy if (p2 < &afn[FILSPC-1]) *p2++ = c; } *p2++ = 0; + if ((fp = fopen(afn, wf?"w":"r")) == NULL) { fprintf(stderr, "%s: cannot %s.\n", afn, wf?"create":"open"); asexit(1); @@ -1070,7 +1106,7 @@ int wf; * * global variables: * sym dot defined as sym[0] - * addr_t fuzz tracks pass to pass changes in the + * Addr_T fuzz tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats * @@ -1099,7 +1135,7 @@ register struct area *nap; /*)Function VOID phase(ap, a) * * area * ap pointer to area - * addr_t a address in area + * Addr_T a address in area * * Function phase() compares the area ap and address a * with the current area dot.s_area and address dot.s_addr @@ -1123,7 +1159,7 @@ register struct area *nap; VOID phase(ap, a) struct area *ap; -addr_t a; +Addr_T a; { if (ap != dot.s_area || a != dot.s_addr) err('p');