From howardjp@wam.umd.edu Wed Aug 11 05:22:09 1999
Return-Path: <howardjp@wam.umd.edu>
Received: from majordomo2.umd.edu (majordomo2.umd.edu [128.8.10.7])
	by hub.freebsd.org (Postfix) with ESMTP id E1E1214DF5
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 11 Aug 1999 05:22:04 -0700 (PDT)
	(envelope-from howardjp@wam.umd.edu)
Received: from rac10.wam.umd.edu (root@rac10.wam.umd.edu [128.8.10.150])
	by majordomo2.umd.edu (8.9.3/8.9.3) with ESMTP id IAA00444
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 11 Aug 1999 08:21:02 -0400 (EDT)
Received: from rac10.wam.umd.edu (sendmail@localhost [127.0.0.1])
	by rac10.wam.umd.edu (8.9.3/8.9.3) with SMTP id IAA04684
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 11 Aug 1999 08:21:02 -0400 (EDT)
Received: (from howardjp@localhost)
	by rac10.wam.umd.edu (8.9.3/8.9.3) id IAA04680
	for FreeBSD-gnats-submit@freebsd.org; Wed, 11 Aug 1999 08:21:02 -0400 (EDT)
Message-Id: <199908111221.IAA04680@rac10.wam.umd.edu>
Date: Wed, 11 Aug 1999 08:21:02 -0400 (EDT)
From: James Howard <howardjp@wam.umd.edu>
Reply-To: howardjp@wam.umd.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Extensions to biff(1)
X-Send-Pr-Version: 3.2

