diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-05-14 15:28:58 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-09-05 04:18:19 +0200 |
commit | a297be93b8d24579d5f44c26befa2768de558bde (patch) | |
tree | 309887428fd9ce2313bda12a4cb94eb48f1cf3d6 | |
parent | 24d680aa9616d356a29cfbc0c8c010c271311e50 (diff) |
getaddrinfo.3: EXAMPLES: Fix includesexamples
- Remove unnecessary includes
- Sort alphabetically
All this has been done using iwyu(1):
......
$ iwyu getaddrinfo_server.c 2>&1 \
| sed -e '\,^#,s, //,/*,' -e '\,^#,s,$, */,' \
| sed '/^#/s/\w*\.\.\./.../';
getaddrinfo_server.c should add these lines:
getaddrinfo_server.c should remove these lines:
- #include <sys/types.h> // lines 1-1
The full include-list for getaddrinfo_server.c:
#include <netdb.h> /* for addrinfo, gai_strerror, freeaddrinfo, ... */
#include <stdio.h> /* for fprintf, NULL, stderr, printf */
#include <stdlib.h> /* for exit, EXIT_FAILURE */
#include <string.h> /* for memset */
#include <sys/socket.h> /* for bind, recvfrom, sendto, socket, ... */
#include <unistd.h> /* for close, ssize_t */
$ iwyu getaddrinfo_client.c 2>&1 \
| sed -e '\,^#,s,//,/*,' -e '\,^#,s,$, */,' \
| sed '/^#/s/\w*\.\.\./.../';
getaddrinfo_client.c should add these lines:
getaddrinfo_client.c should remove these lines:
- #include <sys/types.h> // lines 1-1
The full include-list for getaddrinfo_client.c:
#include <netdb.h> /* for addrinfo, freeaddrinfo, gai_strerror, ... */
#include <stdio.h> /* for fprintf, stderr, perror, printf, NULL, size_t */
#include <stdlib.h> /* for exit, EXIT_FAILURE, EXIT_SUCCESS */
#include <string.h> /* for memset, strlen */
#include <sys/socket.h> /* for connect, socket, AF_UNSPEC, SOCK_DGRAM */
#include <unistd.h> /* for close, read, write, ssize_t */
$
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r-- | man3/getaddrinfo.3 | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/man3/getaddrinfo.3 b/man3/getaddrinfo.3 index 8a97b7008..36a62d3ac 100644 --- a/man3/getaddrinfo.3 +++ b/man3/getaddrinfo.3 @@ -643,13 +643,12 @@ The programs are an echo server and client for UDP datagrams. .SS Server program \& .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 <unistd.h> #define BUF_SIZE 500 @@ -738,13 +737,12 @@ main(int argc, char *argv[]) .SS Client program \& .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 <unistd.h> #define BUF_SIZE 500 |