getlogin

Returns the current login from /etc/utmp, if any.
(Not supported on MS-DOS.)