From e4288a04fc0d14190743e6e2700315436d468817 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 25 May 2024 16:14:04 -0400 Subject: unprotbas: do not try to read tokenized BASIC from stdin if it's a terminal. --- unprotbas.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'unprotbas.c') diff --git a/unprotbas.c b/unprotbas.c index 1697aa8..4ed831f 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -633,6 +633,9 @@ FILE *open_file(const char *name, const char *mode) { void open_input(const char *name) { if(!name) { + if(isatty(fileno(stdin))) { + die("can't read binary data from the terminal"); + } if(freopen(NULL, "rb", stdin)) { input_file = stdin; return; @@ -648,7 +651,7 @@ void open_input(const char *name) { void open_output(const char *name) { if(!name) { if(isatty(fileno(stdout))) { - die("refusing to write binary data to standard output"); + die("refusing to write binary data to the terminal"); } if(freopen(NULL, "wb", stdout)) { output_file = stdout; -- cgit v1.2.3