Subject: Re: Location of Mail directory?
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: - Greg Earle <earle@isolar.Tujunga.CA.US>
List: current-users
Date: 04/05/1994 23:04:55
>>I took a look at /usr/src/usr/bin/mail but didn't find any obvious reason why.
>
>Umm, if you track down where mail gets the name from, you find:
>
>char*   
>username()
>{
>        char *np; 
> 
>        if ((np = getenv("USER")) != NOSTR)
>                return np;
>        return getname(getuid());
>}
>
>Now, I'll bet that you've got USER set ...

Alas, I thought about that.

That wasn't it.  It was the fact that $MAIL was set.  So you were right, it
was my environment - it appears that when one does a "from root" or a
"Mail -u root" while su'd in SunOS 4.1.x, it ignores $MAIL.  But NetBSD doesn't
so that is what threw me off.

It turns out that SunOS' "findmail()" only checks for $MAIL iff (a) $USER is
also set, *and* (b) $USER == myname.  BTW, the SunOS "username()" also checks
to see that getuid() returns a non-zero value before returning ...

Perhaps Mail(1) could be updated to mention that $MAIL is also used (the
`Environment' section mentions $HOME and $USER, but doesn't mention how they
are used.) if it is set?  (cf. /usr/src/usr.bin/mail/v7.local.c::findmail() )

I will write on the chalkboard 100 times:

	I will remember that NetBSD doesn't always behave like SunOS ...
	I will remember that NetBSD doesn't always behave like SunOS ...
	I will remember that NetBSD doesn't always behave like SunOS ...
	...
(-:

	- Greg

P.S. I suddenly realized that this should probably have gone to "netbsd-bugs",
     even though it isn't a bug afterall (-:

------------------------------------------------------------------------------