HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
g
getprtcent(3) getprtcent(3)
Note that ufld and uflg refer to user-specific entries, and sfld and sflg refer to the system default values (see
authcap(4)).
The value returned by
getprtcent() or getprtcnam() refers to a structure that is overwritten by
calls to these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry using
structure assignment and supply the modified buffer to
putprtcnam() .
getprtcent() returns a pointer to the first terminal pr_term structure in the database when first
called. Thereafter, it returns a pointer to the next pr_term structure in the database, so successive calls
can be used to search the database.
getprtcnam()
searches from the beginning of the database until a
terminal name matching name is found, and returns a pointer to the particular structure in which it was
found. If an end-of-file or an error is encountered on reading, these functions return a
NULL pointer.
A call to
setprtcent() has the effect of rewinding the Terminal Control database to allow repeated
searches. endprtcent() can be called to close the Terminal Control database when processing is com-
plete.
putprtcnam() puts a new or replaced terminal control entry pr with key name into the database. If the
fg_devname field is 0, the requested entry is deleted from the Terminal Control database.
putprtcnam() locks the database for all update operations, and performs an endprtcent() after the
update or failed attempt.
APPLICATION USAGE
In a multithreaded application, these routines are safe to be called only from one dedicated thread. These
routines are not POSIX.1c async-cancel safe nor async-signal safe.
RETURN VALUE
getprtcent() and getprtcnam() return NULL pointers on EOF or error. putprtcnam()
returns 0 if it cannot add or update the entry.
NOTES
The fd_devname field, on systems supporting connections, may refer to the ASCII representation of a host
name. This can be determined by using getdvagnam() (see getdvagent(3)) to interrogate the Device
Assignment database as to the type of the device, passing in the fd_devname field of the Terminal Control
structure as an argument. This allows lockout by machine, instead of the device (typically pseudo tty) on
which the session originated.
Programs using these routines must be compiled with -lsec
.
The sfld and sflg structures are filled from corresponding fields in the system default database. Thus, a
program can easily extract the user-specific or system-wide parameters for each database field (see get-
prpwent() and getdvagent).
FILES
/tcb/files/ttys Terminal Control database
/tcb/files/auth/system/default
System Defaults database
SEE ALSO
getprdfent(3), authcap(4), ttys(4).
HP-UX 11i Version 2: December 2007 Update − 2 − Hewlett-Packard Company 529