Node:User Information,
Next:Time,
Previous:File System,
Up:POSIX
38.4 User Information
The facilities in this section provide an interface to the user and
group database.
They should be used with care since they are not reentrant.
The following functions accept an object representing user information
and return a selected component:
passwd:name
- The name of the userid.
passwd:passwd
- The encrypted passwd.
passwd:uid
- The user id number.
passwd:gid
- The group id number.
passwd:gecos
- The full name.
passwd:dir
- The home directory.
passwd:shell
- The login shell.
getpwuid uid
|
Scheme Procedure |
Look up an integer userid in the user database.
|
getpwnam name
|
Scheme Procedure |
Look up a user name string in the user database.
|
setpwent
|
Scheme Procedure |
Initializes a stream used by getpwent to read from the user database.
The next use of getpwent will return the first entry. The
return value is unspecified.
|
getpwent
|
Scheme Procedure |
Return the next entry in the user database, using the stream set by
setpwent .
|
endpwent
|
Scheme Procedure |
Closes the stream used by getpwent . The return value is unspecified.
|
setpw [arg]
|
Scheme Procedure |
scm_setpwent (arg)
|
C Function |
If called with a true argument, initialize or reset the password data
stream. Otherwise, close the stream. The setpwent and
endpwent procedures are implemented on top of this.
|
getpw [user]
|
Scheme Procedure |
scm_getpwuid (user)
|
C Function |
Look up an entry in the user database. obj can be an integer,
a string, or omitted, giving the behaviour of getpwuid, getpwnam
or getpwent respectively.
|
The following functions accept an object representing group information
and return a selected component:
group:name
- The group name.
group:passwd
- The encrypted group password.
group:gid
- The group id number.
group:mem
- A list of userids which have this group as a supplementary group.
getgrgid gid
|
Scheme Procedure |
Look up an integer group id in the group database.
|
getgrnam name
|
Scheme Procedure |
Look up a group name in the group database.
|
setgrent
|
Scheme Procedure |
Initializes a stream used by getgrent to read from the group database.
The next use of getgrent will return the first entry.
The return value is unspecified.
|
getgrent
|
Scheme Procedure |
Return the next entry in the group database, using the stream set by
setgrent .
|
endgrent
|
Scheme Procedure |
Closes the stream used by getgrent .
The return value is unspecified.
|
setgr [arg]
|
Scheme Procedure |
scm_setgrent (arg)
|
C Function |
If called with a true argument, initialize or reset the group data
stream. Otherwise, close the stream. The setgrent and
endgrent procedures are implemented on top of this.
|
getgr [name]
|
Scheme Procedure |
scm_getgrgid (name)
|
C Function |
Look up an entry in the group database. obj can be an integer,
a string, or omitted, giving the behaviour of getgrgid, getgrnam
or getgrent respectively.
|
In addition to the accessor procedures for the user database, the
following shortcut procedures are also available.
cuserid
|
Scheme Procedure |
scm_cuserid ()
|
C Function |
Return a string containing a user name associated with the
effective user id of the process. Return #f if this
information cannot be obtained.
|
getlogin
|
Scheme Procedure |
scm_getlogin ()
|
C Function |
Return a string containing the name of the user logged in on
the controlling terminal of the process, or #f if this
information cannot be obtained.
|