diff options
author | B. Watson <urchlay@slackware.uk> | 2024-07-01 18:03:27 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-07-01 18:03:27 -0400 |
commit | 2926604dc6651711ab525ab5fd84762748ce51ff (patch) | |
tree | 5fdbbbcc751a7eee25e5a0ddac1b3568a7525031 /a8cat.c | |
parent | 77bdfd18057d87d3af870a6099865d8fa8bb980a (diff) | |
download | bw-atari8-tools-2926604dc6651711ab525ab5fd84762748ce51ff.tar.gz |
a8cat: refuse to write ATASCII to a terminal; swallow \r in -r mode.
Diffstat (limited to 'a8cat.c')
-rw-r--r-- | a8cat.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -94,6 +94,8 @@ int a8revcat(const char *file) { while( (c = fgetwc(input)) != WEOF ) { if(c == 0x1b) { inv = handle_escape_seq(inv, input, file, line); + } else if(c == '\r') { + continue; /* swallow carriage returns */ } else if(c == '\n') { putchar(0x9b); line++; @@ -254,6 +256,9 @@ int main(int argc, char **argv) { } if(reverse) { + if(isatty(fileno(stdout))) + die("Refusing to write ATASCII to a terminal."); + if(underline || textmode || stripinv || magazine) { die("-t, -u, -m, -s options don't make sense with -r.\n"); } |