From: Ivo Timmermans <ivo@lychnis.net>
Date: Mon, 17 Apr 2000 16:59:42 +0000 (+0000)
Subject: Check if stdout is a terminal, if so, print a verbose message.
X-Git-Tag: release-1.0pre1~92
X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=9c2ac77594d83a810c53faf6979e0b76006ecd0e;p=tinc

Check if stdout is a terminal, if so, print a verbose message.
---

diff --git a/src/genauth.c b/src/genauth.c
index 23f9770a..895ed7bc 100644
--- a/src/genauth.c
+++ b/src/genauth.c
@@ -72,11 +72,22 @@ int main(int argc, char **argv)
     }
   fclose(fp);
 
-  printf("%d ", bits);
-  for(i = 0; i < bytes; i++)
-    printf("%02x", p[i]);
-  puts("");
-  fprintf(stderr, ": done.\n");
+  if(isatty(1))
+    {
+      fprintf(stderr, ": done.\nThe following line should be ENTIRELY copied into a passphrase file:\n");
+      printf("%d ", bits);
+      for(i = 0; i < bytes; i++)
+	printf("%02x", p[i]);
+      puts("");
+    }
+  else
+    {
+      printf("%d ", bits);
+      for(i = 0; i < bytes; i++)
+	printf("%02x", p[i]);
+      puts("");
+      fprintf(stderr, ": done.\n");
+    }
 
   return 0;
 }