Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ perror(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf

perror

Purpose

     Writes a message explaining a system call error.

Library

     Standard C Library (libc.a)

Syntax

     void perror (s)                           extern int errno;
     char *s;                                  extern char *sys_errlist[ ];
                                               extern int sys_nerr;
     Description

     The perror  subroutine writes  a message on  the standard
     error output that describes the last error encountered by
     a system  call or library subroutine.   The error message
     includes  the  parameter  string  s  followed  by  a  ":"
     (colon), a blank, the  message, and a new-line character.
     To  be of  the most  use, the  parameter string  s should
     include the  name of the  program that caused  the error.
     The  error number  is  taken from  the external  variable
     errno,  which is  set when  an error  occurs, but  is not
     cleared when a  successful call is made.   See -- Heading
     id 'errno'  unknown -- for  a discussion of  errno values
     and their meanings.

     To simplify various message formats, the array of message
     strings sys_errlist  is provided.  Use errno  as an index
     into this  table to  get the  message string  without the
     new-line character.  The  largest message number provided
     in  the table  is sys_nerr.   Be sure  to check  sys_nerr
     because new error codes may be added to the system before
     they are added to the table.

     Related Information

     In  this  book:   "printf,  fprintf,  sprintf,  NLprintf,
     NLfprintf, NLsprintf."

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