From ajk@poynting.physics.purdue.edu Sat Apr  3 09:56:25 1999
Return-Path: <ajk@poynting.physics.purdue.edu>
Received: from poynting.physics.purdue.edu (poynting.physics.purdue.edu [128.210.146.58])
	by hub.freebsd.org (Postfix) with ESMTP id 21A4714C81
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  3 Apr 1999 09:56:24 -0800 (PST)
	(envelope-from ajk@poynting.physics.purdue.edu)
Received: (from ajk@localhost)
	by poynting.physics.purdue.edu (8.9.1/8.9.1) id MAA06078;
	Sat, 3 Apr 1999 12:54:29 -0500 (EST)
	(envelope-from ajk)
Message-Id: <199904031754.MAA06078@poynting.physics.purdue.edu>
Date: Sat, 3 Apr 1999 12:54:29 -0500 (EST)
From: ajk@purdue.edu
Sender: ajk@poynting.physics.purdue.edu
Reply-To: ajk@purdue.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: biff b
X-Send-Pr-Version: 3.2

>Number:         10931
>Category:       bin
>Synopsis:       biff b
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    johan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr  3 12:50:02 PST 1999
>Closed-Date:    Thu Aug 08 20:01:26 PDT 2002
>Last-Modified:  Thu Aug 08 20:01:26 PDT 2002
>Originator:     Andrew J. Korty
>Release:        FreeBSD 3.0-RELEASE i386
>Organization:
Physics Computer Network, Purdue University
>Environment:

FreeBSD galileo.physics.purdue.edu 3.1-PCN FreeBSD 3.1-PCN #6:
Thu Mar 25 11:01:38 EST 1999
csg@tesla.physics.purdue.edu:/usr/src/sys/compile/PCN-GALILEO  i386

>Description:

The stock versions of biff(1) and comsat(8) cause the header and
first few lines of an arriving mail message to be displayed.  My
(trivial) modifications to these programs add the "biff b" feature
found in some other UNIX variants.  In this mode, only a couple of
BEL characters are sent to the user's terminal, signifying new mail
without disturbing the display.  The group execute bit on the user's
tty device is used to signify whether biff b is in effect.

I can't commit this feature because I don't have the privs, but my
diffs are attached ...

Andrew J. Korty, Director     http://www.physics.purdue.edu/~ajk/
Physics Computer Network            85 73 1F 04 63 D9 9D 65       
Purdue University                   65 2E 7A A8 81 8C 45 75

>How-To-Repeat:

Apply this patch, and rebuild and reinstall biff and comsat.  Type
"biff b" to activate the new feature.

>Fix:

Index: src/usr.bin/biff/biff.1
===================================================================
RCS file: /usr/cvs/freebsd/src/usr.bin/biff/biff.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** biff.1	1998/12/03 15:41:40	1.1.1.1
--- biff.1	1998/12/07 14:52:39	1.2
***************
*** 40,46 ****
  .Nd "be notified if mail arrives and who it is from"
  .Sh SYNOPSIS
  .Nm biff
! .Op Cm n | y
  .Sh DESCRIPTION
  .Nm Biff
  informs the system whether you want to be notified when mail arrives
--- 40,46 ----
  .Nd "be notified if mail arrives and who it is from"
  .Sh SYNOPSIS
  .Nm biff
! .Op Cm n | y | b
  .Sh DESCRIPTION
  .Nm Biff
  informs the system whether you want to be notified when mail arrives
***************
*** 53,58 ****
--- 53,60 ----
  Disables notification.
  .It Cm y
  Enables notification.
+ .It Cm b
+ Beeps twice.  (Prints no header information.)
  .El
  .Pp
  When mail notification is enabled, the header and first few lines of
Index: src/usr.bin/biff/biff.c
===================================================================
RCS file: /usr/cvs/freebsd/src/usr.bin/biff/biff.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** biff.c	1998/12/03 15:41:40	1.1.1.1
--- biff.c	1998/12/07 14:52:39	1.2
***************
*** 80,107 ****
  		err(2, "stat");
  
  	if (*argv == NULL) {
! 		(void)printf("is %s\n", sb.st_mode&0100 ? "y" : "n");
  		return(sb.st_mode & 0100 ? 0 : 1);
  	}
  
  	switch(argv[0][0]) {
  	case 'n':
! 		if (chmod(name, sb.st_mode & ~0100) < 0)
  			err(2, name);
  		break;
  	case 'y':
! 		if (chmod(name, sb.st_mode | 0100) < 0)
  			err(2, name);
  		break;
  	default:
  		usage();
  	}
