DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

cuserid(S)


cuserid -- get character login name of the user

Syntax

cc . . . -lc

#include  <stdio.h>

char *cuserid (s) char *s;

Description

The cuserid routine creates a character-string of the login name that the owner of the current process is logged in under. If s is a NULL pointer, this string is generated in an internal static area, the address of which is returned by cuserid. Otherwise, the string is left in the array, assumed to contain at least L_cuserid characters, to which s points. The constant L_cuserid is defined in the <stdio.h> header file.

Return value

If the argument s is not NULL and the routine is successful, cuserid returns s. If s is NULL, the routine returns the address where the string is internally stored. If the login name is not found and s is NULL, cuserid returns a NULL pointer. If the login name is not found and s is not NULL, a null character('nbsp;') will be placed in s[0] and s is returned by cuserid.

Note

When s is NULL, as mentioned above, the string is stored in an internal static area whose contents are overwritten by each call to cuserid.

The cuserid routine uses the getpwuid routine, and therefore the results of a getpwuid or a getpwnam routine may be destroyed by a subsequent call to cuserid.

See also

getlogin(S), getpwent(S)

Standards conformance

cuserid conforms with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003