From owner-freebsd-current Sat Dec 12 20:03:55 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA07447 for freebsd-current-outgoing; Sat, 12 Dec 1998 20:03:55 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA07442 for ; Sat, 12 Dec 1998 20:03:53 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.1/8.9.1) id UAA15675; Sat, 12 Dec 1998 20:03:52 -0800 (PST) (envelope-from dillon) Date: Sat, 12 Dec 1998 20:03:52 -0800 (PST) From: Matthew Dillon Message-Id: <199812130403.UAA15675@apollo.backplane.com> To: freebsd-current@FreeBSD.ORG Subject: PR bin/8665 proposed fix (very minor) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. (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