diff options
author | Alex Colomar <alx.manpages@gmail.com> | 2022-09-12 17:03:08 +0200 |
---|---|---|
committer | Alex Colomar <alx.manpages@gmail.com> | 2022-09-12 19:13:48 +0200 |
commit | ad3868f0847f9ba3530532063bcb2bd0cb4bf509 (patch) | |
tree | ffe8f138d62d25a690f1d358191962fa039a78fd | |
parent | bc5312e4c4c483edbf8e6b5de2793baff170b6ca (diff) |
Various pages: EXAMPLES: Sort includes
Reported-by: clang-tidy(1)
Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
65 files changed, 117 insertions, 108 deletions
diff --git a/man3/CPU_SET.3 b/man3/CPU_SET.3 index 4d0b269b3..968da2b39 100644 --- a/man3/CPU_SET.3 +++ b/man3/CPU_SET.3 @@ -303,9 +303,10 @@ used for dynamically allocated CPU sets. .EX #define _GNU_SOURCE #include <sched.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> + #include <assert.h> int diff --git a/man3/bswap.3 b/man3/bswap.3 index 833cd9ee3..8b6ea17e9 100644 --- a/man3/bswap.3 +++ b/man3/bswap.3 @@ -40,11 +40,11 @@ $ \fB./a.out 0x0123456789abcdef\fP \& .\" SRC BEGIN (bswap.c) .EX -#include <stdio.h> +#include <byteswap.h> +#include <inttypes.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> -#include <inttypes.h> -#include <byteswap.h> int main(int argc, char *argv[]) diff --git a/man3/cacos.3 b/man3/cacos.3 index 56f8912a3..d82b39d86 100644 --- a/man3/cacos.3 +++ b/man3/cacos.3 @@ -59,9 +59,9 @@ C99, POSIX.1-2001, POSIX.1-2008. /* Link with "\-lm" */ #include <complex.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/cacosh.3 b/man3/cacosh.3 index d21e47364..d6bb52d71 100644 --- a/man3/cacosh.3 +++ b/man3/cacosh.3 @@ -62,9 +62,9 @@ C99, POSIX.1-2001, POSIX.1-2008. /* Link with "\-lm" */ #include <complex.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/catan.3 b/man3/catan.3 index 7ff383e5b..380c69f98 100644 --- a/man3/catan.3 +++ b/man3/catan.3 @@ -59,9 +59,9 @@ C99, POSIX.1-2001, POSIX.1-2008. /* Link with "\-lm" */ #include <complex.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/catanh.3 b/man3/catanh.3 index 621ba11a1..3bc3a8d6c 100644 --- a/man3/catanh.3 +++ b/man3/catanh.3 @@ -61,9 +61,9 @@ C99, POSIX.1-2001, POSIX.1-2008. /* Link with "\-lm" */ #include <complex.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/clock_getcpuclockid.3 b/man3/clock_getcpuclockid.3 index 4b6d5b559..8fe8bf241 100644 --- a/man3/clock_getcpuclockid.3 +++ b/man3/clock_getcpuclockid.3 @@ -120,9 +120,9 @@ CPU\-time clock for PID 1 is 2.213466748 seconds #define _XOPEN_SOURCE 600 #include <stdint.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <time.h> +#include <unistd.h> int main(int argc, char *argv[]) diff --git a/man3/dl_iterate_phdr.3 b/man3/dl_iterate_phdr.3 index ac4297fb4..031b861e7 100644 --- a/man3/dl_iterate_phdr.3 +++ b/man3/dl_iterate_phdr.3 @@ -288,9 +288,9 @@ Name: "/lib64/ld\-linux\-x86\-64.so.2" (7 segments) .EX #define _GNU_SOURCE #include <link.h> -#include <stdlib.h> -#include <stdio.h> #include <stdint.h> +#include <stdio.h> +#include <stdlib.h> static int callback(struct dl_phdr_info *info, size_t size, void *data) diff --git a/man3/dlopen.3 b/man3/dlopen.3 index 7e075a562..812283b74 100644 --- a/man3/dlopen.3 +++ b/man3/dlopen.3 @@ -553,9 +553,10 @@ $ \fB./a.out\fP \& .\" SRC BEGIN (dlopen.c) .EX +#include <dlfcn.h> #include <stdio.h> #include <stdlib.h> -#include <dlfcn.h> + #include <gnu/lib\-names.h> /* Defines LIBM_SO (which will be a string such as "libm.so.6") */ int diff --git a/man3/duplocale.3 b/man3/duplocale.3 index 8712734ed..a0490beda 100644 --- a/man3/duplocale.3 +++ b/man3/duplocale.3 @@ -121,9 +121,9 @@ ABC .EX #define _XOPEN_SOURCE 700 #include <ctype.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> -#include <locale.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e } while (0) diff --git a/man3/encrypt.3 b/man3/encrypt.3 index 9f42c7444..79ea079b7 100644 --- a/man3/encrypt.3 +++ b/man3/encrypt.3 @@ -156,10 +156,10 @@ In glibc 2.2, these functions use the DES algorithm. .\" SRC BEGIN (encrypt.c) .EX #define _XOPEN_SOURCE +#include <crypt.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <crypt.h> int main(void) diff --git a/man3/envz_add.3 b/man3/envz_add.3 index c5a7ee309..5c0f98776 100644 --- a/man3/envz_add.3 +++ b/man3/envz_add.3 @@ -145,9 +145,9 @@ These functions are a GNU extension. .SH EXAMPLES .\" SRC BEGIN (envz_add.c) .EX +#include <envz.h> #include <stdio.h> #include <stdlib.h> -#include <envz.h> int main(int argc, char *argv[], char *envp[]) diff --git a/man3/fmemopen.3 b/man3/fmemopen.3 index d7f5a383d..4a3a16cf3 100644 --- a/man3/fmemopen.3 +++ b/man3/fmemopen.3 @@ -303,9 +303,9 @@ size=11; ptr=1 529 1849 .\" SRC BEGIN (fmemopen.c) .EX #define _GNU_SOURCE -#include <string.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #define handle_error(msg) \e do { perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/fmtmsg.3 b/man3/fmtmsg.3 index 8b734ca65..98fc8a152 100644 --- a/man3/fmtmsg.3 +++ b/man3/fmtmsg.3 @@ -274,9 +274,9 @@ vpfmt(), lfmt(), and vlfmt()", and will be removed later. .SH EXAMPLES .\" SRC BEGIN (fmtmsg.c) .EX +#include <fmtmsg.h> #include <stdio.h> #include <stdlib.h> -#include <fmtmsg.h> int main(void) diff --git a/man3/fopencookie.3 b/man3/fopencookie.3 index 68813b136..d68ddacec 100644 --- a/man3/fopencookie.3 +++ b/man3/fopencookie.3 @@ -289,11 +289,11 @@ closing a stream that has already been closed). .\" SRC BEGIN (fopencookie.c) .EX #define _GNU_SOURCE -#include <sys/types.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> +#include <sys/types.h> +#include <unistd.h> #define INIT_BUF_SIZE 4 diff --git a/man3/frexp.3 b/man3/frexp.3 index 0c99b2f71..ad375e472 100644 --- a/man3/frexp.3 +++ b/man3/frexp.3 @@ -117,8 +117,8 @@ frexp(\-4, &e) = \-0.5: \-0.5 * 2\(ha3 = \-4 \& .\" SRC BEGIN (frexp.c) .EX -#include <math.h> #include <float.h> +#include <math.h> #include <stdio.h> #include <stdlib.h> diff --git a/man3/ftw.3 b/man3/ftw.3 index e1fd7e39a..111c08cc7 100644 --- a/man3/ftw.3 +++ b/man3/ftw.3 @@ -448,10 +448,10 @@ argument when calling .EX #define _XOPEN_SOURCE 500 #include <ftw.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdint.h> static int display_info(const char *fpath, const struct stat *sb, diff --git a/man3/get_nprocs_conf.3 b/man3/get_nprocs_conf.3 index e41ea5c17..03e2d04e2 100644 --- a/man3/get_nprocs_conf.3 +++ b/man3/get_nprocs_conf.3 @@ -77,8 +77,8 @@ can be used. .PP .\" SRC BEGIN (get_nprocs_conf.c) .EX -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <sys/sysinfo.h> int diff --git a/man3/getaddrinfo.3 b/man3/getaddrinfo.3 index 61a67d542..d4d7afa79 100644 --- a/man3/getaddrinfo.3 +++ b/man3/getaddrinfo.3 @@ -644,13 +644,13 @@ The programs are an echo server and client for UDP datagrams. \& .\" SRC BEGIN (server.c) .EX -#include <sys/types.h> +#include <netdb.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> #include <sys/socket.h> -#include <netdb.h> +#include <sys/types.h> +#include <unistd.h> #define BUF_SIZE 500 @@ -742,13 +742,13 @@ main(int argc, char *argv[]) \& .\" SRC BEGIN (client.c) .EX -#include <sys/types.h> -#include <sys/socket.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <unistd.h> #define BUF_SIZE 500 diff --git a/man3/getdate.3 b/man3/getdate.3 index a5fbb4e30..cc65ea3a2 100644 --- a/man3/getdate.3 +++ b/man3/getdate.3 @@ -272,9 +272,9 @@ Call 3 ("12:22:33") succeeded: .\" SRC BEGIN (getdate.c) .EX #define _GNU_SOURCE -#include <time.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> int main(int argc, char *argv[]) diff --git a/man3/getgrent_r.3 b/man3/getgrent_r.3 index 085bd2a59..0f734d595 100644 --- a/man3/getgrent_r.3 +++ b/man3/getgrent_r.3 @@ -171,8 +171,8 @@ in the stream with all other threads. .EX #define _GNU_SOURCE #include <grp.h> -#include <stdio.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> #define BUFLEN 4096 diff --git a/man3/getgrouplist.3 b/man3/getgrouplist.3 index 9bfe4869b..efba0eab4 100644 --- a/man3/getgrouplist.3 +++ b/man3/getgrouplist.3 @@ -136,10 +136,10 @@ ngroups = 3 \& .\" SRC BEGIN (getgrouplist.c) .EX -#include <stdio.h> -#include <stdlib.h> #include <grp.h> #include <pwd.h> +#include <stdio.h> +#include <stdlib.h> int main(int argc, char *argv[]) diff --git a/man3/getopt.3 b/man3/getopt.3 index 4e28b7e40..a5fb5a312 100644 --- a/man3/getopt.3 +++ b/man3/getopt.3 @@ -429,9 +429,9 @@ which expects an associated value. .PP .\" SRC BEGIN (getopt.c) .EX -#include <unistd.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> int main(int argc, char *argv[]) @@ -481,9 +481,9 @@ with most of its features. .PP .\" SRC BEGIN (getopt_long.c) .EX +#include <getopt.h> #include <stdio.h> /* for printf */ #include <stdlib.h> /* for exit */ -#include <getopt.h> int main(int argc, char *argv[]) diff --git a/man3/getprotoent_r.3 b/man3/getprotoent_r.3 index d99de8920..7c69124b4 100644 --- a/man3/getprotoent_r.3 +++ b/man3/getprotoent_r.3 @@ -169,10 +169,10 @@ Call failed/record not found .EX #define _GNU_SOURCE #include <ctype.h> +#include <errno.h> #include <netdb.h> -#include <stdlib.h> #include <stdio.h> -#include <errno.h> +#include <stdlib.h> #include <string.h> #define MAX_BUF 10000 diff --git a/man3/getpwent_r.3 b/man3/getpwent_r.3 index ea7cb3cdc..e0489b945 100644 --- a/man3/getpwent_r.3 +++ b/man3/getpwent_r.3 @@ -175,8 +175,9 @@ in the stream with all other threads. .EX #define _GNU_SOURCE #include <pwd.h> -#include <stdio.h> #include <stdint.h> +#include <stdio.h> + #define BUFLEN 4096 int diff --git a/man3/getpwnam.3 b/man3/getpwnam.3 index 168854b70..3aed16285 100644 --- a/man3/getpwnam.3 +++ b/man3/getpwnam.3 @@ -279,12 +279,12 @@ supplied as a command-line argument. .PP .\" SRC BEGIN (getpwnam.c) .EX +#include <errno.h> #include <pwd.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <errno.h> int main(int argc, char *argv[]) diff --git a/man3/getservent_r.3 b/man3/getservent_r.3 index d572a066a..078ea7854 100644 --- a/man3/getservent_r.3 +++ b/man3/getservent_r.3 @@ -169,10 +169,10 @@ Call failed/record not found .EX #define _GNU_SOURCE #include <ctype.h> +#include <errno.h> #include <netdb.h> -#include <stdlib.h> #include <stdio.h> -#include <errno.h> +#include <stdlib.h> #include <string.h> #define MAX_BUF 10000 diff --git a/man3/getsubopt.3 b/man3/getsubopt.3 index 686b5e252..2b6197e3e 100644 --- a/man3/getsubopt.3 +++ b/man3/getsubopt.3 @@ -159,9 +159,10 @@ The following program expects suboptions following a "\-o" option. .\" SRC BEGIN (getsubopt.c) .EX #define _XOPEN_SOURCE 500 +#include <stdio.h> #include <stdlib.h> + #include <assert.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/getutent.3 b/man3/getutent.3 index 0c0540ee5..1aeb09bb4 100644 --- a/man3/getutent.3 +++ b/man3/getutent.3 @@ -295,12 +295,12 @@ and .PP .\" SRC BEGIN (getutent.c) .EX -#include <string.h> -#include <stdlib.h> #include <pwd.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> #include <unistd.h> #include <utmp.h> -#include <time.h> int main(int argc, char *argv[]) diff --git a/man3/gnu_get_libc_version.3 b/man3/gnu_get_libc_version.3 index 221f9bc96..83e4c07ec 100644 --- a/man3/gnu_get_libc_version.3 +++ b/man3/gnu_get_libc_version.3 @@ -63,9 +63,10 @@ GNU libc release: stable \& .\" SRC BEGIN (gnu_get_libc_version.c) .EX -#include <gnu/libc\-version.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> + +#include <gnu/libc\-version.h> int main(int argc, char *argv[]) diff --git a/man3/hsearch.3 b/man3/hsearch.3 index 0b58fab19..1b35a61c1 100644 --- a/man3/hsearch.3 +++ b/man3/hsearch.3 @@ -287,9 +287,9 @@ some of them. .PP .\" SRC BEGIN (hsearch.c) .EX +#include <search.h> #include <stdio.h> #include <stdlib.h> -#include <search.h> static char *data[] = { "alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", diff --git a/man3/insque.3 b/man3/insque.3 index 15b6f9544..6683cb3f5 100644 --- a/man3/insque.3 +++ b/man3/insque.3 @@ -151,10 +151,10 @@ That was a circular list \& .\" SRC BEGIN (insque.c) .EX +#include <search.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <search.h> struct element { struct element *forward; diff --git a/man3/makecontext.3 b/man3/makecontext.3 index d8cf9284e..a65e5d399 100644 --- a/man3/makecontext.3 +++ b/man3/makecontext.3 @@ -170,9 +170,9 @@ main: exiting \& .\" SRC BEGIN (makecontext.c) .EX -#include <ucontext.h> #include <stdio.h> #include <stdlib.h> +#include <ucontext.h> static ucontext_t uctx_main, uctx_func1, uctx_func2; diff --git a/man3/malloc_info.3 b/man3/malloc_info.3 index 0755674be..7c792de0e 100644 --- a/man3/malloc_info.3 +++ b/man3/malloc_info.3 @@ -167,11 +167,11 @@ glibc 2.13 .SS Program source .\" SRC BEGIN (malloc_info.c) .EX -#include <unistd.h> -#include <stdlib.h> -#include <pthread.h> -#include <malloc.h> #include <errno.h> +#include <malloc.h> +#include <pthread.h> +#include <stdlib.h> +#include <unistd.h> static size_t blockSize; static int numThreads, numBlocks; diff --git a/man3/mbstowcs.3 b/man3/mbstowcs.3 index 9e22a882e..4de7eda3f 100644 --- a/man3/mbstowcs.3 +++ b/man3/mbstowcs.3 @@ -147,12 +147,12 @@ Wide character string is: Grüße! (6 characters) \& .\" SRC BEGIN (mbstowcs.c) .EX -#include <wctype.h> #include <locale.h> -#include <wchar.h> #include <stdio.h> -#include <string.h> #include <stdlib.h> +#include <string.h> +#include <wchar.h> +#include <wctype.h> int main(int argc, char *argv[]) diff --git a/man3/mcheck.3 b/man3/mcheck.3 index 2d485f2d0..88c4da3e8 100644 --- a/man3/mcheck.3 +++ b/man3/mcheck.3 @@ -181,9 +181,9 @@ Aborted (core dumped) \& .\" SRC BEGIN (mcheck.c) .EX -#include <stdlib.h> -#include <stdio.h> #include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> int main(int argc, char *argv[]) diff --git a/man3/mq_getattr.3 b/man3/mq_getattr.3 index c1eb9d177..533abc6b7 100644 --- a/man3/mq_getattr.3 +++ b/man3/mq_getattr.3 @@ -181,11 +181,11 @@ $ \fBcat /proc/sys/fs/mqueue/msgsize_default\fP \& .\" SRC BEGIN (mq_getattr.c) .EX -#include <mqueue.h> -#include <sys/stat.h> #include <fcntl.h> +#include <mqueue.h> #include <stdio.h> #include <stdlib.h> +#include <sys/stat.h> #include <unistd.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e diff --git a/man3/mq_notify.3 b/man3/mq_notify.3 index d4ec9f5ed..e72189c4a 100644 --- a/man3/mq_notify.3 +++ b/man3/mq_notify.3 @@ -202,12 +202,12 @@ queue and then terminates the process. .SS Program source .\" SRC BEGIN (mq_notify.c) .EX -#include <pthread.h> #include <mqueue.h> +#include <pthread.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <signal.h> #define handle_error(msg) \e do { perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/mtrace.3 b/man3/mtrace.3 index a09e8b5e7..19bcacdd8 100644 --- a/man3/mtrace.3 +++ b/man3/mtrace.3 @@ -129,8 +129,8 @@ The demonstration uses the following program: .\" SRC BEGIN (t_mtrace.c) .EX #include <mcheck.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char *argv[]) diff --git a/man3/newlocale.3 b/man3/newlocale.3 index a300fc622..1307c0554 100644 --- a/man3/newlocale.3 +++ b/man3/newlocale.3 @@ -279,9 +279,9 @@ Te Paraire, te 07 o Poutū\-te\-rangi, 2014 00:38:44 CET .\" SRC BEGIN (newlocale.c) .EX #define _XOPEN_SOURCE 700 +#include <locale.h> #include <stdio.h> #include <stdlib.h> -#include <locale.h> #include <time.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e diff --git a/man3/posix_spawn.3 b/man3/posix_spawn.3 index b60de1faa..bb9c6c8e4 100644 --- a/man3/posix_spawn.3 +++ b/man3/posix_spawn.3 @@ -665,14 +665,14 @@ Child status: exited, status=127 \& .\" SRC BEGIN (posix_spawn.c) .EX +#include <errno.h> #include <spawn.h> #include <stdint.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <wait.h> -#include <errno.h> #define errExit(msg) do { perror(msg); \e exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_attr_init.3 b/man3/pthread_attr_init.3 index ddbd3706e..aa3922682 100644 --- a/man3/pthread_attr_init.3 +++ b/man3/pthread_attr_init.3 @@ -149,11 +149,11 @@ Thread attributes: .\" SRC BEGIN (pthread_attr_init.c) .EX #define _GNU_SOURCE /* To get pthread_getattr_np() declaration */ +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_cancel.3 b/man3/pthread_cancel.3 index e05bb5f70..5e6ddc4a9 100644 --- a/man3/pthread_cancel.3 +++ b/man3/pthread_cancel.3 @@ -150,9 +150,9 @@ main(): thread was canceled \& .\" SRC BEGIN (pthread_cancel.c) .EX +#include <errno.h> #include <pthread.h> #include <stdio.h> -#include <errno.h> #include <stdlib.h> #include <unistd.h> diff --git a/man3/pthread_cleanup_push.3 b/man3/pthread_cleanup_push.3 index 0eb38a77d..1cb1e52fe 100644 --- a/man3/pthread_cleanup_push.3 +++ b/man3/pthread_cleanup_push.3 @@ -230,12 +230,12 @@ was nonzero. \& .\" SRC BEGIN (pthread_cleanup_push.c) .EX +#include <errno.h> #include <pthread.h> -#include <sys/types.h> #include <stdio.h> #include <stdlib.h> +#include <sys/types.h> #include <unistd.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_create.3 b/man3/pthread_create.3 index f222e5f35..7c95b3ab7 100644 --- a/man3/pthread_create.3 +++ b/man3/pthread_create.3 @@ -266,13 +266,13 @@ Joined with thread 3; returned value was SERVUS \& .\" SRC BEGIN (pthread_create.c) .EX +#include <ctype.h> +#include <errno.h> #include <pthread.h> -#include <string.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> -#include <errno.h> -#include <ctype.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_getattr_default_np.3 b/man3/pthread_getattr_default_np.3 index ebea8873e..8b752aecb 100644 --- a/man3/pthread_getattr_default_np.3 +++ b/man3/pthread_getattr_default_np.3 @@ -103,10 +103,10 @@ Inherit scheduler: INHERIT .\" SRC BEGIN (pthread_getattr_default_np.c) .EX #define _GNU_SOURCE +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> #define errExitEN(en, msg) \e do { errno = en; perror(msg); \e diff --git a/man3/pthread_getattr_np.3 b/man3/pthread_getattr_np.3 index 011e52cda..468bcd381 100644 --- a/man3/pthread_getattr_np.3 +++ b/man3/pthread_getattr_np.3 @@ -179,11 +179,11 @@ Attributes of created thread: .\" SRC BEGIN (pthread_getattr_np.c) .EX #define _GNU_SOURCE /* To get pthread_getattr_np() declaration */ +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_getcpuclockid.3 b/man3/pthread_getcpuclockid.3 index fa5369472..76cbe0563 100644 --- a/man3/pthread_getcpuclockid.3 +++ b/man3/pthread_getcpuclockid.3 @@ -100,14 +100,14 @@ Subthread CPU time: 0.992 .EX /* Link with "\-lrt" */ -#include <time.h> -#include <stdio.h> +#include <errno.h> +#include <pthread.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> -#include <unistd.h> -#include <pthread.h> #include <string.h> -#include <errno.h> +#include <time.h> +#include <unistd.h> #define handle_error(msg) \e do { perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_mutexattr_setrobust.3 b/man3/pthread_mutexattr_setrobust.3 index 3bd646cbd..eedfe1801 100644 --- a/man3/pthread_mutexattr_setrobust.3 +++ b/man3/pthread_mutexattr_setrobust.3 @@ -192,11 +192,11 @@ $ \fB./a.out\fP .SS Program source .\" SRC BEGIN (pthread_mutexattr_setrobust.c) .EX -#include <stdlib.h> +#include <errno.h> +#include <pthread.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> -#include <pthread.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_setaffinity_np.3 b/man3/pthread_setaffinity_np.3 index 39e1490cd..3d252c075 100644 --- a/man3/pthread_setaffinity_np.3 +++ b/man3/pthread_setaffinity_np.3 @@ -158,10 +158,10 @@ to check the resulting CPU affinity mask of the thread. .\" SRC BEGIN (pthread_setaffinity_np.c) .EX #define _GNU_SOURCE +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_setname_np.3 b/man3/pthread_setname_np.3 index 19ba0f80b..4fa0acdf4 100644 --- a/man3/pthread_setname_np.3 +++ b/man3/pthread_setname_np.3 @@ -141,12 +141,12 @@ THREADFOO .\" SRC BEGIN (pthread_setname_np.c) .EX #define _GNU_SOURCE +#include <errno.h> #include <pthread.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> -#include <errno.h> -#include <stdlib.h> #define NAMELEN 16 diff --git a/man3/pthread_setschedparam.3 b/man3/pthread_setschedparam.3 index e6ee8362e..c16842045 100644 --- a/man3/pthread_setschedparam.3 +++ b/man3/pthread_setschedparam.3 @@ -226,11 +226,11 @@ is the default for the inherit scheduler attribute. .EX /* pthreads_sched_test.c */ +#include <errno.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <errno.h> #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) diff --git a/man3/pthread_sigmask.3 b/man3/pthread_sigmask.3 index 1a1c63f99..45d7f4cc7 100644 --- a/man3/pthread_sigmask.3 +++ b/man3/pthread_sigmask.3 @@ -96,12 +96,12 @@ Signal handling thread got signal 10 \& .\" SRC BEGIN (pthread_sigmask.c) .EX +#include <errno.h> #include <pthread.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <signal.h> -#include <errno.h> /* Simple error handling functions */ diff --git a/man3/rand.3 b/man3/rand.3 index d313e91b2..c235170ae 100644 --- a/man3/rand.3 +++ b/man3/rand.3 @@ -193,8 +193,8 @@ when given a particular seed. .in +4n .\" SRC BEGIN (rand.c) .EX -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char *argv[]) diff --git a/man3/rpmatch.3 b/man3/rpmatch.3 index d53fa8e0f..4cd444ed5 100644 --- a/man3/rpmatch.3 +++ b/man3/rpmatch.3 @@ -145,9 +145,9 @@ is applied to the string given in the program's command-line argument. .EX #define _SVID_SOURCE #include <locale.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/rtime.3 b/man3/rtime.3 index f8616a1d3..0a283a8b1 100644 --- a/man3/rtime.3 +++ b/man3/rtime.3 @@ -108,13 +108,14 @@ The result is the localtime of the computer "linux". .PP .\" SRC BEGIN (rtime.c) .EX +#include <errno.h> +#include <netdb.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> #include <string.h> #include <time.h> + #include <rpc/auth_des.h> -#include <netdb.h> static int use_tcp = 0; static const char servername[] = "linux"; diff --git a/man3/sem_wait.3 b/man3/sem_wait.3 index 4ab9e7bb0..82b8444db 100644 --- a/man3/sem_wait.3 +++ b/man3/sem_wait.3 @@ -165,14 +165,15 @@ sem_timedwait() timed out \& .\" SRC BEGIN (sem_wait.c) .EX -#include <unistd.h> +#include <errno.h> +#include <semaphore.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> -#include <semaphore.h> #include <time.h> +#include <unistd.h> + #include <assert.h> -#include <errno.h> -#include <signal.h> sem_t sem; diff --git a/man3/setaliasent.3 b/man3/setaliasent.3 index 978ac53ff..6b94fda88 100644 --- a/man3/setaliasent.3 +++ b/man3/setaliasent.3 @@ -145,9 +145,9 @@ It will dump all names in the alias database. .\" SRC BEGIN (setaliasent.c) .EX #include <aliases.h> +#include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> int main(void) diff --git a/man3/shm_open.3 b/man3/shm_open.3 index 6aa3dff2c..ea429ddd4 100644 --- a/man3/shm_open.3 +++ b/man3/shm_open.3 @@ -291,12 +291,12 @@ on the memory object that is shared between the two programs. .in +4n .\" SRC BEGIN (pshm_ucase.h) .EX -#include <sys/mman.h> #include <fcntl.h> #include <semaphore.h> -#include <sys/stat.h> #include <stdio.h> #include <stdlib.h> +#include <sys/mman.h> +#include <sys/stat.h> #include <unistd.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e @@ -339,6 +339,7 @@ to tell the "send" program that it may now access the shared memory. Licensed under GNU General Public License v2 or later. */ #include <ctype.h> + #include "pshm_ucase.h" int @@ -431,6 +432,7 @@ on standard output. Licensed under GNU General Public License v2 or later. */ #include <string.h> + #include "pshm_ucase.h" int diff --git a/man3/stpcpy.3 b/man3/stpcpy.3 index 487ee6d09..86cd71b2e 100644 --- a/man3/stpcpy.3 +++ b/man3/stpcpy.3 @@ -88,8 +88,8 @@ which it then prints. .\" SRC BEGIN (stpcpy.c) .EX #define _GNU_SOURCE -#include <string.h> #include <stdio.h> +#include <string.h> int main(void) diff --git a/man3/strcat.3 b/man3/strcat.3 index 6c719dc00..befd989bb 100644 --- a/man3/strcat.3 +++ b/man3/strcat.3 @@ -194,9 +194,9 @@ will provide better performance.) .\" SRC BEGIN (strcat.c) .EX #include <stdint.h> +#include <stdio.h> #include <string.h> #include <time.h> -#include <stdio.h> int main(int argc, char *argv[]) diff --git a/man3/strftime.3 b/man3/strftime.3 index ce4dcc168..3015788a2 100644 --- a/man3/strftime.3 +++ b/man3/strftime.3 @@ -735,9 +735,9 @@ Result string is " 11" \& .\" SRC BEGIN (strftime.c) .EX -#include <time.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> int main(int argc, char *argv[]) diff --git a/man3/strtol.3 b/man3/strtol.3 index 75973618c..379f5d04d 100644 --- a/man3/strtol.3 +++ b/man3/strtol.3 @@ -238,10 +238,10 @@ strtol: Numerical result out of range \& .\" SRC BEGIN (strtol.c) .EX -#include <stdlib.h> +#include <errno.h> #include <limits.h> #include <stdio.h> -#include <errno.h> +#include <stdlib.h> int main(int argc, char *argv[]) diff --git a/man3/strverscmp.3 b/man3/strverscmp.3 index a78c82180..b56028af6 100644 --- a/man3/strverscmp.3 +++ b/man3/strverscmp.3 @@ -118,9 +118,9 @@ jan1 < jan10 .\" SRC BEGIN (strverscmp.c) .EX #define _GNU_SOURCE -#include <string.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> int main(int argc, char *argv[]) diff --git a/man3/tsearch.3 b/man3/tsearch.3 index 0b9e3a185..05380ed4b 100644 --- a/man3/tsearch.3 +++ b/man3/tsearch.3 @@ -256,8 +256,8 @@ in order. #define _GNU_SOURCE /* Expose declaration of tdestroy() */ #include <search.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <time.h> static void *root = NULL; |