Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(2)

psignal(3)

PERROR(3)                            BSD                             PERROR(3)



NAME
     perror, strerror, errno, sys_errlist, sys_nerr - system error messages

SYNOPSIS
     #include <stdio.h>
     void perror(s)
     const char *s;

     #include <string.h>
     char *strerror(errnum)
     int errnum;

     extern int errno;
     extern char *sys_errlist[ ];
     extern int sys_nerr;

DESCRIPTION
     The perror function produces a short error message on the standard error
     file, describing the error encountered by a C program during its most
     recent call to the system.  If s is not null, and does not point to the
     null character, perror prints the argument string s, followed by a colon
     and a space.  perror then prints the error message and a newline,
     regardless of the value of s.  A generally useful value for s is the name
     of the program that incurred the error.

     The error message is obtained from sys_errlist, indexed by the value of
     errno (see intro(2)).  errno is set when errors occur, but it is not
     cleared by successful calls.

     To simplify creation of variant formats, the vector of message strings
     sys_errlist is provided.  sys_nerr is the number of messages provided for
     in the table.  If errnum is less than sys_nerr, strerror returns an
     address from sys_errlist pointing to a message string without the
     newline.  Otherwise, strerror returns a pointer to the string "Unknown
     error". You should check sys_nerr because new error codes may be added to
     the system before they are added to the table.  Typically, the value
     passed to strerror is errno.

NOTES
     More verbose, Domain/OS-specific error messages may be obtained by
     setting the environment variable APOLLO_STATUS to "true".

SEE ALSO
     intro(2), psignal(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026