diff options
| author | Alejandro Colomar <alx@kernel.org> | 2025-08-19 17:48:50 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2025-08-20 18:14:03 +0200 |
| commit | 0e7a39804a3c017a209117fc2243c6cbb543dede (patch) | |
| tree | 91e0b287d8b826d668c3d8118347f07cc8b8964a /man/man3/mq_getattr.3 | |
| parent | e2d3f14fe40ad90a1fedf0fcd27e6cc896c49a7a (diff) | |
| download | man-pages-0e7a39804a3c.tar.gz | |
man/: EXAMPLES: Use err(3) and errc(3bsd) instead of similar macros
These functions are quite portable. And if one doesn't have them for
some reason (but libbsd has been ported to many systems), one can write
them easily as macros, anyway.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man3/mq_getattr.3')
| -rw-r--r-- | man/man3/mq_getattr.3 | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/man/man3/mq_getattr.3 b/man/man3/mq_getattr.3 index 644c83a3a9..9c327477e9 100644 --- a/man/man3/mq_getattr.3 +++ b/man/man3/mq_getattr.3 @@ -181,6 +181,7 @@ Linux 3.8.0 \& .\" SRC BEGIN (mq_getattr.c) .EX +#include <err.h> #include <fcntl.h> #include <mqueue.h> #include <stdio.h> @@ -188,9 +189,6 @@ Linux 3.8.0 #include <sys/stat.h> #include <unistd.h> \& -#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \[rs] - } while (0) -\& int main(int argc, char *argv[]) { @@ -204,16 +202,16 @@ main(int argc, char *argv[]) \& mqd = mq_open(argv[1], O_CREAT | O_EXCL, 0600, NULL); if (mqd == (mqd_t) \-1) - errExit("mq_open"); + err(EXIT_FAILURE, "mq_open"); \& if (mq_getattr(mqd, &attr) == \-1) - errExit("mq_getattr"); + err(EXIT_FAILURE, "mq_getattr"); \& printf("Maximum # of messages on queue: %ld\[rs]n", attr.mq_maxmsg); printf("Maximum message size: %ld\[rs]n", attr.mq_msgsize); \& if (mq_unlink(argv[1]) == \-1) - errExit("mq_unlink"); + err(EXIT_FAILURE, "mq_unlink"); \& exit(EXIT_SUCCESS); } |
