CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions

Retrieve a printer's CAPS Printer Device Parameter Directory. More...

Functions

struct caps_si_handlecaps_si_create (void)
 
void caps_si_destroy (struct caps_si_handle *h)
 
int caps_si_char_device_node_check (struct caps_si_handle *h, const char *f)
 
char * caps_si_dir_from_node_retrieve (struct caps_si_handle *h, const char *f)
 
char * caps_si_dir_from_name_retrieve (struct caps_si_handle *h, const char *n)
 

Detailed Description

The base functions to work with the library and discover a printer device's specific CAPS Printer Device Parameter Directory.

Function Documentation

◆ caps_si_create()

struct caps_si_handle * caps_si_create ( void  )

Initialize the library prior use

Returns
Library instance to be used by all other functions in this library
Note
Does not return in case of memory failure
Postcondition
The returned library instance handle needs to be freed after use via caps_si_destroy()

◆ caps_si_destroy()

void caps_si_destroy ( struct caps_si_handle h)

Clean up resources

Parameters
[in]hLibrary instance
Note
This call will also close error message catching. Refer Error message handling for details.

◆ caps_si_char_device_node_check()

int caps_si_char_device_node_check ( struct caps_si_handle h,
const char *  f 
)

Check, if the given path/filename is a character device node

Parameters
[in]hLibrary instance
[in]fPath to check
Return values
1f points to a character device node
0f doesn't point to a character device node
-EINVALf is invalid
Precondition
h must be a valid library instance handle returned by caps_si_create() call

◆ caps_si_dir_from_node_retrieve()

char * caps_si_dir_from_node_retrieve ( struct caps_si_handle h,
const char *  f 
)

Retrieve the CAPS Printer Device Parameter Directory from the device node

Parameters
[in]hLibrary instance
[in]fDevice node in the form "/dev/...."
Return values
PATHPath to the corresponding CAPS Printer Device Parameter Directory
NULLNo corresponding printer device with devnode f found
Note
This function creates readable error messages (refer caps_si_error_messages_catch())
Precondition
f must be a printer device node. Check first with caps_si_char_device_node_check()
h must be a valid library instance handle returned by caps_si_create() call
Postcondition
The returned directory path string must be freed after use.

◆ caps_si_dir_from_name_retrieve()

char * caps_si_dir_from_name_retrieve ( struct caps_si_handle h,
const char *  n 
)

Retrieve the CAPS Printer Device Parameter Directory from the printer's name

Parameters
[in]hLibrary instance
[in]nName of the printer like the capsprinter list command returns it
Return values
PATHPath to the corresponding CAPS Printer Device Parameter Directory
NULLNo corresponding printer device with name n found
Note
This function creates readable error messages (refer caps_si_error_messages_catch())
Precondition
n must be a name string
h must be a valid library instance handle returned by caps_si_create() call
Postcondition
The returned directory path string must be freed after use.