Amiga Developer Site by i n n o i d e a | MorphOS | Amiga Developers | Compilers | Documents | Dev-HardFile v1.11 for UAE / real Amiga - readme - shot) | Unique/All Visitors: 77257/570053
Search manual for function in the   
GeekGadgets/getlogin - AmiTCP/getlogin
NAME 

getlogin, cuserid - get user name

SYNOPSIS 

#include <unistd.h> 


char *getlogin(void); 


#include <stdio.h> 


char *cuserid(char *string);

DESCRIPTION 

getlogin returns a pointer to a string containing the name of
the user logged in on the controlling terminal of the process, or a
null pointer if this information cannot be determined.  The string is
statically allocated and might be overwritten on subsequent calls to
this function or to cuserid.


cuserid returns a pointer to a string containing a user name
associated with the effective user ID of the process.  If string
is not a null pointer, it should be an array that can hold at least
L_cuserid characters; the string is returned in this array.
Otherwise, a pointer to a string in a static area is returned. This
string is statically allocated and might be overwritten on subsequent
calls to this function or to getlogin.


The macro L_cuserid is an integer constant that indicates how
long an array you might need to store a user name.  L_cuserid is
declared in stdio.h.


These functions let your program identify positively the user who is
running (cuserid) or the user who logged in this session
(getlogin).  (These can differ when setuid programs are
involved.)


For most purposes, it is more useful to use the environment variable
LOGNAME to find out who the user is.  This is more flexible
precisely because the user can set LOGNAME arbitrarily.

ERRORS 

ENOMEM 
Insufficient memory to allocate passwd structure.

FILES 


/etc/passwd	password database file

/var/run/utmp	(traditionally /etc/utmp;
			some libc versions used /var/adm/utmp)


CONFORMING TO 

POSIX.1.  System V has a cuserid function which uses the real
user ID rather than the effective user ID. The cuserid function
was included in the 1988 version of POSIX, but removed from the 1990 version.

BUGS 

Unfortunately, it is often rather easy to fool getlogin().
Sometimes it does not work at all, because some program messed up
the utmp file. Often, it gives only the first 8 characters of
the login name. The user currently logged in on the controlling tty
of our program need not be the user who started it.
Avoid getlogin() for security-related purposes.


Nobody knows precisely what cuserid() does - avoid it in portable programs -
avoid it altogether - use getpwuid(geteuid()) instead, if that is
what you meant.
DO NOT USE cuserid().

SEE ALSO 

geteuid(2),
getuid(2)




Logo by Emeric/SH
GeekGadgets/getlogin

No examples found...


Functions with "g":
gai_strerror
gcvt
get_current_dir_name
get_myaddress
getaddrinfo
getc
getc_unlocked
getchar
getchar_unlocked
getcontext
getcwd
getdate
getdate_r
getdelim
getdents
getdirentries
getdomainname
getdtablesize
getegid
getenv
geteuid
getfsent
getfsfile
getfsspec
getgid
getgrent
getgrgid
getgrnam
getgroups
gethostbyaddr
gethostbyname
gethostbyname2
gethostbyname2_r
gethostbyname_r
gethostid
gethostnamadr.c
gethostname
gethtbynamadr.h
getipnodebyaddr
getipnodebyname
getitimer
getline
getloadavg
getlogin
getmntent
getnameinfo
getnetbyaddr
getnetbyname
getnetent
getopt
getopt_long
getopt_long_only
getpagesize
getpass
getpeername
getpgid
getpgrp
getpid
getppid
getpriority
getprotobyname
getprotobynumber
getprotoent
getpw
getpwent
getpwnam
getpwuid
getresgid
getresuid
getrlimit
getrpcbyname
getrpcbynumber
getrpcent
getrpcport
getrusage
gets
getservbyname
getservbyport
getservent
getsid
getsockname
getsockopt
gettimeofday
getuid
getusershell
getutent
getutid
getutline
getutxent
getutxid
getutxline
getw
getwc
getwc_unlocked
getwchar
getwchar_unlocked
getwd
getxbyy.c
glob
glob.h
globfree
glue.h
gmtime
gnu.a.out.h
goto
gprof.h
grp.h
gst.h
gtty
gvarargs.h

Last 15 uploaded Examples:

20071229151342 AmiSSL/X509_STORE_CTX_cleanup
20070708011052 GeekGadgets/getlogin
20060705053954 AmigaOS/OpenWorkbenchObjectA
20050801035639 SDL/SDL_Surface
20050727092732 BlitzBasic/LSL
20050718102843 SDL/SDL_WarpMouse
20050718072844 GeekGadgets/fread
20050714051528 SDL/SDL_ActiveEvent
20050714051514 SDL/SDL_ActiveEvent
20050701171401 GeekGadgets/errno
20050701171347 GeekGadgets/errno
20050627101951 SDL/SDL_FreeSurface
20050623152729 GeekGadgets/fork
20050619153102 GeekGadgets/tcdrain
20050615182849 AmigaOS/OpenScreen

Last 25 posts:

20050613235812 SDL/SDL_SetGammaRamp
20050526065000 AmiTCP/unistd.h
20050413041558 AmiSSL/X509_STORE_set_default_paths
20050409155750 AmigaDOS/Status
20050129230614 MUI/Calendar.mcc
20050128185620 GeekGadgets/hstrerror
20041126154558 BlitzBasic/LoadBank
20041123170704 GeekGadgets/gcvt
20041105222909 AmigaOS/CheckSignal
20040712190839 SDL/SDL_SetVideoMode
20040627090529 SDL/SDL_Init
20040519133228 GeekGadgets/fork
20040407124555 AmigaOS/AllocMem
20040403101120 GeekGadgets/inet_ntoa
20040327172814 GeekGadgets/random
20040327172714 GeekGadgets/srandom
20040313211937 BlitzBasic/ANALYZEDISK
20040303135237 GeekGadgets/mktemp
20040301131355 GeekGadgets/realpath
20040301123615 GeekGadgets/gcvt
20040301114000 GeekGadgets/htonl
20040301100209 GeekGadgets/realpath
20040229095437 GeekGadgets/time
20040211132618 GeekGadgets/getpid
20040209102818 AmigaOS/OpenWindow




Amiga.sf
AMIGIFT

Locations of visitors to this page

Page took 0.629155 seconds to load.