Provided by:
manpages-it_0.3.4-1_all 
NOME
err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - messaggi di errore
formattati
SINTASSI
#include <err.h>
void err(int eval, const char *fmt, ...) void verr(int eval, const char
*fmt, va_list args) void errx(int eval, const char *fmt, ...) void
verrx(int eval, const char *fmt, va_list args) void warn(const char *fmt,
...) void vwarn(const char *fmt, va_list args) Ft void warnx(const char
*fmt, ...) void vwarnx(const char *fmt, va_list args)
DESCRIZIONE
Le famiglie di funzioni err() e warn() mostrano un messaggio di errore
formattato sull’output dello standard error. In tutti i casi, vengono
scritti: l’ultimo componente del nome del programma, ":" e uno spazio.
Se l’argomento fmt è specificato, vengono scritti: il messaggio di errore
formattato, ":" e uno spazio. Nel caso delle funzioni err(), verr(),
warn() e vwarn(), viene scritta la stringa del messaggio di errore,
affiliata con il valore corrente della variabile globale errno. In tutti
i casi, l’output è seguito da un carattere di nuova linea.
Le funzioni err(), verr(), errx() e verrx() non restituiscono un valore,
ma escono con il valore dell’argomento eval.
ESEMPI
Mostra la corrente stringa di informazione errno e esce:
if ((p = malloc(size)) == NULL)
err(1, NULL);
if ((fd = open(file_name, O_RDONLY, 0)) == -1)
err(1, "%s", file_name);
Mostra un messaggio di errore e esce:
if (tm.tm_hour < START_TIME)
errx(1, "troppo presto, aspetta fino a %s", start_time_string);
Avviso di un errore:
if ((fd = open(raw_device, O_RDONLY, 0)) == -1)
warnx("%s: %s: stò provando il dispositivo a blocchi",
raw_device, strerror(errno));
if ((fd = open(block_device, O_RDONLY, 0)) == -1)
err(1, "%s", block_device);
VEDERE ANCHE
strerror(3)
STORIA
Le funzioni err() e warn() sono apparse per la prima volta in 4.4BSD.