From owner-freebsd-current Sun Sep 29 07:57:54 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA06346 for current-outgoing; Sun, 29 Sep 1996 07:57:54 -0700 (PDT) Received: from spitfire.ecsel.psu.edu (spitfire.ecsel.psu.edu [146.186.218.51]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id HAA06297 for ; Sun, 29 Sep 1996 07:57:47 -0700 (PDT) From: tenser@spitfire.ecsel.psu.edu Received: (qmail 4390 invoked by uid 1000); 29 Sep 1996 14:58:00 -0000 Date: 29 Sep 1996 14:58:00 -0000 Message-ID: <19960929145800.4389.qmail@spitfire.ecsel.psu.edu> To: current@freebsd.org Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Subject: Qmail changes... I decided to set up Qmail on my new -current system down here, but found that mail(1) and from(1) break when not used with a centralized mail drop, ie /var/mail. Looking at the source, I saw that neither mail(1) nor from(1) honor the MAIL environment variable. Seeing no problem with this, since neither command is privaledged, I made the small modifications necessary to support ``MAIL''. Would someone please commit these the the source tree? Thanks! - Dan C. --- *** /usr/src/usr.bin/from/from.c 1996/09/29 01:40:35 1.1 --- /usr/src/usr.bin/from/from.c 1996/09/29 01:58:06 *************** *** 42,50 **** --- 42,52 ---- #endif /* not lint */ #include + #include #include #include + #include #include #include *************** *** 83,98 **** argv += optind; if (!file) { ! if (!(file = *argv)) { ! if (!(pwd = getpwuid(getuid()))) { ! fprintf(stderr, "from: no password file entry for you.\n"); ! exit(1); } - file = pwd->pw_name; } - (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, file); - file = buf; } /* read from stdin */ --- 85,106 ---- argv += optind; if (!file) { ! if (*argv) { ! (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, *argv); ! file = buf; ! } else { ! if (!(file = getenv("MAIL"))) { ! if (!(pwd = getpwuid(getuid()))) { ! (void)fprintf(stderr, "from: no password file entry for you.\n"); ! exit(1); ! } ! file = pwd->pw_name; ! (void)sprintf(buf, ! "%s/%s", _PATH_MAILDIR, file); ! file = buf; } } } /* read from stdin */ *** /usr/src/usr.bin/from/from.1 1996/09/29 01:58:15 1.1 --- /usr/src/usr.bin/from/from.1 1996/09/29 14:45:01 *************** *** 72,77 **** --- 72,82 ---- .Ar user Ns 's mailbox, is examined instead of the invoker's own mailbox. (Privileges are required.) + .Sh ENVIRONMENT + .Bl -tag -width Fl + .It Ev MAIL + If set, the location of the invoker's mailbox. Otherwise, the default + in /var/mail is used. .Sh FILES .Bl -tag -width /var/mail/* -compact .It Pa /var/mail/* *** /usr/src/usr.bin/mail/v7.local.c 1996/09/29 02:00:23 1.1 --- /usr/src/usr.bin/mail/v7.local.c 1996/09/29 02:03:41 *************** *** 55,61 **** findmail(user, buf) char *user, *buf; { ! (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, user); } /* --- 55,66 ---- findmail(user, buf) char *user, *buf; { ! char *tmp = getenv("MAIL"); ! ! if (tmp == NULL) ! (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, user); ! else ! (void)strcpy(buf, tmp); } /* *** /usr/src/usr.bin/mail/mail.1 1996/09/29 14:45:24 1.1 --- /usr/src/usr.bin/mail/mail.1 1996/09/29 14:47:59 *************** *** 30,36 **** .\" SUCH DAMAGE. .\" .\" @(#)mail.1 8.2 (Berkeley) 12/30/93 ! .\" $Id: mail.1,v 1.1 1996/09/29 14:45:24 tenser Exp $ .\" .Dd December 30, 1993 .Dt MAIL 1 --- 30,36 ---- .\" SUCH DAMAGE. .\" .\" @(#)mail.1 8.2 (Berkeley) 12/30/93 ! .\" $Id: mail.1,v 1.2 1996/09/29 14:47:58 tenser Exp $ .\" .Dd December 30, 1993 .Dt MAIL 1 *************** *** 985,991 **** .Ev HOME and .Ev USER ! environment variables. .Sh FILES .Bl -tag -width /usr/share/misc/Mail.help* -compact .It Pa /var/mail/* --- 985,995 ---- .Ev HOME and .Ev USER ! environment variables. Also, if the ! .Ev MAIL ! environment variable is set, it is used as the ! location of the user's mailbox instead of the ! default in /var/mail. .Sh FILES .Bl -tag -width /usr/share/misc/Mail.help* -compact .It Pa /var/mail/*