NAME

cat_init - initialize toolkit

SYNOPSIS

#include <cat/cat.h>

int cat_init(catinit_info *info);

DESCRIPTION

This function initializes the toolkit.

This function should be called exactly once, before any other functions in the SDK. If this function fails, no other SDK functions should be used. The info argument should either be NULL or point to a structure containing the following:

  typedef struct catinit_info {
        int size;
        int flags;
        int major;
        int minor;
  } catinit_info;

The size field should be set to sizeof(catinit_info). The major and minor fields should either be zero or set to the lowest required library version. If the library is found to be incompatible, cat_init() will fail with a CAT_ENOTFOUND error code. On return, the major and minor version of the library will be stored in the corresponding fields.

The flags field can contain a combination of:

CATINIT_NOSIGHANDLERS
(UNIX only) By default, the library will install signal handlers to ignore SIGPIPE, SIGXFSZ and SIGPOLL, as appropriate. This flag inhibits the installation of signal handlers. Signal handlers can also be installed after calling cat_init(). These signals must be handled in order for the library to function correctly.

CATINIT_NOLOCALE
By default, the library will set the locale to ``C''. This flag inhibits the changing of the locale.

RETURN VALUES

Returns CAT_OK if the SDK was successfully initialized or a negative code otherwise. Specifically, the function will return CAT_EBUSY if the library is already initialized, and CAT_ENOTFOUND for version incompatibility.

SEE ALSO

cat

NOTES

MT-level: Unsafe