Next Previous Contents

8. Error and Messaging Functions

8.1 SLang_verror

Synopsis

Signal an error with a message

Usage

void SLang_verror (int code, char *fmt, ...);

Description

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.

Example

      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;
      }

See Also

SLang_vmessage, SLang_exit_error

8.2 SLang_doerror

Synopsis

Signal an error

Usage

void SLang_doerror (char *err_str)

Description

The SLang_doerror function displays the string err_str to the error device and signals a S-Lang error.

Notes

SLang_doerror is considered to obsolete. Applications should use the SLang_verror function instead.

See Also

SLang_verror, SLang_exit_error

8.3 SLang_vmessage

Synopsis

Display a message to the message device

Usage

void SLang_vmessage (char *fmt, ...)

Description

This function prints a printf style formatted variable argument list to the message device. The default message device is stdout.

See Also

SLang_verror

8.4 SLang_exit_error

Synopsis

Exit the program and display an error message

Usage

void SLang_exit_error (char *fmt, ...)

Description

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);

See Also

SLang_verror, exit


Next Previous Contents