error, error_at_line, error_message_count, error_one_per_line, error_print_progname − glibc error reporting functions


#include <error.h>

void error(int status, int errnum, const char *format, ...);

void error_at_line(int status, int errnum, const char *filename,
unsigned int
linenum, const char *format, ...);

extern unsigned int error_message_count;

extern int error_one_per_line;

extern void (*error_print_progname) (void);


error() is a general error-reporting function. It flushes stdout, and then outputs to stderr the program name, a colon and a space, the message specified by the printf(3)-style format string format, and, if errnum is nonzero, a second colon and a space followed by the string given by strerror(errnum). Any arguments required for format should follow format in the argument list. The output is terminated by a newline character.

The program name printed by error() is the value of the global variable program_invocation_name(3). program_invocation_name initially has the same value as main()’s argv[0]. The value of this variable can be modified to change the output of error().

If status has a nonzero value, then error() calls exit(3) to terminate the program using the given value as the exit status.

The error_at_line() function is exactly the same as error(), except for the addition of the arguments filename and linenum. The output produced is as for error(), except that after the program name are written: a colon, the value of filename, a colon, and the value of linenum. The preprocessor values __LINE__ and __FILE__ may be useful when calling error_at_line(), but other values can also be used. For example, these arguments could refer to a location in an input file.

If the global variable error_one_per_line is set nonzero, a sequence of error_at_line() calls with the same value of filename and linenum will result in only one message (the first) being output.

The global variable error_message_count counts the number of messages that have been output by error() and error_at_line().

If the global variable error_print_progname is assigned the address of a function (i.e., is not NULL), then that function is called instead of prefixing the message with the program name and colon. The function should print a suitable string to stderr.


These functions and variables are GNU extensions, and should not be used in programs intended to be portable.


err(3), errno(3), exit(3), perror(3), program_invocation_name(3), strerror(3)


This page is part of release 3.69 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at−pages/.

More Linux Commands

keyctl_get_security_alloc(3) - Retrieve a key's security con
keyctl_get_security() retrieves the security context of a key as a NUL-terminated string. This will be rendered in a form appropriate to the LSM in force - for

shlock(1) - Create lock files for use in shell scripts......
shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the process ID from the file an

java-java-1.6.0-openjdk(1) - the Java application launcher
The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that classs main method.

ldap_modrdn_s(3) - Perform an LDAP modify RDN operation.....
The ldap_modrdn() and ldap_modrdn_s() routines perform an LDAP modify RDN operation. They both take dn, the DN of the entry whose RDN is to be changed, and newr

winwstr(3ncurses) - get a string of wchar_t characters from
These routines return a string of wchar_t characters in wstr, extracted starting at the current cursor position in the named window. Attributes are stripped fro

mysqldumpslow(1) - Summarize slow query log files (ManPage)
The MySQL slow query log contains information about queries that take a long time to execute (see Section 5.2.5, The Slow Query Log). mysqldumpslow parses MySQL

cfsetspeed(3) - get and set terminal attributes, line contro
The termios functions describe a general terminal interface that is provided to control asynchronous communications ports. The termios structure Many of the fun

vpddecode(8) - VPD structure decoder - Linux manual page....
vpddecode prints the vital product data information that can be found in almost all IBM and Lenovo computers. Available items are: * BIOS Build ID * Box Serial

tk_setPalette(n) - Modify the Tk color palette (Man Page)...
The tk_setPalette procedure changes the color scheme for Tk. It does this by modifying the colors of existing widgets and by changing the option database so tha

Tk_CreateItemType(3) - define new kind of canvas item.......
Tk_CreateItemType is invoked to define a new kind of canvas item described by the typePtr argument. An item type corresponds to a particular value of the type a

FcMatrixEqual(3) - Compare two matrices - Linux manual page
FcMatrixEqual compares matrix1 and matrix2 returning FcTrue when they are equal and FcFalse when they are not. VERSION Fontconfig version 2.8.0 FcMatrixEqual.3

gnutls_hex2bin(3) - API function (Library - Linux man page)
Convert a buffer with hex data to binary data. RETURNS GNUTLS_E_SUCCESS on success, otherwise a negative error code. SINCE 2.4.0 REPORTING BUGS Report bugs to &lt;

We can't live, work or learn in freedom unless the software we use is free.