7.2.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:
— Scheme Procedure:
passwd:name pw
The name of the userid.
— Scheme Procedure:
passwd:passwd pw
The encrypted passwd.
— Scheme Procedure:
passwd:uid pw
The user id number.
— Scheme Procedure:
passwd:gid pw
The group id number.
— Scheme Procedure:
passwd:gecos pw
The full name.
— Scheme Procedure:
passwd:dir pw
The home directory.
— Scheme Procedure:
passwd:shell pw
The login shell.
— Scheme Procedure:
getpwuid uid
Look up an integer userid in the user database.
— Scheme Procedure:
getpwnam name
Look up a user name string in the user database.
— Scheme Procedure:
setpwent
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.
— Scheme Procedure:
getpwent
Read the next entry in the user database stream. The return is a
passwd user object as above, or #f when no more entries.
— Scheme Procedure:
endpwent
Closes the stream used by getpwent. The return value is unspecified.
— Scheme Procedure:
setpw [
arg]
— C Function:
scm_setpwent (
arg)
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.
— Scheme Procedure:
getpw [
user]
— C Function:
scm_getpwuid (
user)
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:
— Scheme Procedure:
group:name gr
The group name.
— Scheme Procedure:
group:passwd gr
The encrypted group password.
— Scheme Procedure:
group:gid gr
The group id number.
— Scheme Procedure:
group:mem gr
A list of userids which have this group as a supplementary group.
— Scheme Procedure:
getgrgid gid
Look up an integer group id in the group database.
— Scheme Procedure:
getgrnam name
Look up a group name in the group database.
— Scheme Procedure:
setgrent
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.
— Scheme Procedure:
getgrent
Return the next entry in the group database, using the stream set by
setgrent.
— Scheme Procedure:
endgrent
Closes the stream used by getgrent.
The return value is unspecified.
— Scheme Procedure:
setgr [
arg]
— C Function:
scm_setgrent (
arg)
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.
— Scheme Procedure:
getgr [
name]
— C Function:
scm_getgrgid (
name)
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 procedure is also available.
— Scheme Procedure:
getlogin
— C Function:
scm_getlogin ()
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.