fixed to also read from standard input
This commit is contained in:
parent
f1a897cec0
commit
048eac2d67
2 changed files with 7 additions and 6 deletions
|
@ -95,10 +95,11 @@ long get32();
|
|||
|
||||
in_init(filename) char *filename; {
|
||||
|
||||
if ((emfile=freopen(filename,"r",stdin))==NULL)
|
||||
emfile = stdin;
|
||||
if (filename && (emfile=freopen(filename,"r",stdin))==NULL)
|
||||
error("Can't open %s",filename);
|
||||
if (get16()!=sp_magic)
|
||||
error("Bad format %s",filename);
|
||||
error("Bad format %s",filename ? filename : "standard-input");
|
||||
}
|
||||
|
||||
in_start() {
|
||||
|
|
|
@ -68,10 +68,10 @@ main(argc,argv) char **argv; {
|
|||
error("Unknown flag %c",argv[0][1]);
|
||||
}
|
||||
}
|
||||
if (argc < 1 || argc > 2)
|
||||
error("Usage: %s EMfile [ asfile ]",progname);
|
||||
in_init(argv[0]);
|
||||
out_init(argv[1]);
|
||||
if (argc > 2)
|
||||
error("Usage: %s [ EMfile ] [ asfile ]",progname);
|
||||
in_init(argc >= 1 ? argv[0] : (char *) 0);
|
||||
out_init(argc >= 2 ? argv[1] : (char *) 0);
|
||||
readcodebytes();
|
||||
itokcost();
|
||||
in_start();
|
||||
|
|
Loading…
Reference in a new issue