capgetent(capfile, name, capbuf, capbufsiz) char *capfile, *name, *capbuf; int capbufsiz; capgetnum(capbuf, id) char *capbuf, *id; capgetflag(capbuf,id) char *capbuf, *id; char * capgetstr(capbuf, id, area, asizep) char *capbuf, *id, **area; int *asizep; capgetnext(fp, capbuf, capbufsiz) FILE *fp; char *capbuf; int capbufsiz;
Capgetent extracts the entry for the capability from the file named capfile and the entry name into the buffer at capbuf. Capbuf is assumed to be at least of size capbufsiz and may be passed to subsequent calls to capgetnum, capgetflag, and capgetstr. Capgetent returns -1 if the data base file could be opened, 0 if the capability name given does not have an entry, 2 if the buffer is not sufficiently large, and 1 if all goes well. Capgetent does not check for environment variables or user-defined capabilities files, though such searches can easily be performed as a higher level of software that makes multiple calls to capgetent.
Capgetnum gets the numeric value of capability id, from the capability buffer capbuf returning -1 if is not given for the database entry. Capgetflag returns 1 if the specified capability is present in the database's entry, 0 if it is not. Capgetstr returns the string value of the capability id, from the buffer capbuf, places it in a second buffer at area, and advances the area pointer. The remaining amount of space in area is stored in asizep and is adjusted as more space is used. If asizep is a null pointer, the size of the buffer is assumed to be infinite. You are warned. When a call to capgetstr is made initially, the value of the contents of asizep should accurately reflect the size of the area. It decodes the abbreviations for this field described in termcap(5). Capgetstr returns NULL if the capability was not found.
Capgetnext reads the next database entry from the FILE pointer fp into the space provided at capbuf up to a maximum size of capbufsiz. 1 is returned if the read was succesful, 0 is returned at end-of-file, -1 is returned if the FILE pointer is a null pointer, and 2 is returned if the space provided was insufficient.