aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2015-07-19 14:30:31 +0200
committerTomasz Kramkowski <tk@the-tk.com>2015-07-19 14:30:31 +0200
commit9b9a0cff925d421e029b348951dd0ca309e604d6 (patch)
tree4bacaefc31342ecb9d2332517080c505282ddc9b
parentcd0fd0cacad51922b79c361a4b8943056f04cda2 (diff)
downloadc-stuff-9b9a0cff925d421e029b348951dd0ca309e604d6.tar.gz
c-stuff-9b9a0cff925d421e029b348951dd0ca309e604d6.tar.xz
c-stuff-9b9a0cff925d421e029b348951dd0ca309e604d6.zip
timer.c: Added check to see if stdout is a tty
-rw-r--r--timer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/timer.c b/timer.c
index 87c90a3..462aee9 100644
--- a/timer.c
+++ b/timer.c
@@ -165,6 +165,9 @@ int main(int argc, char **argv)
unsigned long total_seconds = 0;
+ if (!isatty(STDOUT_FILENO))
+ error(1, 0, "Error: stdout is not a tty");
+
if (argc < 2) {
printf("Not enough arguments.\n");
usage(argv[0]);