summaryrefslogtreecommitdiffstats
path: root/templates/man7/unix.7.pot
diff options
context:
space:
mode:
Diffstat (limited to 'templates/man7/unix.7.pot')
-rw-r--r--templates/man7/unix.7.pot644
1 files changed, 599 insertions, 45 deletions
diff --git a/templates/man7/unix.7.pot b/templates/man7/unix.7.pot
index 94acfca1..38b8f286 100644
--- a/templates/man7/unix.7.pot
+++ b/templates/man7/unix.7.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2024-03-01 17:12+0100\n"
+"POT-Creation-Date: 2024-06-01 06:33+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -24,15 +24,15 @@ msgid "UNIX"
msgstr ""
#. type: TH
-#: archlinux fedora-40 fedora-rawhide mageia-cauldron
+#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
-msgid "2023-12-21"
+msgid "2024-05-02"
msgstr ""
#. type: TH
-#: archlinux fedora-40 fedora-rawhide mageia-cauldron
+#: archlinux debian-unstable
#, no-wrap
-msgid "Linux man-pages 6.06"
+msgid "Linux man-pages 6.8"
msgstr ""
#. type: SH
@@ -146,10 +146,9 @@ msgid ""
msgstr ""
#. type: Plain text
-#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
-#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
+#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
msgid ""
-"Various systems calls (for example, B<bind>(2), B<connect>(2), and "
+"Various system calls (for example, B<bind>(2), B<connect>(2), and "
"B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other system "
"calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), "
"and B<accept>(2)) return an argument of this type."
@@ -515,7 +514,8 @@ msgid "B<SO_PEERCRED>"
msgstr ""
#. type: Plain text
-#: archlinux fedora-40 fedora-rawhide mageia-cauldron
+#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
+#: opensuse-tumbleweed
msgid ""
"This read-only socket option returns the credentials of the peer process "
"connected to this socket. The returned credentials are those that were in "
@@ -1411,11 +1411,10 @@ msgstr ""
#. The behavior on Solaris is quite similar.
#. type: Plain text
-#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
-#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
+#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
msgid ""
"When binding a socket to an address, Linux is one of the implementations "
-"that appends a null terminator if none is supplied in I<sun_path>. In most "
+"that append a null terminator if none is supplied in I<sun_path>. In most "
"cases this is unproblematic: when the socket address is retrieved, it will "
"be one byte longer than that supplied when the socket was bound. However, "
"there is one case where confusing behavior can result: if 108 non-null bytes "
@@ -1556,17 +1555,25 @@ msgid "Program source"
msgstr ""
#. type: Plain text
-#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
-#: opensuse-tumbleweed
+#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid ""
"/*\n"
" * File connection.h\n"
" */\n"
+"#ifndef CONNECTION_H\n"
+"#define CONNECTION_H\n"
"\\&\n"
"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n"
"#define BUFFER_SIZE 12\n"
"\\&\n"
+"#endif // include guard\n"
+msgstr ""
+
+#. type: Plain text
+#: archlinux debian-unstable opensuse-tumbleweed
+#, no-wrap
+msgid ""
"/*\n"
" * File server.c\n"
" */\n"
@@ -1575,20 +1582,23 @@ msgid ""
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>string.hE<gt>\n"
"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/types.hE<gt>\n"
"#include E<lt>sys/un.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
+"\\&\n"
"#include \"connection.h\"\n"
"\\&\n"
"int\n"
-"main(int argc, char *argv[])\n"
+"main(void)\n"
"{\n"
-" struct sockaddr_un name;\n"
-" int down_flag = 0;\n"
-" int ret;\n"
-" int connection_socket;\n"
-" int data_socket;\n"
-" int result;\n"
-" char buffer[BUFFER_SIZE];\n"
+" int down_flag = 0;\n"
+" int ret;\n"
+" int connection_socket;\n"
+" int data_socket;\n"
+" int result;\n"
+" ssize_t r, w;\n"
+" struct sockaddr_un name;\n"
+" char buffer[BUFFER_SIZE];\n"
"\\&\n"
" /* Create local socket. */\n"
"\\&\n"
@@ -1647,8 +1657,8 @@ msgid ""
"\\&\n"
" /* Wait for next data packet. */\n"
"\\&\n"
-" ret = read(data_socket, buffer, sizeof(buffer));\n"
-" if (ret == -1) {\n"
+" r = read(data_socket, buffer, sizeof(buffer));\n"
+" if (r == -1) {\n"
" perror(\"read\");\n"
" exit(EXIT_FAILURE);\n"
" }\n"
@@ -1661,13 +1671,17 @@ msgid ""
"\\&\n"
" if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n"
" down_flag = 1;\n"
-" break;\n"
+" continue;\n"
" }\n"
"\\&\n"
" if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n"
" break;\n"
" }\n"
"\\&\n"
+" if (down_flag) {\n"
+" continue;\n"
+" }\n"
+"\\&\n"
" /* Add received summand. */\n"
"\\&\n"
" result += atoi(buffer);\n"
@@ -1676,8 +1690,8 @@ msgid ""
" /* Send result. */\n"
"\\&\n"
" sprintf(buffer, \"%d\", result);\n"
-" ret = write(data_socket, buffer, sizeof(buffer));\n"
-" if (ret == -1) {\n"
+" w = write(data_socket, buffer, sizeof(buffer));\n"
+" if (w == -1) {\n"
" perror(\"write\");\n"
" exit(EXIT_FAILURE);\n"
" }\n"
@@ -1701,27 +1715,34 @@ msgid ""
"\\&\n"
" exit(EXIT_SUCCESS);\n"
"}\n"
-"\\&\n"
+msgstr ""
+
+#. type: Plain text
+#: archlinux debian-unstable opensuse-tumbleweed
+#, no-wrap
+msgid ""
"/*\n"
" * File client.c\n"
" */\n"
"\\&\n"
-"#include E<lt>errno.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>string.hE<gt>\n"
"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/types.hE<gt>\n"
"#include E<lt>sys/un.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
+"\\&\n"
"#include \"connection.h\"\n"
"\\&\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
-" struct sockaddr_un addr;\n"
-" int ret;\n"
-" int data_socket;\n"
-" char buffer[BUFFER_SIZE];\n"
+" int ret;\n"
+" int data_socket;\n"
+" ssize_t r, w;\n"
+" struct sockaddr_un addr;\n"
+" char buffer[BUFFER_SIZE];\n"
"\\&\n"
" /* Create local socket. */\n"
"\\&\n"
@@ -1753,9 +1774,9 @@ msgid ""
"\\&\n"
" /* Send arguments. */\n"
"\\&\n"
-" for (size_t i = 1; i E<lt> argc; ++i) {\n"
-" ret = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
-" if (ret == -1) {\n"
+" for (int i = 1; i E<lt> argc; ++i) {\n"
+" w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
+" if (w == -1) {\n"
" perror(\"write\");\n"
" break;\n"
" }\n"
@@ -1764,16 +1785,16 @@ msgid ""
" /* Request result. */\n"
"\\&\n"
" strcpy(buffer, \"END\");\n"
-" ret = write(data_socket, buffer, strlen(buffer) + 1);\n"
-" if (ret == -1) {\n"
+" w = write(data_socket, buffer, strlen(buffer) + 1);\n"
+" if (w == -1) {\n"
" perror(\"write\");\n"
" exit(EXIT_FAILURE);\n"
" }\n"
"\\&\n"
" /* Receive result. */\n"
"\\&\n"
-" ret = read(data_socket, buffer, sizeof(buffer));\n"
-" if (ret == -1) {\n"
+" r = read(data_socket, buffer, sizeof(buffer));\n"
+" if (r == -1) {\n"
" perror(\"read\");\n"
" exit(EXIT_FAILURE);\n"
" }\n"
@@ -1828,13 +1849,39 @@ msgid "Linux man-pages 6.03"
msgstr ""
#. type: Plain text
-#: debian-bookworm debian-unstable opensuse-leap-15-6 opensuse-tumbleweed
+#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6
+msgid ""
+"Various systems calls (for example, B<bind>(2), B<connect>(2), and "
+"B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other system "
+"calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), "
+"and B<accept>(2)) return an argument of this type."
+msgstr ""
+
+#. type: Plain text
+#: debian-bookworm opensuse-leap-15-6
msgid ""
"This read-only socket option returns the credentials of the peer process "
"connected to this socket. The returned credentials are those that were in "
"effect at the time of the call to B<connect>(2) or B<socketpair>(2)."
msgstr ""
+#. The behavior on Solaris is quite similar.
+#. type: Plain text
+#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6
+msgid ""
+"When binding a socket to an address, Linux is one of the implementations "
+"that appends a null terminator if none is supplied in I<sun_path>. In most "
+"cases this is unproblematic: when the socket address is retrieved, it will "
+"be one byte longer than that supplied when the socket was bound. However, "
+"there is one case where confusing behavior can result: if 108 non-null bytes "
+"are supplied when a socket is bound, then the addition of the null "
+"terminator takes the length of the pathname beyond I<sizeof(sun_path)>. "
+"Consequently, when retrieving the socket address (for example, via "
+"B<accept>(2)), if the input I<addrlen> argument for the retrieving call is "
+"specified as I<sizeof(struct sockaddr_un)>, then the returned address "
+"structure I<won't> have a null terminator in I<sun_path>."
+msgstr ""
+
#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
@@ -2344,15 +2391,516 @@ msgid " close(data_socket);\n"
msgstr ""
#. type: TH
-#: debian-unstable opensuse-tumbleweed
+#: fedora-40 mageia-cauldron
#, no-wrap
-msgid "2023-07-15"
+msgid "2023-12-21"
msgstr ""
#. type: TH
-#: debian-unstable opensuse-tumbleweed
+#: fedora-40 mageia-cauldron
#, no-wrap
-msgid "Linux man-pages 6.05.01"
+msgid "Linux man-pages 6.06"
+msgstr ""
+
+#. type: Plain text
+#: fedora-40 mageia-cauldron
+#, no-wrap
+msgid ""
+"/*\n"
+" * File connection.h\n"
+" */\n"
+"\\&\n"
+"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n"
+"#define BUFFER_SIZE 12\n"
+"\\&\n"
+"/*\n"
+" * File server.c\n"
+" */\n"
+"\\&\n"
+"#include E<lt>stdio.hE<gt>\n"
+"#include E<lt>stdlib.hE<gt>\n"
+"#include E<lt>string.hE<gt>\n"
+"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/un.hE<gt>\n"
+"#include E<lt>unistd.hE<gt>\n"
+"#include \"connection.h\"\n"
+"\\&\n"
+"int\n"
+"main(int argc, char *argv[])\n"
+"{\n"
+" struct sockaddr_un name;\n"
+" int down_flag = 0;\n"
+" int ret;\n"
+" int connection_socket;\n"
+" int data_socket;\n"
+" int result;\n"
+" char buffer[BUFFER_SIZE];\n"
+"\\&\n"
+" /* Create local socket. */\n"
+"\\&\n"
+" connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
+" if (connection_socket == -1) {\n"
+" perror(\"socket\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * For portability clear the whole structure, since some\n"
+" * implementations have additional (nonstandard) fields in\n"
+" * the structure.\n"
+" */\n"
+"\\&\n"
+" memset(&name, 0, sizeof(name));\n"
+"\\&\n"
+" /* Bind socket to socket name. */\n"
+"\\&\n"
+" name.sun_family = AF_UNIX;\n"
+" strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n"
+"\\&\n"
+" ret = bind(connection_socket, (const struct sockaddr *) &name,\n"
+" sizeof(name));\n"
+" if (ret == -1) {\n"
+" perror(\"bind\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * Prepare for accepting connections. The backlog size is set\n"
+" * to 20. So while one request is being processed other requests\n"
+" * can be waiting.\n"
+" */\n"
+"\\&\n"
+" ret = listen(connection_socket, 20);\n"
+" if (ret == -1) {\n"
+" perror(\"listen\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* This is the main loop for handling connections. */\n"
+"\\&\n"
+" for (;;) {\n"
+"\\&\n"
+" /* Wait for incoming connection. */\n"
+"\\&\n"
+" data_socket = accept(connection_socket, NULL, NULL);\n"
+" if (data_socket == -1) {\n"
+" perror(\"accept\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" result = 0;\n"
+" for (;;) {\n"
+"\\&\n"
+" /* Wait for next data packet. */\n"
+"\\&\n"
+" ret = read(data_socket, buffer, sizeof(buffer));\n"
+" if (ret == -1) {\n"
+" perror(\"read\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Ensure buffer is 0-terminated. */\n"
+"\\&\n"
+" buffer[sizeof(buffer) - 1] = 0;\n"
+"\\&\n"
+" /* Handle commands. */\n"
+"\\&\n"
+" if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n"
+" down_flag = 1;\n"
+" break;\n"
+" }\n"
+"\\&\n"
+" if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n"
+" break;\n"
+" }\n"
+"\\&\n"
+" /* Add received summand. */\n"
+"\\&\n"
+" result += atoi(buffer);\n"
+" }\n"
+"\\&\n"
+" /* Send result. */\n"
+"\\&\n"
+" sprintf(buffer, \"%d\", result);\n"
+" ret = write(data_socket, buffer, sizeof(buffer));\n"
+" if (ret == -1) {\n"
+" perror(\"write\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Close socket. */\n"
+"\\&\n"
+" close(data_socket);\n"
+"\\&\n"
+" /* Quit on DOWN command. */\n"
+"\\&\n"
+" if (down_flag) {\n"
+" break;\n"
+" }\n"
+" }\n"
+"\\&\n"
+" close(connection_socket);\n"
+"\\&\n"
+" /* Unlink the socket. */\n"
+"\\&\n"
+" unlink(SOCKET_NAME);\n"
+"\\&\n"
+" exit(EXIT_SUCCESS);\n"
+"}\n"
+"\\&\n"
+"/*\n"
+" * File client.c\n"
+" */\n"
+"\\&\n"
+"#include E<lt>errno.hE<gt>\n"
+"#include E<lt>stdio.hE<gt>\n"
+"#include E<lt>stdlib.hE<gt>\n"
+"#include E<lt>string.hE<gt>\n"
+"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/un.hE<gt>\n"
+"#include E<lt>unistd.hE<gt>\n"
+"#include \"connection.h\"\n"
+"\\&\n"
+"int\n"
+"main(int argc, char *argv[])\n"
+"{\n"
+" struct sockaddr_un addr;\n"
+" int ret;\n"
+" int data_socket;\n"
+" char buffer[BUFFER_SIZE];\n"
+"\\&\n"
+" /* Create local socket. */\n"
+"\\&\n"
+" data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
+" if (data_socket == -1) {\n"
+" perror(\"socket\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * For portability clear the whole structure, since some\n"
+" * implementations have additional (nonstandard) fields in\n"
+" * the structure.\n"
+" */\n"
+"\\&\n"
+" memset(&addr, 0, sizeof(addr));\n"
+"\\&\n"
+" /* Connect socket to socket address. */\n"
+"\\&\n"
+" addr.sun_family = AF_UNIX;\n"
+" strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n"
+"\\&\n"
+" ret = connect(data_socket, (const struct sockaddr *) &addr,\n"
+" sizeof(addr));\n"
+" if (ret == -1) {\n"
+" fprintf(stderr, \"The server is down.\\en\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Send arguments. */\n"
+"\\&\n"
+" for (size_t i = 1; i E<lt> argc; ++i) {\n"
+" ret = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
+" if (ret == -1) {\n"
+" perror(\"write\");\n"
+" break;\n"
+" }\n"
+" }\n"
+"\\&\n"
+" /* Request result. */\n"
+"\\&\n"
+" strcpy(buffer, \"END\");\n"
+" ret = write(data_socket, buffer, strlen(buffer) + 1);\n"
+" if (ret == -1) {\n"
+" perror(\"write\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Receive result. */\n"
+"\\&\n"
+" ret = read(data_socket, buffer, sizeof(buffer));\n"
+" if (ret == -1) {\n"
+" perror(\"read\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Ensure buffer is 0-terminated. */\n"
+"\\&\n"
+" buffer[sizeof(buffer) - 1] = 0;\n"
+"\\&\n"
+" printf(\"Result = %s\\en\", buffer);\n"
+"\\&\n"
+" /* Close socket. */\n"
+"\\&\n"
+" close(data_socket);\n"
+"\\&\n"
+" exit(EXIT_SUCCESS);\n"
+"}\n"
+msgstr ""
+
+#. type: TH
+#: fedora-rawhide
+#, no-wrap
+msgid "2024-03-16"
+msgstr ""
+
+#. type: TH
+#: fedora-rawhide
+#, no-wrap
+msgid "Linux man-pages 6.7"
+msgstr ""
+
+#. type: Plain text
+#: fedora-rawhide
+#, no-wrap
+msgid ""
+"/*\n"
+" * File connection.h\n"
+" */\n"
+"\\&\n"
+"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n"
+"#define BUFFER_SIZE 12\n"
+msgstr ""
+
+#. type: Plain text
+#: fedora-rawhide
+#, no-wrap
+msgid ""
+"/*\n"
+" * File server.c\n"
+" */\n"
+"\\&\n"
+"#include E<lt>stdio.hE<gt>\n"
+"#include E<lt>stdlib.hE<gt>\n"
+"#include E<lt>string.hE<gt>\n"
+"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/un.hE<gt>\n"
+"#include E<lt>unistd.hE<gt>\n"
+"\\&\n"
+"#include \"connection.h\"\n"
+"\\&\n"
+"int\n"
+"main(void)\n"
+"{\n"
+" int down_flag = 0;\n"
+" int ret;\n"
+" int connection_socket;\n"
+" int data_socket;\n"
+" int result;\n"
+" ssize_t r, w;\n"
+" struct sockaddr_un name;\n"
+" char buffer[BUFFER_SIZE];\n"
+"\\&\n"
+" /* Create local socket. */\n"
+"\\&\n"
+" connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
+" if (connection_socket == -1) {\n"
+" perror(\"socket\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * For portability clear the whole structure, since some\n"
+" * implementations have additional (nonstandard) fields in\n"
+" * the structure.\n"
+" */\n"
+"\\&\n"
+" memset(&name, 0, sizeof(name));\n"
+"\\&\n"
+" /* Bind socket to socket name. */\n"
+"\\&\n"
+" name.sun_family = AF_UNIX;\n"
+" strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n"
+"\\&\n"
+" ret = bind(connection_socket, (const struct sockaddr *) &name,\n"
+" sizeof(name));\n"
+" if (ret == -1) {\n"
+" perror(\"bind\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * Prepare for accepting connections. The backlog size is set\n"
+" * to 20. So while one request is being processed other requests\n"
+" * can be waiting.\n"
+" */\n"
+"\\&\n"
+" ret = listen(connection_socket, 20);\n"
+" if (ret == -1) {\n"
+" perror(\"listen\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* This is the main loop for handling connections. */\n"
+"\\&\n"
+" for (;;) {\n"
+"\\&\n"
+" /* Wait for incoming connection. */\n"
+"\\&\n"
+" data_socket = accept(connection_socket, NULL, NULL);\n"
+" if (data_socket == -1) {\n"
+" perror(\"accept\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" result = 0;\n"
+" for (;;) {\n"
+"\\&\n"
+" /* Wait for next data packet. */\n"
+"\\&\n"
+" r = read(data_socket, buffer, sizeof(buffer));\n"
+" if (r == -1) {\n"
+" perror(\"read\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Ensure buffer is 0-terminated. */\n"
+"\\&\n"
+" buffer[sizeof(buffer) - 1] = 0;\n"
+"\\&\n"
+" /* Handle commands. */\n"
+"\\&\n"
+" if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n"
+" down_flag = 1;\n"
+" continue;\n"
+" }\n"
+"\\&\n"
+" if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n"
+" break;\n"
+" }\n"
+"\\&\n"
+" if (down_flag) {\n"
+" continue;\n"
+" }\n"
+"\\&\n"
+" /* Add received summand. */\n"
+"\\&\n"
+" result += atoi(buffer);\n"
+" }\n"
+"\\&\n"
+" /* Send result. */\n"
+"\\&\n"
+" sprintf(buffer, \"%d\", result);\n"
+" w = write(data_socket, buffer, sizeof(buffer));\n"
+" if (w == -1) {\n"
+" perror(\"write\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Close socket. */\n"
+"\\&\n"
+" close(data_socket);\n"
+"\\&\n"
+" /* Quit on DOWN command. */\n"
+"\\&\n"
+" if (down_flag) {\n"
+" break;\n"
+" }\n"
+" }\n"
+"\\&\n"
+" close(connection_socket);\n"
+"\\&\n"
+" /* Unlink the socket. */\n"
+"\\&\n"
+" unlink(SOCKET_NAME);\n"
+"\\&\n"
+" exit(EXIT_SUCCESS);\n"
+"}\n"
+msgstr ""
+
+#. type: Plain text
+#: fedora-rawhide
+#, no-wrap
+msgid ""
+"/*\n"
+" * File client.c\n"
+" */\n"
+"\\&\n"
+"#include E<lt>stdio.hE<gt>\n"
+"#include E<lt>stdlib.hE<gt>\n"
+"#include E<lt>string.hE<gt>\n"
+"#include E<lt>sys/socket.hE<gt>\n"
+"#include E<lt>sys/un.hE<gt>\n"
+"#include E<lt>unistd.hE<gt>\n"
+"\\&\n"
+"#include \"connection.h\"\n"
+"\\&\n"
+"int\n"
+"main(int argc, char *argv[])\n"
+"{\n"
+" int ret;\n"
+" int data_socket;\n"
+" ssize_t r, w;\n"
+" struct sockaddr_un addr;\n"
+" char buffer[BUFFER_SIZE];\n"
+"\\&\n"
+" /* Create local socket. */\n"
+"\\&\n"
+" data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
+" if (data_socket == -1) {\n"
+" perror(\"socket\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /*\n"
+" * For portability clear the whole structure, since some\n"
+" * implementations have additional (nonstandard) fields in\n"
+" * the structure.\n"
+" */\n"
+"\\&\n"
+" memset(&addr, 0, sizeof(addr));\n"
+"\\&\n"
+" /* Connect socket to socket address. */\n"
+"\\&\n"
+" addr.sun_family = AF_UNIX;\n"
+" strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n"
+"\\&\n"
+" ret = connect(data_socket, (const struct sockaddr *) &addr,\n"
+" sizeof(addr));\n"
+" if (ret == -1) {\n"
+" fprintf(stderr, \"The server is down.\\en\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Send arguments. */\n"
+"\\&\n"
+" for (int i = 1; i E<lt> argc; ++i) {\n"
+" w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
+" if (w == -1) {\n"
+" perror(\"write\");\n"
+" break;\n"
+" }\n"
+" }\n"
+"\\&\n"
+" /* Request result. */\n"
+"\\&\n"
+" strcpy(buffer, \"END\");\n"
+" w = write(data_socket, buffer, strlen(buffer) + 1);\n"
+" if (w == -1) {\n"
+" perror(\"write\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Receive result. */\n"
+"\\&\n"
+" r = read(data_socket, buffer, sizeof(buffer));\n"
+" if (r == -1) {\n"
+" perror(\"read\");\n"
+" exit(EXIT_FAILURE);\n"
+" }\n"
+"\\&\n"
+" /* Ensure buffer is 0-terminated. */\n"
+"\\&\n"
+" buffer[sizeof(buffer) - 1] = 0;\n"
+"\\&\n"
+" printf(\"Result = %s\\en\", buffer);\n"
+"\\&\n"
+" /* Close socket. */\n"
+"\\&\n"
+" close(data_socket);\n"
+"\\&\n"
+" exit(EXIT_SUCCESS);\n"
+"}\n"
msgstr ""
#. type: TH
@@ -2366,3 +2914,9 @@ msgstr ""
#, no-wrap
msgid "Linux man-pages 6.04"
msgstr ""
+
+#. type: TH
+#: opensuse-tumbleweed
+#, no-wrap
+msgid "Linux man-pages (unreleased)"
+msgstr ""