summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-02-21 14:56:38 -0500
committerJune McEnroe <programble@gmail.com>2018-02-21 14:56:38 -0500
commit07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8 (patch)
tree7f5c3929f26eb1610381fc927d4491686aeddfd9
parentAdd broadcast (diff)
downloadstream-07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8.tar.gz
stream-07fe6cb3de6f99a71d26c2b8f50a97d6f88e93a8.zip
Check if broadcast stdout is redirected
-rw-r--r--broadcast.c4
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);