/* * as80.c * Mainline. */ #include #include "as8.h" /* * This is the mainline. * It scans the command line, * collects up a source file, * sets option flags and calls * the assembler proper. */ main(argc, argv) char *argv[]; { register int i, c; register char *p; char *file; file = NULL; for(i=1; is_type = S_ABS; dot->s_flag = SF_ASG; dot->s_value = 0; while(fgets(sbuf, src) != NULL) { ++lineno; sptr = sbuf; cptr = cbuf; eptr = ebuf; asmline(); if(pass) { outerrors(); if(lflag) outlisting(); } } } if(!nflag) cflush(1); } /* * If the user screws up, put out * a usage message. * Then quit. * Not much sense staying around. */ usage() { fprintf(stderr, "Usage: as8 [-ln] file\n"); exit(1); } /* * Build RSX file names. * The mode argument is either 0 * which means default, or 1 which * means replace with. */ name(fn, file, type, mode) char *fn, *file, *type; { register char *p1, *p2; register int c; p1 = fn; p2 = file; while((c = *p2++) && c!='.') *p1++ = c; if(mode == 0) { if(c == '.') { do { *p1++ = c; } while(c = *p2++); } else { *p1++ = '.'; p2 = type; while(c = *p2++) *p1++ = c; } } else { *p1++ = '.'; p2 = type; while(c = *p2++) *p1++ = c; } *p1 = '\0'; }