cuserid Subroutine

Purpose

Gets the alphanumeric user name associated with the current process.

Library

Standard C Library (libc.a)

Use the libc_r.a library to access the thread-safe version of this subroutine.

Syntax

#include <stdio.h>

char *cuserid ( Name)
char *Name;

Description

The cuserid subroutine gets the alphanumeric user name associated with the current process. This subroutine generates a character string representing the name of a process's owner.

Note: The cuserid subroutine duplicates functionality available with the getpwuid and getuid subroutines. Present applications should use the getpwuid and getuid subroutines.

If the Name parameter is a null pointer, then a character string of size L_cuserid is dynamically allocated with malloc, and the character string representing the name of the process owner is stored in this area. The cuserid subroutine then returns the address of this area. Multithreaded application programs should use this functionality to obtain thread specific data, and then continue to use this pointer in subsequent calls to the curserid subroutine. In any case, the application program must deallocate any dynamically allocated space with the free subroutine when the data is no longer needed.

If the Name parameter is not a null pointer, the character string is stored into the array pointed to by the Name parameter. This array must contain at least the number of characters specified by the constant L_cuserid. This constant is defined in the stdio.h file.

If the user name cannot be found, the cuserid subroutine returns a null pointer; if the Name parameter is not a null pointer, a null character ('\0') is stored in Name [0].

Parameter

Item Description
Name Points to a character string representing a user name.