diff options
author | px4dev <px4@purgatory.org> | 2012-08-29 21:38:52 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-08-29 21:38:52 -0700 |
commit | 732e23a883e940b9fb11908a5d1f0592b9549dfb (patch) | |
tree | 5fcd82882408dbf4d655108cbc1b853436721417 /apps/systemlib/err.h | |
parent | c816cca816779820814277f18b276622e8c6dc3f (diff) | |
download | px4-firmware-732e23a883e940b9fb11908a5d1f0592b9549dfb.tar.gz px4-firmware-732e23a883e940b9fb11908a5d1f0592b9549dfb.tar.bz2 px4-firmware-732e23a883e940b9fb11908a5d1f0592b9549dfb.zip |
Add some documentation for the warn/err functions.
Diffstat (limited to 'apps/systemlib/err.h')
-rw-r--r-- | apps/systemlib/err.h | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/apps/systemlib/err.h b/apps/systemlib/err.h index bc390d233..f798b97e7 100644 --- a/apps/systemlib/err.h +++ b/apps/systemlib/err.h @@ -36,6 +36,30 @@ * * Simple error/warning functions, heavily inspired by the BSD functions of * the same names. + * + * The err() and warn() family of functions display a formatted error + * message on the standard error output. In all cases, the last + * component of the program name, a colon character, and a space are + * output. If the fmt argument is not NULL, the printf(3)-like formatted + * error message is output. The output is terminated by a newline + * character. + * + * The err(), errc(), verr(), verrc(), warn(), warnc(), vwarn(), and + * vwarnc() functions append an error message obtained from strerror(3) + * based on a supplied error code value or the global variable errno, + * preceded by another colon and space unless the fmt argument is NULL. + * + * In the case of the errc(), verrc(), warnc(), and vwarnc() functions, + * the code argument is used to look up the error message. + * + * The err(), verr(), warn(), and vwarn() functions use the global + * variable errno to look up the error message. + * + * The errx() and warnx() functions do not append an error message. + * + * The err(), verr(), errc(), verrc(), errx(), and verrx() functions do + * not return, but exit with the value of the argument eval. + * */ #ifndef _SYSTEMLIB_ERR_H @@ -47,18 +71,18 @@ __BEGIN_DECLS __EXPORT const char *getprogname(void); -__EXPORT void err(int, const char *, ...) __attribute__((noreturn,format(printf,2, 3))); -__EXPORT void verr(int, const char *, va_list) __attribute__((noreturn,format(printf,2, 0))); -__EXPORT void errc(int, int, const char *, ...) __attribute__((noreturn,format(printf,3, 4))); -__EXPORT void verrc(int, int, const char *, va_list) __attribute__((noreturn,format(printf,3, 0))); -__EXPORT void errx(int, const char *, ...) __attribute__((noreturn,format(printf,2, 3))); -__EXPORT void verrx(int, const char *, va_list) __attribute__((noreturn,format(printf,2, 0))); -__EXPORT void warn(const char *, ...) __attribute__((format(printf,1, 2))); -__EXPORT void vwarn(const char *, va_list) __attribute__((format(printf,1, 0))); -__EXPORT void warnc(int, const char *, ...) __attribute__((format(printf,2, 3))); -__EXPORT void vwarnc(int, const char *, va_list) __attribute__((format(printf,2, 0))); -__EXPORT void warnx(const char *, ...) __attribute__((format(printf,1, 2))); -__EXPORT void vwarnx(const char *, va_list) __attribute__((format(printf,1, 0))); +__EXPORT void err(int eval, const char *fmt, ...) __attribute__((noreturn,format(printf,2, 3))); +__EXPORT void verr(int eval, const char *fmt, va_list) __attribute__((noreturn,format(printf,2, 0))); +__EXPORT void errc(int eval, int code, const char *fmt, ...) __attribute__((noreturn,format(printf,3, 4))); +__EXPORT void verrc(int eval, int code, const char *fmt, va_list) __attribute__((noreturn,format(printf,3, 0))); +__EXPORT void errx(int eval, const char *fmt, ...) __attribute__((noreturn,format(printf,2, 3))); +__EXPORT void verrx(int eval, const char *fmt, va_list) __attribute__((noreturn,format(printf,2, 0))); +__EXPORT void warn(const char *fmt, ...) __attribute__((format(printf,1, 2))); +__EXPORT void vwarn(const char *fmt, va_list) __attribute__((format(printf,1, 0))); +__EXPORT void warnc(int code, const char *fmt, ...) __attribute__((format(printf,2, 3))); +__EXPORT void vwarnc(int code, const char *fmt, va_list) __attribute__((format(printf,2, 0))); +__EXPORT void warnx(const char *fmt, ...) __attribute__((format(printf,1, 2))); +__EXPORT void vwarnx(const char *fmt, va_list) __attribute__((format(printf,1, 0))); __END_DECLS |