Skip site navigation (1)Skip section navigation (2)
Date:      29 Sep 1996 14:58:00 -0000
From:      tenser@spitfire.ecsel.psu.edu
To:        current@freebsd.org
Message-ID:  <19960929145800.4389.qmail@spitfire.ecsel.psu.edu>

next in thread | raw e-mail | index | archive | help
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 <sys/types.h>
+ 
  #include <ctype.h>
  #include <pwd.h>
  #include <stdio.h>
+ #include <stdlib.h>
  #include <string.h>
  #include <paths.h>
  
***************
*** 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/*



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