1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-07-22 11:29:18 +00:00

Add -S option to plasm to output to stdout

This commit is contained in:
Steven Flintham 2023-01-15 22:29:26 +00:00
parent 156bca2413
commit 374d2465b6
2 changed files with 17 additions and 5 deletions

View File

@ -34,6 +34,10 @@ int main(int argc, char **argv)
break;
case 'W':
outflags |= WARNINGS;
break;
case 'S':
outflags |= STREAM;
break;
}
}
}
@ -56,11 +60,18 @@ int main(int argc, char **argv)
j--;
}
asmfile[j+1] = 'a';
outputfile = fopen(asmfile, "w");
if (!outputfile)
if (outflags & STREAM)
{
printf("Error opening output file %s\n", asmfile);
exit(1);
outputfile = stdout;
}
else
{
outputfile = fopen(asmfile, "w");
if (!outputfile)
{
printf("Error opening output file %s\n", asmfile);
exit(1);
}
}
while (j && asmfile[j-1] != '/')
j--;
@ -79,7 +90,7 @@ int main(int argc, char **argv)
}
if (inputfile == NULL)
{
printf("Usage: %s [-AMONW] <inputfile>", argv[0]);
printf("Usage: %s [-AMONWS] <inputfile>\n", argv[0]);
return (0);
}
emit_flags(outflags);

View File

@ -9,6 +9,7 @@
#define SYSFLAGS (1<<5)
#define WARNINGS (1<<6)
#define NO_COMBINE (1<<7)
#define STREAM (1<<8)
#define FALSE 0
#define TRUE (!FALSE)
extern int outflags;