err(3) Library Functions Manual err(3) NOMBRE err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - mensajes de error con formato BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #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); DESCRIPCION La familia de funciones err() y warn() muestran un mensaje de error con formato en la salida estandar de error. En todos los casos, se imprime el ultimo componente del nombre del programa, un caracter 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 caracter nueva linea. 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 anaden ningun mensaje de error. Las funciones err(), verr(), errx() y verrx() no regresan, sino que terminan la ejecucion con el valor del argumento eval. ATRIBUTOS Para obtener una explicacion de los terminos usados en esta seccion, vease attributes(7). +------------------+--------------------+-----------------------------------------------+ |Interfaz | Atributo | Valor | +------------------+--------------------+-----------------------------------------------+ |err(), errx(), | Seguridad del hilo | Configuracion regional de multi-hilo seguro | |warn(), warnx(), | | | |verr(), verrx(), | | | |vwarn(), vwarnx() | | | +------------------+--------------------+-----------------------------------------------+ ESTANDARES BSD. HISTORIAL err() warn() 4.4BSD. EJEMPLOS Muestra la cadena de informacion 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); VEASE TAMBIEN error(3), exit(3), perror(3), printf(3), strerror(3) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Miguel Perez Ibars Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de manual de Linux 6.06 31 Octubre 2023 err(3)