Enable Halibut to read a .but file from standard input, by supplying
[sgt/halibut] / error.c
diff --git a/error.c b/error.c
index 7897d7a..00d007d 100644 (file)
--- a/error.c
+++ b/error.c
@@ -393,7 +393,7 @@ static void do_error(int code, va_list ap) {
     if (flags & PREFIX)
        fputs("halibut: ", stderr);
     if (flags & FILEPOS) {
-       fprintf(stderr, "%s:", fpos.filename);
+       fprintf(stderr, "%s:", fpos.filename ? fpos.filename : "<standard input>");
        if (fpos.line > 0)
            fprintf(stderr, "%d:", fpos.line);
        if (fpos.col > 0)