Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Apr 1999 12:54:29 -0500 (EST)
From:      ajk@purdue.edu
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/10931: biff b
Message-ID:  <199904031754.MAA06078@poynting.physics.purdue.edu>

next in thread | raw e-mail | index | archive | help

>Number:         10931
>Category:       bin
>Synopsis:       biff b
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr  3 12:50:02 PST 1999
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904031754.MAA06078>