aboutsummaryrefslogtreecommitdiffstats
path: root/man3
diff options
context:
space:
mode:
Diffstat (limited to 'man3')
-rw-r--r--man3/CPU_SET.33
-rw-r--r--man3/bswap.36
-rw-r--r--man3/cacos.32
-rw-r--r--man3/cacosh.32
-rw-r--r--man3/catan.32
-rw-r--r--man3/catanh.32
-rw-r--r--man3/clock_getcpuclockid.32
-rw-r--r--man3/dl_iterate_phdr.34
-rw-r--r--man3/dlopen.33
-rw-r--r--man3/duplocale.32
-rw-r--r--man3/encrypt.32
-rw-r--r--man3/envz_add.32
-rw-r--r--man3/fmemopen.32
-rw-r--r--man3/fmtmsg.32
-rw-r--r--man3/fopencookie.34
-rw-r--r--man3/frexp.32
-rw-r--r--man3/ftw.32
-rw-r--r--man3/get_nprocs_conf.32
-rw-r--r--man3/getaddrinfo.312
-rw-r--r--man3/getdate.32
-rw-r--r--man3/getgrent_r.32
-rw-r--r--man3/getgrouplist.34
-rw-r--r--man3/getopt.36
-rw-r--r--man3/getprotoent_r.34
-rw-r--r--man3/getpwent_r.33
-rw-r--r--man3/getpwnam.32
-rw-r--r--man3/getservent_r.34
-rw-r--r--man3/getsubopt.33
-rw-r--r--man3/getutent.36
-rw-r--r--man3/gnu_get_libc_version.35
-rw-r--r--man3/hsearch.32
-rw-r--r--man3/insque.32
-rw-r--r--man3/makecontext.32
-rw-r--r--man3/malloc_info.38
-rw-r--r--man3/mbstowcs.36
-rw-r--r--man3/mcheck.34
-rw-r--r--man3/mq_getattr.34
-rw-r--r--man3/mq_notify.34
-rw-r--r--man3/mtrace.32
-rw-r--r--man3/newlocale.32
-rw-r--r--man3/posix_spawn.34
-rw-r--r--man3/pthread_attr_init.32
-rw-r--r--man3/pthread_cancel.32
-rw-r--r--man3/pthread_cleanup_push.34
-rw-r--r--man3/pthread_create.36
-rw-r--r--man3/pthread_getattr_default_np.32
-rw-r--r--man3/pthread_getattr_np.32
-rw-r--r--man3/pthread_getcpuclockid.310
-rw-r--r--man3/pthread_mutexattr_setrobust.36
-rw-r--r--man3/pthread_setaffinity_np.32
-rw-r--r--man3/pthread_setname_np.34
-rw-r--r--man3/pthread_setschedparam.32
-rw-r--r--man3/pthread_sigmask.34
-rw-r--r--man3/rand.32
-rw-r--r--man3/rpmatch.32
-rw-r--r--man3/rtime.35
-rw-r--r--man3/sem_wait.39
-rw-r--r--man3/setaliasent.32
-rw-r--r--man3/shm_open.36
-rw-r--r--man3/stpcpy.32
-rw-r--r--man3/strcat.32
-rw-r--r--man3/strftime.32
-rw-r--r--man3/strtol.34
-rw-r--r--man3/strverscmp.32
-rw-r--r--man3/tsearch.32
65 files changed, 117 insertions, 108 deletions
diff --git a/man3/CPU_SET.3 b/man3/CPU_SET.3
index 4d0b269b36..968da2b39f 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 833cd9ee33..8b6ea17e9e 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 56f8912a30..d82b39d864 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 d21e47364a..d6bb52d717 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 7ff383e5b6..380c69f987 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 621ba11a1c..3bc3a8d6c4 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 4b6d5b559a..8fe8bf2410 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 ac4297fb4d..031b861e76 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 7e075a562e..812283b744 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 8712734ed5..a0490beda4 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 9f42c74444..79ea079b79 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 c5a7ee309b..5c0f98776c 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 d7f5a383d4..4a3a16cf39 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 8b734ca655..98fc8a1527 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 68813b136d..d68ddacec4 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 0c99b2f716..ad375e4723 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 e1fd7e39a5..111c08cc79 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 e41ea5c170..03e2d04e25 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 61a67d5429..d4d7afa795 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 a5fbb4e309..cc65ea3a2b 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 085bd2a596..0f734d5952 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 9bfe4869b3..efba0eab42 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 4e28b7e40d..a5fb5a312f 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 d99de89208..7c69124b4e 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 ea7cb3cdc7..e0489b945f 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 168854b70f..3aed162855 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 d572a066a2..078ea7854f 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 686b5e2527..2b6197e3e1 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 0c0540ee5a..1aeb09bb42 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 221f9bc96a..83e4c07ecd 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 0b58fab196..1b35a61c1f 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 15b6f95449..6683cb3f5c 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 d8cf9284ed..a65e5d399e 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 0755674be8..7c792de0e1 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 9e22a882e5..4de7eda3ff 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 2d485f2d0d..88c4da3e8a 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 c1eb9d177d..533abc6b76 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 d4ec9f5ed5..e72189c4a9 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 a09e8b5e7a..19bcacdd80 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 a300fc622a..1307c05544 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 b60de1faa1..bb9c6c8e4a 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 ddbd3706e3..aa3922682c 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 e05bb5f70e..5e6ddc4a97 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 0eb38a77d8..1cb1e52fef 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 f222e5f35c..7c95b3ab7e 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 ebea8873e2..8b752aecb0 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 011e52cdaa..468bcd3814 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 fa5369472f..76cbe05631 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 3bd646cbd5..eedfe1801f 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 39e1490cde..3d252c0753 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 19ba0f80b1..4fa0acdf4a 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 e6ee8362ef..c168420456 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 1a1c63f992..45d7f4cc70 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 d313e91b2b..c235170aee 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 d53fa8e0f0..4cd444ed52 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 f8616a1d36..0a283a8b19 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 4ab9e7bb06..82b8444dbe 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 978ac53ff0..6b94fda889 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 6aa3dff2cf..ea429ddd44 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 487ee6d090..86cd71b2e3 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 6c719dc001..befd989bb0 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 ce4dcc1685..3015788a2c 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 75973618cb..379f5d04d9 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 a78c821802..b56028af66 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 0b9e3a185b..05380ed4b3 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;