Subject: ring my bell

From: [email-masked] (Arnold D. Robbins)
Date: Mon, 11 Oct 1993 04:18:00 -0400

Matty has the bell code in 9term disabled - you have to define BEEP and you
only get a bell if in Unix mode.

Me, I like to start a long running job and then echo '^G' when I'm done to
tell me I can come back to my system.  So, here's a patch for 9term.c that
makes beeping a button 3 item, independent of the unix/plan 9 keyboard mode.
Not beeping is the default behaviour, so this won't affect you if you don't
want bells anyway.

And hey, if you consider this a trivial patch, don't apply it, but don't
bother to flame me about it. It makes my life easier. :-)

Arnold Robbins -- The Basement Computer		| Laundry increases
Internet: [email-masked]		| exponentially in the
UUCP:	{ gatech, emory }!skeeve!arnold		| number of children.
Bitnet:	Forget it. Get on a real network.	|    -- Miriam Robbins
---------
*** 9term.h.orig	Sat Sep 11 00:37:27 1993
--- 9term.h	Mon Oct 11 04:05:03 1993
***************
*** 17,22 ****
--- 17,23 ----
  extern int		comm_fd;
  extern int		slave_fd;
  extern int		kbdmode;
+ extern int		dobeep;
  extern int		utmpentry;
  
  extern Rune		intrchar;
*** 9term.c.orig	Sat Sep 11 00:38:34 1993
--- 9term.c	Mon Oct 11 04:11:09 1993
***************
*** 30,36 ****
  	mSCROLL
  };
  
! static	char	*modenames[] = {"fwd","bkwd","suspend","view","review",0,0};
  static	Menu	kmode = {modenames} ;
  enum {	mFWD,
  	mBKWD,
--- 30,36 ----
  	mSCROLL
  };
  
! static	char	*modenames[] = {"fwd","bkwd","suspend","view","review",0,0,0};
  static	Menu	kmode = {modenames} ;
  enum {	mFWD,
  	mBKWD,
***************
*** 37,46 ****
--- 37,48 ----
  	mSUSP,
  	mVIEW,
  	mREVIEW,
+ 	mBEEP,
  	mMODE
  };
  
  int	kbdmode = PLAN9;
+ int	dobeep = 0;
  
  static	Cursor	whitearrow = {
  	{0, 0},
***************
*** 283,291 ****
  				FLUSHBUF();
  				*q++ = *p;
  				break;
- #ifdef BEEP
  			case 0x07:
! 				if (kbdmode == UNIX)
  					beep();
  				else {
  					if (q >= &buf[EMAXMSG])	/* buffer full? */
--- 285,292 ----
  				FLUSHBUF();
  				*q++ = *p;
  				break;
  			case 0x07:
! 				if (dobeep)
  					beep();
  				else {
  					if (q >= &buf[EMAXMSG])	/* buffer full? */
***************
*** 293,299 ****
  					*q++ = *p;
  				}
  				break;
- #endif
  			case '\b':		/* backspace at output point */
  				if (q > buf)
  					q--;
--- 294,299 ----
***************
*** 432,437 ****
--- 432,438 ----
  {
  	kmode.item[mMODE] = (kbdmode == PLAN9) ?"unix":"plan 9";
  	kmode.item[mSUSP] = suspended ? "resume" : "suspend";
+ 	kmode.item[mBEEP] = dobeep ? "nobeep" : "beep";
  	switch (menuhit(3, m, &kmode))
  	{
  	case mFWD:
***************
*** 451,456 ****
--- 452,460 ----
  		break;
  	case mREVIEW:
  		textset(text, _backnl(text, text->base, text->f.maxlines/2));
+ 		break;
+ 	case mBEEP:
+ 		dobeep = ! dobeep;
  		break;
  	case mMODE:
  		if (kbdmode == UNIX)