Most functions in `Libshishi' are returning an error if they fail. For this reason, the application should always catch the error condition and take appropriate measures, for example by releasing the resources and passing the error up to the caller, or by displaying a descriptive message to the user and cancelling the operation.
Some error values do not indicate a system error or an error in the operation, but the result of an operation that failed properly.
Errors are returned as an int. Except for the SHISHI_OK case, an application should always use the constants instead of their numeric value. Applications are encouraged to use the constants even for SHISHI_OK as it improves readability. Possible values are:
This value indicates success. The value of this error is guaranteed to always be 0 so you may use it in boolean constructs.
%s%s\n
%s%s
%s%s\n
%s%s
const char * shishi_strerror
(int err)
err: shishi error code
Return value: Returns a pointer to a statically allocated string containing a description of the error with the error value err. This string can be used to output a diagnostic message to the user.
const char * shishi_error
(Shishi * handle)
handle: shishi handle as allocated by shishi_init().
Extract detailed error information string. Note that the memory is managed by the Shishi library, so you must not deallocate the string.
Return value: Returns pointer to error information string, that must not be deallocate by caller.
void shishi_error_clear
(Shishi * handle)
handle: shishi handle as allocated by shishi_init().
Clear the detailed error information string. See shishi_error() for how to access the error string, and shishi_error_set() and shishi_error_printf() for how to set the error string. This function is mostly for Shishi internal use, but if you develop an extension of Shishi, it may be useful to use the same error handling infrastructure.
void shishi_error_set
(Shishi * handle, const char * error)
handle: shishi handle as allocated by shishi_init().
error: Zero terminated character array containing error description, or NULL to clear the error description string.
Set the detailed error information string to specified string. The string is copied into the Shishi internal structure, so you can deallocate the string passed to this function after the call. This function is mostly for Shishi internal use, but if you develop an extension of Shishi, it may be useful to use the same error handling infrastructure.
void shishi_error_printf
(Shishi * handle, const char * format, ...)
handle: shishi handle as allocated by shishi_init().
format: printf style format string. ...: print style arguments.
Set the detailed error information string to a printf formatted string. This function is mostly for Shishi internal use, but if you develop an extension of Shishi, it may be useful to use the same error handling infrastructure.
int shishi_outputtype
(Shishi * handle)
handle: shishi handle as allocated by shishi_init().
Get the current output type for logging messages.
Return value: Return output type (NULL, stderr or syslog) for informational and warning messages.
void shishi_set_outputtype
(Shishi * handle, int type)
handle: shishi handle as allocated by shishi_init().
type: output type.
Set output type (NULL, stderr or syslog) for informational and warning messages.
void shishi_info
(Shishi * handle, const char * format, ...)
handle: shishi handle as allocated by shishi_init().
format: printf style format string. ...: print style arguments.
Print informational message to output as defined in handle.
void shishi_warn
(Shishi * handle, const char * format, ...)
handle: shishi handle as allocated by shishi_init().
format: printf style format string. ...: print style arguments.
Print a warning to output as defined in handle.