pw_nametoid(S) 6 January 1993 pw_nametoid(S) Name pw_nametoid, pw_idtoname, gr_nametoid, gr_idtoname - map between user and group names and IDs Syntax cc . . . -lprot int pw_nametoid(name) char *name; char *pw_idtoname(id) int id; int gr_nametoid(name) char *name; char *gr_idtoname(id) int id; Description. These routines provide an efficient mapping between user and group names and identifiers (IDs). They maintain a separate binary database, which is automatically updated each time the routines encounter a changed /etc/passwd or /etc/group file. Also, these routines do not interfere with the behavior of the getpwent(S) and getgrent(S) routines, and are thus used by the Protected Database routines, which must frequently con- vert between names and identifiers but may not disrupt an application's use of password mapping routines. The pwnametoid expects the character argument name, a user name, and returns its associated user ID. The pwidtoname expects the argument id, a user ID number, and returns its associated user name. The grnametoid expects the character argument name, a group name, and returns its associated group ID. The gridtoname expects the argument id, a group ID number, and returns its associated group name. These routines are much more efficient than the getpwent(S) and getgrent(S) routines, in that they do not parse the underlying files and keep the database in memory after the first use. Thus, savings are much greater for the second and subsequent lookups. The binary databases are stored in the /etc/auth/system directory, which is maintained by the Auth protected subsystem. Return value Upon successful completion, the pwidtoname and the gridtoname routines return a pointer to a string in an internal (to the routines) memory area containing the user or the group names. These routines return a NULL on failure. Upon successful completion, the pwnametoid and the grnametoid routines return a non-negative user or group ID. On failure, these routines return a value of -1. Files /etc/auth/system/pw_id_map /etc/auth/system/gr_id_map /etc/passwd /etc/group See also getpwent(S), getgrent(S), getprpwent(S) Standards conformance All of these routines are an extension of AT&T System V provided by the Santa Cruz Operation.