Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Dec 1998 20:03:52 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        freebsd-current@FreeBSD.ORG
Subject:   PR bin/8665 proposed fix (very minor)
Message-ID:  <199812130403.UAA15675@apollo.backplane.com>

next in thread | raw e-mail | index | archive | help
    This is a very minor bug report, but I think worth fixing.  However,
    it does slightly change the operation of /bin/mail in the case where
    the $MAIL environment exists and the 'u' option is also used.  I weighed
    the operation before and after and I think the after operation is more
    correct.

    Before $MAIL would always override the mailbox filename even if -u was
    given to /bin/mail.  This is counter to the manual page which basically
    says that -u basically sets the mailbox file according to the specified
    user.  Afterwords, the -u option overrides $MAIL.  The -f option, of
    course, overrides both.

    If anybody is rabid about not making the below change, speak up.

						-Matt

    Matthew Dillon  Engineering, HiWay Technologies, Inc. & BEST Internet 
                    Communications & God knows what else.
    <dillon@backplane.com> (Please include original email in any response)    

Index: main.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/mail/main.c,v
retrieving revision 1.5
diff -c -r1.5 main.c
*** main.c	1998/01/02 16:43:50	1.5
--- main.c	1998/12/13 03:56:57
***************
*** 63,69 ****
--- 63,71 ----
  	struct name *to, *cc, *bcc, *smopts;
  	char *subject, *replyto;
  	char *ef, *cp;
+ 	int  have_fopt = 0;
  	char nosrc = 0;
+ 	char xname[PATHSIZE];
  	void hdrstop();
  	sig_t prevint;
  	void sigchild();
***************
*** 107,115 ****
  			break;
  		case 'u':
  			/*
! 			 * Next argument is person to pretend to be.
  			 */
  			myname = optarg;
  			break;
  		case 'i':
  			/*
--- 109,131 ----
  			break;
  		case 'u':
  			/*
! 			 * Next argument is person to pretend to be.  
! 			 * Unfortunately, this seriously confuses the $MAIL
! 			 * environment variable.  Since $MAIL is probably 
! 			 * wrong, we override it here.  If the user really
! 			 * cares he can use -f to specify the actual path.
  			 */
  			myname = optarg;
+ 			if (have_fopt == 0) {
+ 			    snprintf(
+ 				xname, 
+ 				sizeof(xname), 
+ 				"%s/%s",
+ 				_PATH_MAILDIR,
+ 				myname
+ 			    );
+ 			    ef = xname;
+ 			}
  			break;
  		case 'i':
  			/*
***************
*** 142,147 ****
--- 158,164 ----
  				ef = argv[optind++];
  			else
  				ef = "&";
+ 			have_fopt = 1;
  			break;
  		case 'n':
  			/*

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



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