Reads the platform configuration file and initializes the environment so that calls can be made to a core driver. This function or ASC_INIT() must be called before any other API function. ASC_INIT_EXT() differs from ASC_INIT() in that you can provide a buffer into which the API places error messages if the API environment cannot be initialized.
#include <ascauth.h>
ASCENV *ASC_INIT_EXT(char *filename, char *error_msg, size_t size);
Returns a pointer to the environment item created upon success. If an error has occurred, NULL is returned, and a descriptive error message is placed into the error_msg buffer.
#include <stdio.h>
#include <stdlib.h>
#include <ascauth.h>
#define BUFSIZE 256
main()
{
ASCENV *asce;
/* initialize the authentication environment */
/* allocate buffer */
buffer = (char *) malloc(BUFSIZE);
asce = ASC_INIT_EXT(NULL, buffer, BUFSIZE);
if (asce == NULL) {
fprintf(stderr, "Error: cannot initialize authentication environment\n");
fprintf(stderr, “ %s \n", buffer);
exit(EXIT_FAILURE);
}
/* now you can make additional authentication calls here */
/* now terminate the authentication environment */
ASC_TERM(asce);
return 0;
}