.\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" From: @(#)err.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.11.2.5 2001/08/17 15:42:32 ru Exp $ .\" .\" 2011-09-10, mtk, Converted from mdoc to man macros .\" .\" Traduzione di Giulio Daprelà .\" ottobre 2005 .\" Aggiornamento a man-pages 2.71 di Elisabetta Galli .\" dicembre 2007 .\" Aggiornamento a man-pages-3.53 di Marco Curreli .\" agosto 2013 .\" Aggiornamento a man-pages-3.56 di Marco Curreli .\" gennaio 2014 .\" .TH ERR 3 2013-12-30 "Linux" "Linux Programmer's Manual" .SH NOME err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- messaggi di errore formattati .SH SINTASSI .nf .B #include .sp .BI "void err(int " eval ", const char *" fmt ", ...);" .sp .BI "void errx(int " eval ", const char *" fmt ", ...);" .sp .BI "void warn(const char *" fmt ", ...);" .sp .BI "void warnx(const char *" fmt ", ...);" .sp .B #include .sp .BI "void verr(int " eval ", const char *" fmt ", va_list " args ); .sp .BI "void verrx(int " eval ", const char *" fmt ", va_list " args ); .sp .BI "void vwarn(const char *" fmt ", va_list " args ); .sp .BI "void vwarnx(const char *" fmt ", va_list " args ); .fi .SH DESCRIZIONE Le famiglie di funzioni .BR err () e .BR 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 .I fmt non è NULL viene emesso un messaggio di errore formattato in stile .BR printf (3) . L'output è concluso da un carattere newline. .PP Le funzioni .BR err (), .BR verr (), .BR warn (), e .BR vwarn () aggiungono un messaggio di errore ottenuto da .BR strerror (3) basato sulla variabile globale .IR errno , preceduto da un altro ":" e da uno spazio a meno che l'argomento .I fmt sia NULL. .PP Le funzioni .BR errx () e .BR warnx () non aggiungono un messaggio di errore. .PP Le funzioni .BR err (), .BR verr (), .BR errx (), e .BR verrx () non ritornano, ma escono con il valore dell'argomento .IR eval . .SH CONFORME A Queste funzioni sono estensioni BSD non standard. .\" .SH STORIA .\" Le funzioni .\" .BR err () .\" e .\" .BR warn () .\" apparirono inizialmente in .\" 4.4BSD. .SH ESEMPI Mostra la stringa di informazione attuale .I errno ed esce: .in +4n .nf p = malloc(size); if (p == NULL) err(1, NULL); fd = open(file_name, O_RDONLY, 0); if (fd == \-1) err(1, "%s", file_name); .fi .in .PP Visualizza un messaggio di errore ed esce: .in +4n .nf if (tm.tm_hour < START_TIME) errx(1, "too early, wait until %s", start_time_string); .fi .in .PP Avvisa di un errore: .in +4n .nf 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(1, "%s", block_device); .fi .in .SH VEDERE ANCHE .BR error (3), .BR exit (3), .BR perror (3), .BR printf (3), .BR strerror (3) .SH COLOPHON Questa pagina fa parte del rilascio 3.73 del progetto Linux .IR man-pages . Una descrizione del progetto, le istruzioni per la segnalazione degli errori, e l'ultima versione di questa pagina si trova su \%http://www.kernel.org/doc/man\-pages/. La versione italiana fa parte del pacchetto .I man-pages-it v. 3.73, a cura di: ILDP "Italian Linux Documentation Project" \%http://www.pluto.it/ildp .br Per la traduzione in italiano si pu\(`o fare riferimento a http://www.pluto.it/ildp/collaborare/ .br Segnalare eventuali errori di traduzione a .IR ildp@pluto.it