From 374d2465b6fd7edc20030244a9ca05d48f49c87c Mon Sep 17 00:00:00 2001 From: Steven Flintham Date: Sun, 15 Jan 2023 22:29:26 +0000 Subject: [PATCH] Add -S option to plasm to output to stdout --- src/toolsrc/plasm.c | 21 ++++++++++++++++----- src/toolsrc/plasm.h | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/toolsrc/plasm.c b/src/toolsrc/plasm.c index b409759..f709ca7 100755 --- a/src/toolsrc/plasm.c +++ b/src/toolsrc/plasm.c @@ -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] ", argv[0]); + printf("Usage: %s [-AMONWS] \n", argv[0]); return (0); } emit_flags(outflags); diff --git a/src/toolsrc/plasm.h b/src/toolsrc/plasm.h index 6a7a8b5..188ebd9 100755 --- a/src/toolsrc/plasm.h +++ b/src/toolsrc/plasm.h @@ -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;