CUSERID

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

cuserid - get user name  

SYNOPSIS

Fd #include <stdio.h> Ft char * Fn cuserid char *buf  

DESCRIPTION

Bf -symbolic This interface is available from the compatibility library, libcompat. Ef

The Fn cuserid function returns a character string representation of the user name associated with the effective user ID of the calling process.

If Fa buf is not the NULL pointer, the user name is copied into the memory referenced by Fa buf . The argument Fa buf is assumed to point to an array at least L_cuserid (as defined in the include file Aq Pa stdio.h ) bytes long. Otherwise, the user name is copied to a static buffer.

 

RETURN VALUES

If Fa buf is not the NULL pointer, Fa buf is returned; otherwise the address of the static buffer is returned.

If the user name could not be determined, if Fa buf is not the NULL pointer, the null character `\0' will be stored at Fa *buf ; otherwise the NULL pointer is returned.  

SEE ALSO

getlogin(2), getpwent(3)  

STANDARDS

The Fn cuserid function conforms to St -p1003.1-88 .  

BUGS

Due to irreconcilable differences in historic implementations, Fn cuserid was removed from the St -p1003.1-90 standard. This implementation exists purely for compatibility with existing programs. New programs should use one of the following three alternatives to obtain the user name:

  1. Fn getlogin to return the user's login name.
  2. getpwuid (Fn geteuid ) to return the user name associated with the calling process' effective user ID.
  3. getpwuid (Fn getuid ) to return the user name associated with the calling process' real user ID.

The Fn cuserid function uses Fn getpwuid ; thus the results of a user's call to Fn getpwent , Fn getpwnam or Fn getpwuid will be overwritten by subsequent calls to Fn cuserid .


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO
STANDARDS
BUGS

This document was created by man2html, using the manual pages.
Time: 21:44:10 GMT, August 05, 2022