Contact
Impressum
Why this name?
pdf

err

NOMBRE

err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - mensajes de error con formato

BIBLIOTECA

Biblioteca Estándar C (libc, -lc)

SINOPSIS

#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);

DESCRIPCIÓN

La familia de funciones err() y warn() muestran un mensaje de error con formato en la salida estándar de error. En todos los casos, se imprime el último componente del nombre del programa, un carácter punto y un espacio. Si el argumento fmt es distinto de NULL, se imprime un mensaje de error con formato al estilo de printf(3). La salida finaliza con un carácter nueva línea.

The err(), verr(), warn(), and vwarn() functions append an error message obtained from strerror(3) based on the global variable errno, preceded by another colon and space unless the fmt argument is NULL.

Las funciones errx() y warnx() no añaden ningún mensaje de error.

Las funciones err(), verr(), errx() y verrx() no regresan, sino que terminan la ejecución con el valor del argumento eval.

ATRIBUTOS

Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

img

ESTÁNDARES

These functions are nonstandard BSD extensions.

EJEMPLOS

Muestra la cadena de información del errno actual y termina:

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);

Muestra un mensaje de error y termina:

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

Aviso de un error:

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);

VÉASE TAMBIÉN

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

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars <mpi79470 AT alu DOT um DOT es>

Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish.

pdf
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

No Banana Union - No Software Patents