nmh-workers
[Top] [All Lists]

Re: [nmh-workers] I Could Have Sworn that the inc Command used to work.

2019-06-03 03:46:56
On Mon, 03 Jun 2019 09:08:16 +0100 Ralph Corderoy <ralph@inputplus.co.uk> wrote:
Hi Ken,

/var/mail/$USER   Location of the system mail drop.

But we don't actually use $USER (we call getpwuid(getuid()) and use
that).

And even then it's not that simple.

I personally interpreted the use of $USER as "the username goes here",
not "we use the value of the $USER environment variable".  But I admit
that this is not clear.

I'd interpret it as being able to do `USER=notme inc'.

Should we simplify the code to demand $LOGNAME exists and use that?
POSIX, he say

    LOGNAME
        The system shall initialize this variable at the time of login
        to be the user's login name.  See <pwd.h>.  For a value of
        LOGNAME to be portable across implementations of POSIX.1-2017,
        the value should be composed of characters from the portable
        filename character set.

You can use getlogin(3) or getlogin_r(3) as per ISO/IEC 9945-1:1996.

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>