diff options
author | June McEnroe <programble@gmail.com> | 2018-02-21 14:56:38 -0500 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2018-02-21 14:56:38 -0500 |
commit | 07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8 (patch) | |
tree | 7f5c3929f26eb1610381fc927d4491686aeddfd9 | |
parent | Add broadcast (diff) | |
download | stream-07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8.tar.gz stream-07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8.zip |
Check if broadcast stdout is redirected
-rw-r--r-- | broadcast.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/broadcast.c b/broadcast.c index e5957ae..afea3e4 100644 --- a/broadcast.c +++ b/broadcast.c @@ -54,6 +54,10 @@ int main(int argc, char *argv[]) { int local = STDERR_FILENO; int remote = STDOUT_FILENO; + if (isatty(remote)) { + errx(EX_USAGE, "stdout is not redirected"); + } + error = tcgetattr(local, &saveTerm); if (error) err(EX_IOERR, "tcgetattr"); atexit(restoreTerm); |