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.
This commit is contained in:
parent
dda57ad059
commit
0f6f98c7bc
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: banner.6,v 1.5 1995/03/25 07:44:48 glass Exp $
|
||||
.\" $NetBSD: banner.6,v 1.6 1995/04/22 11:55:13 cgd Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -41,7 +41,7 @@
|
||||
.Nd print large banner on printer
|
||||
.Sh SYNOPSIS
|
||||
.Nm banner
|
||||
.Op Fl w Op Ar n
|
||||
.Op Fl w Ar width
|
||||
.Ar message ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm Banner
|
||||
@ -50,10 +50,8 @@ If the message is omitted, it prompts for and
|
||||
reads one line of its standard input. If
|
||||
.Fl w
|
||||
is given, the output is scrunched down from a width of 132 to
|
||||
.Ar n ,
|
||||
suitable for a narrow terminal. If
|
||||
.Ar n
|
||||
is omitted, it defaults to 132.
|
||||
.Ar width ,
|
||||
suitable for a narrow terminal.
|
||||
.Pp
|
||||
The output should be printed on a hard-copy device, up to 132 columns wide,
|
||||
with no breaks between the pages. The volume is great enough that you
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user