commit cff5746e03b7e7b72b18140c73fdb9520b21d4d3
parent 187f92d31d2a9ab32764e53ecf4bf812f44a21db
Author: Remko Tronçon <remko@el-tramo.be>
Date: Fri, 27 Oct 2023 09:32:27 +0200
(uxnasm.c) Support outputting to stdout using `-`
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -506,12 +506,16 @@ main(int argc, char *argv[])
return !error("Invalid input", argv[1]);
if(!assemble(src))
return !error("Assembly", "Failed to assemble rom.");
- if(!(dst = fopen(argv[2], "wb")))
+ if (scmp(argv[2], "-", 2))
+ dst = stdout;
+ else if(!(dst = fopen(argv[2], "wb")))
return !error("Invalid Output", argv[2]);
if(p.length <= TRIM)
return !error("Assembly", "Output rom is empty.");
fwrite(p.data + TRIM, p.length - TRIM, 1, dst);
- review(argv[2]);
- writesym(argv[2]);
+ if (!scmp(argv[2], "-", 2)) {
+ review(argv[2]);
+ writesym(argv[2]);
+ }
return 0;
}