getlogin
getlogin is a function in POSIX-compliant operating systems that returns the name of the user logged in on the controlling terminal of the calling process. It is part of the standard C library. The function typically reads the username from the environment variable LOGNAME. If LOGNAME is not set, it may fall back to other methods, such as reading from the /etc/passwd file.
The getlogin function is often used to identify the current user for logging purposes, access control, or
The return value of getlogin is a pointer to a null-terminated string containing the username. This pointer