>Number:         13072
>Category:       bin
>Synopsis:       Extensions to biff(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    johan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 11 05:30:03 PDT 1999
>Closed-Date:    Wed Jul 24 08:58:46 PDT 2002
>Last-Modified:  Wed Jul 24 08:58:46 PDT 2002
>Originator:     James Howard
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
University of Maryland
>Environment:

FreeBSD byzantine 3.2-STABLE FreeBSD 3.2-STABLE #5: Sat Aug  7 23:43:54 GMT 1999     root@byzantine:/usr/src/sys/compile/BYZANTINE  i386

>Description:

Often when I am logged in via telnet to a FreeBSD host, I use Lynx to
download files.  If it is a large download, the arrival of mail
notifications can mess up the display of Lynx's status.  This patch
to biff(1) will allow you to use "biff -t tty" report or change the
status of tty instead of the current.  I do this often from a second
telnet session.

>How-To-Repeat:

Irrelevant.

>Fix:

diff -c /usr/src/usr.bin/biff/biff.1 /usr/local/src/usr.bin/biff/biff.1
*** /usr/src/usr.bin/biff/biff.1	Mon Jun 23 06:45:37 1997
--- /usr/local/src/usr.bin/biff/biff.1	Wed Aug 11 00:22:55 1999
***************
*** 40,45 ****
--- 40,46 ----
  .Nd "be notified if mail arrives and who it is from"
  .Sh SYNOPSIS
  .Nm biff
+ .Op Fl t Ar tty
  .Op Cm n | y
  .Sh DESCRIPTION
  .Nm Biff
***************
*** 48,54 ****
  .Pp
  Options supported by
  .Nm biff :
! .Bl -tag -width 4n
  .It Cm n
  Disables notification.
  .It Cm y
--- 49,59 ----
  .Pp
  Options supported by
  .Nm biff :
! .Bl -tag -width 8n
! .It Fl t Ar tty
! Report or change the status of 
! .Ar tty
! rather than the current terminal.
  .It Cm n
  Disables notification.
  .It Cm y
diff -c /usr/src/usr.bin/biff/biff.c /usr/local/src/usr.bin/biff/biff.c
*** /usr/src/usr.bin/biff/biff.c	Sun Dec  6 22:58:12 1998
--- /usr/local/src/usr.bin/biff/biff.c	Wed Aug 11 00:30:25 1999
***************
*** 46,51 ****
--- 46,52 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <errno.h>
+ #include <paths.h>
  #include <unistd.h>
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 63,71 ****
  	int ch;
  	char *name;
  
! 
! 	while ((ch = getopt(argc, argv, "")) != -1)
  		switch(ch) {
  		case '?':
  		default:
  			usage();
--- 64,75 ----
  	int ch;
  	char *name;
  
! 	name = NULL;
! 	while ((ch = getopt(argc, argv, "t:")) != -1)
  		switch(ch) {
+ 		case 't':
+ 			name = optarg;
+ 			break;
  		case '?':
  		default:
  			usage();
***************
*** 73,81 ****
  	argc -= optind;
  	argv += optind;
  
! 	if ((name = ttyname(STDERR_FILENO)) == NULL)
! 		err(2, "unknown tty");
  
  	if (stat(name, &sb))
  		err(2, "stat");
  
--- 77,87 ----
  	argc -= optind;
  	argv += optind;
  
! 	if (name == NULL) 
! 		if ((name = ttyname(STDERR_FILENO)) == NULL)
! 			err(2, "unknown tty");
  
+ 	(void)chdir(_PATH_DEV);
  	if (stat(name, &sb))
  		err(2, "stat");
  
***************
*** 102,107 ****
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: biff [y | n]\n");
  	exit(2);
  }
--- 108,113 ----
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: biff [-t tty] [y | n]\n");
  	exit(2);
  }

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->billf 
Responsible-Changed-By: billf 
Responsible-Changed-When: Wed Aug 11 07:16:39 PDT 1999 
Responsible-Changed-Why:  
I'll look at this. 
Responsible-Changed-From-To: billf->johan 
Responsible-Changed-By: johan 
Responsible-Changed-When: Tue Jul 9 10:34:39 PDT 2002 
Responsible-Changed-Why:  
Bill suggested I should have look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=13072 
State-Changed-From-To: open->analyzed 
State-Changed-By: johan 
State-Changed-When: Thu Jul 11 11:13:08 PDT 2002 
State-Changed-Why:  
This seems to be a good change. 
Pending no objection from -standards and -arch 
I will commit this soon. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=13072 

From: Cyrille Lefevre <cyrille.lefevre@laposte.net>
To: freebsd-gnats-submit@FreeBSD.org, howardjp@wam.umd.edu
Cc: freebsd arch <freebsd-arch@FreeBSD.org>
Subject: Re: bin/13072: Extensions to biff(1)
Date: Wed, 24 Jul 2002 16:47:06 +0200

 see PR #13073 for comments.
 
 * errno.h and string.h not needed.
 * other headers sorted (see style(9)).
 
 Index: /usr/src/usr.bin/biff/biff.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/biff/biff.c,v
 retrieving revision 1.6.2.3
 diff -u -r1.6.2.3 biff.c
 --- /usr/src/usr.bin/biff/biff.c	2 Aug 2001 01:06:37 -0000	1.6.2.3
 +++ /usr/src/usr.bin/biff/biff.c	24 Jul 2002 14:36:05 -0000
 @@ -45,12 +45,11 @@
  
  #include <sys/types.h>
  #include <sys/stat.h>
 -#include <errno.h>
 -#include <unistd.h>
 +
 +#include <err.h>
  #include <stdio.h>
  #include <stdlib.h>
 -#include <string.h>
 -#include <err.h>
 +#include <unistd.h>
  
  int main __P((int, char *[]));
  static void usage __P((void));
 @@ -66,7 +65,7 @@
  
  
  	while ((ch = getopt(argc, argv, "")) != -1)
 -		switch(ch) {
 +		switch (ch) {
  		case '?':
  		default:
  			usage();
 @@ -74,7 +73,9 @@
  	argc -= optind;
  	argv += optind;
  
 -	if ((name = ttyname(STDERR_FILENO)) == NULL)
 +	if ((name = ttyname(STDIN_FILENO)) == NULL &&
 +	    (name = ttyname(STDOUT_FILENO)) == NULL &&
 +	    (name = ttyname(STDERR_FILENO)) == NULL)
  		err(2, "unknown tty");
  
  	if (stat(name, &sb))
 
 Cyrille.
 -- 
 Cyrille Lefevre                 mailto:cyrille.lefevre@laposte.net
State-Changed-From-To: analyzed->closed 
State-Changed-By: johan 
State-Changed-When: Wed Jul 24 08:56:20 PDT 2002 
State-Changed-Why:  
One can now use redirection of stdin to select 
another tty. 

# biff n < /dev/ttyp1 

I think this is good enough. If you don't, please 
argu your case on freebsd-arch@freebsd.org. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=13072 
>Unformatted:
