nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ralph Corderoy
Subject: Re: [nmh-workers] I Could Have Sworn that the inc Command used to work.
Date: Mon, 03 Jun 2019 11:28:52 +0100

Hi Bakul,

> > Should we simplify the code to demand $LOGNAME exists and use that?
>
> You can use getlogin(3) or getlogin_r(3) as per ISO/IEC 9945-1:1996.

That seems worse.  Linux's getlogin(3) says in Description that $LOGNAME
is often more useful, and its Bugs section is an amusing read.
getlogin(3p) from POSIX is also available for detail.

getlogin() copes with multiple usernames for the same ID and finds the
one used on this controlling terminal, checking FDs 0-2 until ‘success’
and crawling utmp.  That's overkill for our purposes.  $LOGNAME is in
our memory and a function call away, plus it's easy to document and
useful to override.

-- 
Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]