The non-flag arguments are now passed by position.

The order is :  (bem) input output program-name.
This commit is contained in:
keie 1985-01-25 09:55:28 +00:00
parent ed1ee8a3b4
commit d12fef6c05

View file

@ -15,12 +15,13 @@ parseparams(argc,argv)
int argc; int argc;
char **argv; char **argv;
{ {
int files=0 ;
int i; int i;
char *ext; char *ext;
if(argc< 4) if(argc< 4)
{ {
fprintf(stderr,"usage %s <flags> <file>.i <file>.e <source>\n", argv[0]); fprintf(stderr,"usage %s <flags> <file> <file> <source>\n", argv[0]);
exit(-1); exit(-1);
} }
for(i=1;i<argc;i++) for(i=1;i<argc;i++)
@ -40,15 +41,12 @@ char **argv;
case 'E': listing++; break; /* generate full listing */ case 'E': listing++; break; /* generate full listing */
} else { } else {
/* new input file */ /* new input file */
ext= argv[i]+strlen(argv[i])-1; switch ( files++ ) {
if( *(ext-1) != '.') case 0: inpfile= argv[i]; break;
/* should be the source file name */ case 1: outfile= argv[i]; break;
program= argv[i]; case 2: /* should be the source file name */
else program= argv[i]; break;
if( *ext == 'i') default:fatal("Too many file arguments") ;
inpfile= argv[i]; }
else
if( *ext == 'e')
outfile= argv[i];
} }
} }