summaryrefslogtreecommitdiff
path: root/nasmlib
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-23 12:45:08 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-23 12:45:08 -0700
commit0741eb600481a97c3baddb290e0ab1a33a9e4921 (patch)
treea3bfe8535ad4b6b57fc226719737c6ef103f63f6 /nasmlib
parent4b58ec1b8f7626517077a70049805878b3dcd50b (diff)
downloadnasm-0741eb600481a97c3baddb290e0ab1a33a9e4921.tar.gz
listing: make it possible to flush the listing output after every line
Add the -Lw option to flush the list file after every line output. This is handy for debugging if nasm hangs. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'nasmlib')
-rw-r--r--nasmlib/file.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nasmlib/file.c b/nasmlib/file.c
index e5c0e335..a8cd3057 100644
--- a/nasmlib/file.c
+++ b/nasmlib/file.c
@@ -210,6 +210,20 @@ FILE *nasm_open_write(const char *filename, enum file_flags flags)
nasm_fatalf(ERR_NOFILE, "unable to open output file: `%s': %s",
filename, strerror(errno));
+ switch (flags & NF_BUF_MASK) {
+ case NF_IONBF:
+ setvbuf(f, NULL, _IONBF, 0);
+ break;
+ case NF_IOLBF:
+ setvbuf(f, NULL, _IOLBF, 0);
+ break;
+ case NF_IOFBF:
+ setvbuf(f, NULL, _IOFBF, 0);
+ break;
+ default:
+ break;
+ }
+
return f;
}