.PERROR - output error message to standard error unit.

Alternate Entry Name: __PERR

Usage:

B:
   .perror(s);
C:
   void __perror(const char *s);
   /* TWO leading underscores */

Where:

s
points to a character string that will be printed as the first part of the error message. PERROR outputs this string first, followed by a colon and a blank, followed by the error message generated by .STRERROR. The most helpful sort of string would be the name of the program or some similar identifier.

Description:

.PERROR prints out an error message based on the current value of the external variable ERRNO. It calls the function .STRERROR to obtain the text of the appropriate error message. The message obtained will be the message most recently posted by .EPOST, provided that the current value of ERRNO matches the error number specified when the message was posted; otherwise, .PERROR prints out the default message associated with the current value of ERRNO.

Note that there is a similar function PERROR which calls STRERROR instead of .STRERROR. In general, you should use .PERROR instead of PERROR, because the value of ERRNO doesn't already reflect the error that caused the posted message. For example, if the user presses BREAK between the time the error message is posted and the time you call PERROR, ERRNO changes to reflect the user interrupt rather than the original error. If you use .PERROR instead of PERROR, you get the posted message describing the original error.

See Also:

expl b lib .strerror

expl b lib perror

expl b lib .epost

Copyright © 1996, Thinkage Ltd.