err(3) Library Functions Manual err(3) NOME err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - messaggi di errore formattati LIBRARY Standard C library (libc, -lc) SINTASSI #include [[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 [[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 e NULL viene emesso un messaggio di errore formattato in stile printf(3). L'output e 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). +-------------------------------------+---------------+----------------+ |Interfaccia | Attributo | Valore | +-------------------------------------+---------------+----------------+ |err(), errx(), warn(), warnx(), | Thread safety | MT-Safe locale | |verr(), verrx(), vwarn(), vwarnx() | | | +-------------------------------------+---------------+----------------+ STANDARDS 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 e stata creata da Giulio Daprela , Elisabetta Galli e Marco Curreli Questa traduzione e documentazione libera; leggere la GNU General Public License Versione 3 o successiva per le condizioni di copyright. Non ci assumiamo alcuna responsabilita. Per segnalare errori nella traduzione di questa pagina di manuale inviare un messaggio a . Linux man-pages 6.06 31 ottobre 2023 err(3)