cuserid - character login name of the user (LEGACY)
#include <stdio.h> char *cuserid(char *s);
The cuserid() function generates a character representation of the name associated with the real or effective user ID of the process.If s is a null pointer, this representation is generated in an area that may be static (and thus overwritten by subsequent calls to cuserid()), the address of which is returned. If s is not a null pointer, s is assumed to point to an array of at least {L_cuserid} bytes; the representation is deposited in this array. The symbolic constant {L_cuserid} is defined in <stdio.h> and has a value greater than 0.
If the application uses any of the _POSIX_THREAD_SAFE_FUNCTIONS or _POSIX_THREADS interfaces, the cuserid() function must be called with a non-NULL parameter.
If s is not a null pointer, s is returned. If s is not a null pointer and the login name cannot be found, the null byte `\0' will be placed at *s. If s is a null pointer and the login name cannot be found, cuserid() returns a null pointer. If s is a null pointer and the login name can be found, the address of a buffer (possibly static) containing the login name is returned.
No errors are defined.
None.
The functionality of cuserid() defined in the POSIX.1-1988 standard (and Issue 3 of this specification) differs from that of historical implementations (and Issue 2 of this specification). In the ISO POSIX-1 standard, cuserid() is removed completely. In this specification, therefore, both functionalities are allowed.The Issue 2 functionality can be obtained by using:
getpwuid(getuid())
The Issue 3 functionality can be obtained by using:
getpwuid(geteuid())
None.
getlogin(), getpwnam(), getpwuid(), getuid(), geteuid(), <stdio.h>.
Derived from System V Release 2.0.