NetBSD Problem Report #982

From gnats  Thu Apr 20 11:23:33 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id LAA20336 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 20 Apr 1995 11:23:32 -0700
Message-Id: <199504201821.DAA13455@pfault.spa.is.uec.ac.jp>
Date: Fri, 21 Apr 1995 03:21:56 +0900
From: Masanobu Saitoh <saitoh@spa.is.uec.ac.jp>
Reply-To: saitoh@spa.is.uec.ac.jp
To: gnats-bugs@NetBSD.ORG
Subject: banner prints unnecessary prompt
X-Send-Pr-Version: 3.2

>Number:         982
>Category:       bin
>Synopsis:       banner prints unnecessary prompt
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 20 11:35:01 +0000 1995
>Closed-Date:    Mon Apr 24 18:40:24 +0000 1995
>Last-Modified:  
>Originator:     Masanobu Saitoh
>Release:        NetBSD-current 18 Apr 1995
>Organization:
	     saitoh@spa.is.uec.ac.jp
>Environment:
System: NetBSD physio.spa.is.uec.ac.jp 1.0 NetBSD 1.0 (NBTY) #809: Wed Apr 19 05:25:39 JST 1995 saitoh@physio.spa.is.uec.ac.jp:/usr/sources/0124/src/sys/arch/x68k/compile/NBTY x68k

>Description:
	Even if banner's stdin isn't tty, it prompts "Message: ".

>How-To-Repeat:
	Try following command

		echo foo |banner |head
>Fix:
	Apply this patch.

--- banner.c.orig	Fri Apr 21 02:13:10 1995
+++ banner.c	Fri Apr 21 03:16:14 1995
@@ -49,7 +49,7 @@

 /*
  * banner - prints large signs
- * banner [-w#] [-d] [-t] message ...
+ * banner [-w[#]] [-d] [-t] [message ...]
  */

 #include <err.h>
@@ -1051,7 +1051,7 @@
 			break;
 		case '?':
 		default:
-			fprintf(stderr, "usage: banner [-w width]\n");
+			fprintf(stderr, "usage: banner [-w [width]] [message ...]\n");
 			exit(1);
 		}
 	argc -= optind;
@@ -1071,7 +1071,8 @@
 		}
 		nchars = strlen(message);
 	} else {
-		fprintf(stderr,"Message: ");
+		if (isatty(0))
+			fprintf(stderr,"Message: ");
 		(void)fgets(message, sizeof(message), stdin);
 		nchars = strlen(message);
 		message[nchars--] = '\0';	/* get rid of newline */

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Mon Apr 24 11:40:24 PDT 1995 
State-Changed-Why:  
fix for the prompt-printing problem applied.  bogus fix for the usage 
message not applied. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.