Man page - err(3)

Packages contains this manual

Available languages:

en fr es it ja ro

Manual

err

NOME
LIBRERIA
SINTASSI
DESCRIZIONE
ATTRIBUTI
CONFORME A
STORIA
ESEMPI
VEDERE ANCHE
TRADUZIONE

NOME

err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - messaggi di errore formattati

LIBRERIA

Libreria C standard ( libc , -lc )

SINTASSI

#include <err.h>

[[noreturn]] void err(int eval , const char * fmt , ...);
[[noreturn]] void errx(int
eval , const char * fmt , ...);

void warn(const char * fmt , ...);
void warnx(const char *
fmt , ...);

#include <stdarg.h>

[[noreturn]] void verr(int eval , const char * fmt , va_list args );
[[noreturn]] void verrx(int
eval , const char * fmt , va_list args );

void vwarn(const char * fmt , va_list args );
void vwarnx(const char *
fmt , va_list args );

DESCRIZIONE

Le famiglie di funzioni err () e warn () visualizzano un messaggio di errore formattato sull’uscita dello standard error. In ogni caso vengono stampati l’ultimo componente del nome del programma, un carattere di due punti, e uno spazio. Se l’argomento fmt non è NULL viene emesso un messaggio di errore formattato in stile printf (3). L’output è concluso da un carattere newline.

Le funzioni err (), verr (), warn () e vwarn () aggiungono un messaggio di errore ottenuto da strerror (3) basato sulla variabile globale errno , preceduto da un altro ":" e da uno spazio a meno che l’argomento fmt sia NULL.

Le funzioni errx () e warnx () non aggiungono un messaggio di errore.

Le funzioni err (), verr (), errx () e verrx () non ritornano, ma escono con il valore dell’argomento eval .

ATTRIBUTI

Per la spiegazione dei termini usati in questa sezione, vedere attributes (7).

Image grohtml-3971654-1.png

CONFORME A

BSD.

STORIA

err ()

warn ()

4.4BSD.

ESEMPI

Mostra la stringa di informazione attuale errno ed esce:

p = malloc(size);
if (p == NULL)
err(EXIT_FAILURE, NULL);
fd = open(file_name, O_RDONLY, 0);
if (fd == -1)
err(EXIT_FAILURE, "%s", file_name);

Visualizza un messaggio di errore ed esce:

if (tm.tm_hour < START_TIME)
errx(EXIT_FAILURE, "too early, wait until %s",
start_time_string);

Avvisa di un errore:

fd = open(raw_device, O_RDONLY, 0);
if (fd == -1)
warnx("%s: %s: trying the block device",
raw_device, strerror(errno));
fd = open(block_device, O_RDONLY, 0);
if (fd == -1)
err(EXIT_FAILURE, "%s", block_device);

VEDERE ANCHE

error (3), exit (3), perror (3), printf (3), strerror (3)

TRADUZIONE

La traduzione italiana di questa pagina di manuale è stata creata da Giulio Daprelà <giulio@pluto.it>, Elisabetta Galli <lab@kkk.it>, Marco Curreli <marcocurreli@tiscali.it> e Giuseppe Sacco <eppesuig@debian.org>

Questa traduzione è documentazione libera; leggere la GNU General Public License Versione 3 o successiva per le condizioni di copyright. Non ci assumiamo alcuna responsabilità.

Per segnalare errori nella traduzione di questa pagina di manuale inviare un messaggio a pluto-ildp@lists.pluto.it .