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/duplocale.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/duplocale.3')
| -rw-r--r-- | man/man3/duplocale.3 | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/man/man3/duplocale.3 b/man/man3/duplocale.3 index dfaaddd557..7f66c743bb 100644 --- a/man/man3/duplocale.3 +++ b/man/man3/duplocale.3 @@ -119,13 +119,11 @@ ABC .EX #define _XOPEN_SOURCE 700 #include <ctype.h> +#include <err.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> \& -#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \[rs] - } while (0) -\& int main(int argc, char *argv[]) { @@ -142,11 +140,11 @@ main(int argc, char *argv[]) \& loc = uselocale((locale_t) 0); if (loc == (locale_t) 0) - errExit("uselocale"); + err(EXIT_FAILURE, "uselocale"); \& nloc = duplocale(loc); if (nloc == (locale_t) 0) - errExit("duplocale"); + err(EXIT_FAILURE, "duplocale"); \& for (char *p = argv[1]; *p; p++) putchar(toupper_l(*p, nloc)); |
