Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 1999 08:21:04 -0400 (EDT)
From:      James Howard <howardjp@wam.umd.edu>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/13073: Extensions to mesg(1)
Message-ID:  <199908111221.IAA04687@rac10.wam.umd.edu>

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

>Number:         13073
>Category:       bin
>Synopsis:       Extensions to mesg(1)
>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:   Wed Aug 11 05:30:04 PDT 1999
>Closed-Date:
>Last-Modified:
>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 talk 
requests or write messages can mess up the display of Lynx's status.  
This patch to mesg(1) will allow you to use "mesg -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/mesg/mesg.1 /usr/local/src/usr.bin/mesg/mesg.1
*** /usr/src/usr.bin/mesg/mesg.1	Thu Jul 24 06:59:00 1997
--- /usr/local/src/usr.bin/mesg/mesg.1	Wed Aug 11 00:36:42 1999
***************
*** 40,45 ****
--- 40,46 ----
  .Nd display (do not display) messages from other users
  .Sh SYNOPSIS
  .Nm
+ .Op Fl t Ar tty
  .Op Cm n | Cm y
  .Sh DESCRIPTION
  The
***************
*** 54,60 ****
  may display messages on the terminal.
  .Pp
  Options available:
! .Bl -tag -width flag
  .It Cm n
  Disallows messages.
  .It Cm y
--- 55,65 ----
  may display messages on the terminal.
  .Pp
  Options available:
! .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
  Disallows messages.
  .It Cm y
diff -c /usr/src/usr.bin/mesg/mesg.c /usr/local/src/usr.bin/mesg/mesg.c
*** /usr/src/usr.bin/mesg/mesg.c	Thu Jul 24 06:59:00 1997
--- /usr/local/src/usr.bin/mesg/mesg.c	Wed Aug 11 00:33:53 1999
***************
*** 54,59 ****
--- 54,60 ----
  #include <sys/stat.h>
  
  #include <err.h>
+ #include <paths.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
***************
*** 70,77 ****
  	char *tty;
  	int ch;
  
! 	while ((ch = getopt(argc, argv, "")) != -1)
  		switch (ch) {
  		case '?':
  		default:
  			usage();
--- 71,82 ----
  	char *tty;
  	int ch;
  
! 	tty = NULL;
! 	while ((ch = getopt(argc, argv, "t:")) != -1)
  		switch (ch) {
+ 		case 't':
+ 			tty = optarg;
+ 			break;
  		case '?':
  		default:
  			usage();
***************
*** 79,86 ****
  	argc -= optind;
  	argv += optind;
  
! 	if ((tty = ttyname(STDERR_FILENO)) == NULL)
! 		err(1, "ttyname");
  	if (stat(tty, &sb) < 0)
  		err(1, "%s", tty);
  
--- 84,93 ----
  	argc -= optind;
  	argv += optind;
  
! 	if (tty == NULL) 
! 		if ((tty = ttyname(STDERR_FILENO)) == NULL)
! 			err(1, "ttyname");
! 	(void)chdir(_PATH_DEV);
  	if (stat(tty, &sb) < 0)
  		err(1, "%s", tty);
  
***************
*** 111,116 ****
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: mesg [y | n]\n");
  	exit(2);
  }
--- 118,123 ----
  static void
  usage()
  {
! 	(void)fprintf(stderr, "usage: mesg [-t tty] [y | n]\n");
  	exit(2);
  }

>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?199908111221.IAA04687>