[net.bugs.4bsd] 4.2 Mail bug fix

lee@unmvax.UUCP (02/20/84)

 If a user has parends in the gecos field in /etc/passwd the Mail interface
tacks a parend onto the end of his name. This makes 'r' or 'R' annoying.

Repeat by:
	Log in as a user who has an open/close parend pair in his gecos
	field (or make one or whatever...) and send mail to yourself.
	When you enter mail you will notice something like..

unmvax 2.1 "/usr/spool/mail/lee": 4 messages
>   1 genix!ldl Sun Nov 20 00:02  15/266
    2 parsec!kolstad Thu Sep 15 23:29  37/1251 "Re:  UUCP connect"
    3 lee      Sun Sep  4 22:27  14/275 "bad INTEL board"
    4 stanly)   Sun Feb 19 16:33  12/302 "Re:  REDUCE"
&

To fix:
cd to /usr/src/ucb/Mail and edit aux.c The following is a diff -c to show
what needs changed.


*** aux.original	Sun Feb 19 19:58:57 1984
--- aux.c	Sun Feb 19 20:02:31 1984
***************
*** 1,5
  /*
!  * $Header: aux.c,v 1.1 84/02/19 19:58:53 root Exp $
   * $Log:	aux.c,v $
   * Revision 1.1  84/02/19  19:58:53  root
   * Initial revision

--- 1,5 -----
  /*
!  * $Header: aux.c,v 1.2 84/02/19 20:02:02 root Exp $
   * $Log:	aux.c,v $
   * Revision 1.2  84/02/19  20:02:02  root
   * Fixed the parends at the end of the name problem.
***************
*** 1,6
  /*
   * $Header: aux.c,v 1.1 84/02/19 19:58:53 root Exp $
   * $Log:	aux.c,v $
   * Revision 1.1  84/02/19  19:58:53  root
   * Initial revision
   * 

--- 1,10 -----
  /*
   * $Header: aux.c,v 1.2 84/02/19 20:02:02 root Exp $
   * $Log:	aux.c,v $
+  * Revision 1.2  84/02/19  20:02:02  root
+  * Fixed the parends at the end of the name problem.
+  * 			--Lee
+  * 
   * Revision 1.1  84/02/19  19:58:53  root
   * Initial revision
   * 
***************
*** 565,572
  	for (cp = name, cp2 = nbuf; c = *cp++; ) {
  		switch (c) {
  		case '(':
! 			while (*cp != ')' && *cp != 0)
! 				cp++;
  			if (*cp)
  				cp++;
  			lastsp = 0;

--- 569,592 -----
  	for (cp = name, cp2 = nbuf; c = *cp++; ) {
  		switch (c) {
  		case '(':
! 			/* If a user has parends in the GECOS field this
! 			 * used to get TOTALLY messed. We just keep track
! 			 * of how many open parends we see and keep going
! 			 * until count is zero rather than quit at the
! 			 * first close parend.
! 			 * 		--Lee	84/02/19
! 			 */
! 			{
! 				int pcount = 1;
! 
! 				while (*cp != 0 && pcount > 0) {
! 					if (*cp == '(')
! 						++pcount;
! 					else if (*cp == ')')
! 						--pcount;
! 					++cp;
! 				}
! 			}
  			if (*cp)
  				cp++;
  			lastsp = 0;


			--Lee (Ward)

		{ucbvax,parsec,gatech}!unmvax!lee