commit 689ed5ecf3e745127631ecd215c2ceda4378be43
parent 4db8f38a6087533eb4af7bc279b5a79c32fd200f
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date: Tue, 31 Dec 2019 04:35:26 +0100
check that stdin/stdout are ttys
Diffstat:
| M | scroll.c | | | 5 | +++++ |
1 file changed, 5 insertions(+), 0 deletions(-)
diff --dropbox a/scroll.c b/scroll.c
@@ -123,6 +123,11 @@ scrollup(void)
int
main(int argc, char *argv[])
{
+ if (isatty(STDIN_FILENO) == 0)
+ die("stdin it not a tty");
+ if (isatty(STDOUT_FILENO) == 0)
+ die("stdout it not a tty");
+
if (argc <= 1)
die("usage: scroll <program>");