summaryrefslogtreecommitdiffstats
path: root/banner/banner.c
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1995-04-22 11:55:13 +0000
committercgd <cgd@NetBSD.org>1995-04-22 11:55:13 +0000
commitd7c608df67f7b99aee31ddf6c13d8870695f6827 (patch)
tree72c5440808dc8be4038a4aef5a5c0314726dbb0d /banner/banner.c
parentfd169b744e1a21d2e23db940204238aa795129d3 (diff)
downloadbsdgames-darwin-d7c608df67f7b99aee31ddf6c13d8870695f6827.tar.gz
bsdgames-darwin-d7c608df67f7b99aee31ddf6c13d8870695f6827.zip
don't print 'Message:' prompt if stdin is not a terminal.
(from Masanobu Saitoh <saitoh@spa.is.uec.ac.jp> in pr 982.) Also, fix usage string and manual page to note that width argument for -w is _not_ optional.
Diffstat (limited to 'banner/banner.c')
-rw-r--r--banner/banner.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/banner/banner.c b/banner/banner.c
index 0b5fddd2..b3d842a2 100644
--- a/banner/banner.c
+++ b/banner/banner.c
@@ -1,4 +1,4 @@
-/* $NetBSD: banner.c,v 1.3 1995/03/25 07:44:49 glass Exp $ */
+/* $NetBSD: banner.c,v 1.4 1995/04/22 11:55:15 cgd Exp $ */
/*
* Copyright (c) 1980, 1993, 1994
@@ -43,13 +43,13 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)banner.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$NetBSD: banner.c,v 1.3 1995/03/25 07:44:49 glass Exp $";
+static char rcsid[] = "$NetBSD: banner.c,v 1.4 1995/04/22 11:55:15 cgd Exp $";
#endif
#endif /* not lint */
/*
* banner - prints large signs
- * banner [-w#] [-d] [-t] message ...
+ * banner [-w width] [-d] [-t] message ...
*/
#include <err.h>
@@ -1071,7 +1071,8 @@ main(argc, argv)
}
nchars = strlen(message);
} else {
- fprintf(stderr,"Message: ");
+ if (isatty(fileno(stdin)))
+ fprintf(stderr,"Message: ");
(void)fgets(message, sizeof(message), stdin);
nchars = strlen(message);
message[nchars--] = '\0'; /* get rid of newline */