Signal an error with a message
void SLang_verror (int code, char *fmt, ...);
The SLang_verror
function sets SLang_Error
to
code
if SLang_Error
is 0. It also displays the error
message implied by the printf
variable argument list using
fmt
as the format.
FILE *open_file (char *file)
{
char *file = "my_file.dat";
if (NULL == (fp = fopen (file, "w")))
SLang_verror (SL_INTRINSIC_ERROR, "Unable to open %s", file);
return fp;
}
SLang_vmessage, SLang_exit_error
Signal an error
void SLang_doerror (char *err_str)
The SLang_doerror
function displays the string err_str
to the error device and signals a S-Lang error.
SLang_doerror
is considered to obsolete. Applications should
use the SLang_verror
function instead.
SLang_verror, SLang_exit_error
Display a message to the message device
void SLang_vmessage (char *fmt, ...)
This function prints a printf
style formatted variable
argument list to the message device. The default message device is
stdout
.
SLang_verror
Exit the program and display an error message
void SLang_exit_error (char *fmt, ...)
The SLang_exit_error
function terminates the program and
displays an error message using a printf
type variable
argument list. The default behavior to this function is to write
the message to stderr
and exit with the exit
system
call.
If the function pointer SLang_Exit_Error_Hook
is
non-NULL, the function to which it points will be called. This
permits an application to perform whatever cleanup is necessary.
This hook has the prototype:
void (*SLang_Exit_Error_Hook)(char *, va_list);
SLang_verror, exit