! 	return(sb.st_mode & 0100 ? 0 : 1);
  }
  
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: biff [y | n]\n");
  	exit(2);
  }
--- 80,121 ----
  		err(2, "stat");
  
  	if (*argv == NULL) {
! 		switch (sb.st_mode & (S_IXUSR | S_IXGRP)) {
! 		case S_IXUSR:
! 			(void)printf("is y\n");
! 			break;
! 		case S_IXGRP:
! 			(void)printf("is b\n");
! 			break;
! 		default:
! 			(void)printf("is n\n");
! 			break;
! 		}
  		return(sb.st_mode & 0100 ? 0 : 1);
  	}
  
  	switch(argv[0][0]) {
  	case 'n':
! 		if (chmod(name, sb.st_mode & ~(S_IXUSR | S_IXGRP)) < 0)
  			err(2, name);
  		break;
  	case 'y':
! 		if (chmod(name, sb.st_mode & ~S_IXGRP | S_IXUSR) < 0)
! 			err(2, name);
! 		break;
! 	case 'b':
! 		if (chmod(name, sb.st_mode & ~S_IXUSR | S_IXGRP) < 0)
  			err(2, name);
  		break;
  	default:
  		usage();
  	}
! 	return(sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1);
  }
  
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: biff [y | n | b]\n");
  	exit(2);
  }
Index: src/libexec/comsat/comsat.c
===================================================================
RCS file: /usr/cvs/freebsd/src/libexec/comsat/comsat.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** comsat.c	1998/12/03 15:38:10	1.1.1.1
--- comsat.c	1998/12/07 14:54:17	1.2
***************
*** 220,226 ****
  		syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty);
  		return;
  	}
! 	if (stat(tty, &stb) || !(stb.st_mode & S_IEXEC)) {
  		dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty);
  		return;
  	}
--- 220,226 ----
  		syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty);
  		return;
  	}
! 	if (stat(tty, &stb) || !(stb.st_mode & (S_IXUSR | S_IXGRP))) {
  		dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty);
  		return;
  	}
***************
*** 237,247 ****
  	cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ?  "\n" : "\n\r";
  	(void)strncpy(name, utp->ut_name, sizeof(utp->ut_name));
  	name[sizeof(name) - 1] = '\0';
! 	(void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s",
! 	    cr, name, (int)sizeof(hostname), hostname,
! 	    folder ? cr : "", folder ? "to " : "", folder ? file : "",
! 	    cr, cr);
! 	jkfprintf(tp, name, file, offset);
  	(void)fclose(tp);
  	_exit(0);
  }
--- 237,257 ----
  	cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ?  "\n" : "\n\r";
  	(void)strncpy(name, utp->ut_name, sizeof(utp->ut_name));
  	name[sizeof(name) - 1] = '\0';
! 	switch (stb.st_mode & (S_IXUSR | S_IXGRP)) {
! 	case S_IXUSR:
! 		(void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s",
! 		    cr, name, (int)sizeof(hostname), hostname,
! 		    folder ? cr : "", folder ? "to " : "", folder ? file : "",
! 		    cr, cr);
! 		jkfprintf(tp, name, file, offset);
! 		break;
! 	case S_IXGRP:
! 		(void) fprintf(tp, "\007");
! 		(void) fflush(tp);	
! 		(void) sleep(1);
! 		(void) fprintf(tp, "\007");
! 		break;
! 	}
  	(void)fclose(tp);
  	_exit(0);
  }

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->johan 
Responsible-Changed-By: johan 
Responsible-Changed-When: Wed Jul 3 11:58:27 PDT 2002 
Responsible-Changed-Why:  
I will have a look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=10931 
State-Changed-From-To: open->patched 
State-Changed-By: johan 
State-Changed-When: Mon Jul 8 19:19:30 PDT 2002 
State-Changed-Why:  
committed modulo style(9) things, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=10931 
State-Changed-From-To: patched->closed 
State-Changed-By: johan 
State-Changed-When: Thu Aug 8 20:00:54 PDT 2002 
State-Changed-Why:  
MFCed. 
Thanks for the submission. 

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