]> git.meshlink.io Git - meshlink/commitdiff
Check if stdout is a terminal, if so, print a verbose message.
authorIvo Timmermans <ivo@lychnis.net>
Mon, 17 Apr 2000 16:59:42 +0000 (16:59 +0000)
committerIvo Timmermans <ivo@lychnis.net>
Mon, 17 Apr 2000 16:59:42 +0000 (16:59 +0000)
src/genauth.c

index 23f9770ae9e74b92ef00147b34ee4cead54c659b..895ed7bc64969e0d67c9a3baaed7902347f81fee 100644 (file)
@@ -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;
 }