Subject: xsrc/22460: a fix for xconsole -notify to make it work like xterm -ziconbeep
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 08/12/2003 17:29:51
>Number:         22460
>Category:       xsrc
>Synopsis:       a fix for xconsole -notify to make it work like xterm -ziconbeep
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    xsrc-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 12 21:30:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        xsrc-20030810
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
>Description:

	This patch fixes xconsole so that it behaves like Xterm with
	'-ziconbeep' -- i.e. so that it prepends three asterisks to its
	name instead of appending just one.

	This is useful for window managers which only show the first few
	characters of an icon name (such as ctwm with its SchrinkIconTitles)

>How-To-Repeat:

	use ctwm with SchrinkIconTitles and wonder why the xconsole icon
	never changes even when there's new output....

>Fix:

Index: xc/programs/xconsole/xconsole.man
===================================================================
RCS file: /cvs/master/m-NetBSD/main/xsrc/xc/programs/xconsole/xconsole.man,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 xconsole.man
*** xc/programs/xconsole/xconsole.man	30 Jun 1997 13:54:16 -0000	1.1.1.2
--- xc/programs/xconsole/xconsole.man	12 Aug 2003 21:21:39 -0000
***************
*** 41,51 ****
  .TP 8
  .B \-file \fIfile-name\fP
  To monitor some other device, use this option to specify the device name.
! This does not work on regular files as they are always ready to be read from.
  .TP 8
  .B \-notify \-nonotify
  When new data are received from the console and the notify option is set,
! the icon name of the application has " *" appended, so that it is evident
  even when the application is iconified.  \-notify is the default.
  .TP 8
  .B \-daemon
--- 41,53 ----
  .TP 8
  .B \-file \fIfile-name\fP
  To monitor some other device, use this option to specify the device name.
! If the file is a regular file then a read of zero bytes will put
! .I xconsole
! to sleep for one second.
  .TP 8
  .B \-notify \-nonotify
  When new data are received from the console and the notify option is set,
! the icon name of the application has "*** " prepended, so that it is evident
  even when the application is iconified.  \-notify is the default.
  .TP 8
  .B \-daemon
Index: xc/programs/xconsole/xconsole.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/xsrc/xc/programs/xconsole/xconsole.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 xconsole.c
*** xc/programs/xconsole/xconsole.c	1 Sep 1999 18:52:43 -0000	1.1.1.4
--- xc/programs/xconsole/xconsole.c	12 Aug 2003 21:19:36 -0000
***************
*** 376,385 ****
  	return;
      XtSetArg (arglist[0], XtNiconName, &oldName);
      XtGetValues (top, arglist, 1);
!     newName = malloc (strlen (oldName) + 3);
      if (!newName)
  	return;
!     sprintf (newName, "%s *", oldName);
      XtSetArg (arglist[0], XtNiconName, newName);
      XtSetValues (top, arglist, 1);
      free (newName);
--- 376,385 ----
  	return;
      XtSetArg (arglist[0], XtNiconName, &oldName);
      XtGetValues (top, arglist, 1);
!     newName = malloc (strlen (oldName) + 5);
      if (!newName)
  	return;
!     sprintf (newName, "*** %s", oldName);
      XtSetArg (arglist[0], XtNiconName, newName);
      XtSetValues (top, arglist, 1);
      free (newName);
***************
*** 405,416 ****
      XtSetArg (arglist[0], XtNiconName, &oldName);
      XtGetValues (top, arglist, 1);
      oldlen = strlen (oldName);
!     if (oldlen >= 2) {
!     	newName = malloc (oldlen - 1);
      	if (!newName)
  	    return;
!     	strncpy (newName, oldName, oldlen - 2);
! 	newName[oldlen - 2] = '\0';
      	XtSetArg (arglist[0], XtNiconName, newName);
      	XtSetValues (top, arglist, 1);
      	free (newName);
--- 405,415 ----
      XtSetArg (arglist[0], XtNiconName, &oldName);
      XtGetValues (top, arglist, 1);
      oldlen = strlen (oldName);
!     if (oldlen >= 5) {
!     	newName = malloc (oldlen - 5);
      	if (!newName)
  	    return;
!     	strcpy (newName, oldName + 4);
      	XtSetArg (arglist[0], XtNiconName, newName);
      	XtSetValues (top, arglist, 1);
      	free (newName);
>Release-Note:
>Audit-Trail:
>Unformatted: