Next: Time, Previous: File System, Up: POSIX
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:
Initializes a stream used by
getpwentto read from the user database. The next use ofgetpwentwill return the first entry. The return value is unspecified.
Return the next entry in the user database, using the stream set by
setpwent.
If called with a true argument, initialize or reset the password data stream. Otherwise, close the stream. The
setpwentandendpwentprocedures are implemented on top of this.
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:
Initializes a stream used by
getgrentto read from the group database. The next use ofgetgrentwill return the first entry. The return value is unspecified.
Return the next entry in the group database, using the stream set by
setgrent.
If called with a true argument, initialize or reset the group data stream. Otherwise, close the stream. The
setgrentandendgrentprocedures are implemented on top of this.
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.
Return a string containing a user name associated with the effective user id of the process. Return
#fif this information cannot be obtained.This function has been removed from the latest POSIX specification, Guile provides it only if the system has it. Using
(getpwuid (geteuid))may be a better idea.