aboutsummaryrefslogtreecommitdiff
path: root/unprotbas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-25 16:14:04 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-25 16:14:04 -0400
commite4288a04fc0d14190743e6e2700315436d468817 (patch)
treeff8e4366609d307036e2e046ab8157a405ddcae6 /unprotbas.c
parentc117cb2e180de367ced708e36c30e0eb73d77482 (diff)
downloadbw-atari8-tools-e4288a04fc0d14190743e6e2700315436d468817.tar.gz
unprotbas: do not try to read tokenized BASIC from stdin if it's a terminal.
Diffstat (limited to 'unprotbas.c')
-rw-r--r--unprotbas.c5
1 files changed, 4 insertions, 1 deletions
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;