.EPOST - post an error message.

Alternate Entry Name: _EPOST

Usage:

B:
   .epost( errnum, format, arg1, arg2, ... );
C:
   void _epost(int errnum, const char *format, ...);

Where:

errnum
is the error number of the message you are posting.
format
is a PRINTF-style format string giving the message you want to post.
arg1, arg2, ...
are argument values to be used in the placeholders of the "format" string.

Description:

.EPOST "posts" an error message. This means that the message is formatted using the "format" string and arguments, then is saved in memory for later retrieval.

For example, suppose that a program encounters an error but wants to perform some clean-up or error recovery operations before it issues an error message to the user. The program may use .EPOST to create and save an appropriate error message, then perform whatever clean-up actions are necessary. Later on, it can retrieve the message and actually output it. Formatting the message before cleaning up may let you create a more informative message, since the clean-up process may get rid of data which would be useful to include in the message.

Only one message can be posted at a time. Thus each call to .EPOST overwrites the message posted by the previous call.

There are several ways to retrieve a posted message:

msg = .strer(errnum);

assigns "msg" a pointer to a string holding the text of the currently posted message, provided that the specified "errnum" matches the error number of the posted message. Once you have obtained this message pointer, you can output it in the usual way (e.g. with PRINTF).

.perror(prefix);

outputs the "prefix" string followed by the posted error message, provided that the current value of "errno" matches the error number of the posted message.

See Also:

expl b lib .strer

expl b lib io.err

expl b lib .perror

Copyright © 1996, Thinkage Ltd.