diff options
Diffstat (limited to 'po/pl/man7/unix.7.po')
-rw-r--r-- | po/pl/man7/unix.7.po | 1378 |
1 files changed, 1211 insertions, 167 deletions
diff --git a/po/pl/man7/unix.7.po b/po/pl/man7/unix.7.po index ace49f4f..8f19ecc3 100644 --- a/po/pl/man7/unix.7.po +++ b/po/pl/man7/unix.7.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: manpages-pl\n" -"POT-Creation-Date: 2024-03-01 17:12+0100\n" -"PO-Revision-Date: 2024-02-26 20:14+0100\n" +"POT-Creation-Date: 2024-06-01 06:33+0200\n" +"PO-Revision-Date: 2024-06-01 21:41+0200\n" "Last-Translator: Michał Kułach <michal.kulach@gmail.com>\n" "Language-Team: Polish <manpages-pl-list@lists.sourceforge.net>\n" "Language: pl\n" @@ -27,16 +27,16 @@ msgid "UNIX" msgstr "UNIX" #. type: TH -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable opensuse-tumbleweed #, no-wrap -msgid "2023-12-21" -msgstr "21 grudnia 2023 r." +msgid "2024-05-02" +msgstr "2 maja 2024 r." #. type: TH -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable #, no-wrap -msgid "Linux man-pages 6.06" -msgstr "Linux man-pages 6.06" +msgid "Linux man-pages 6.8" +msgstr "Linux man-pages 6.8" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide @@ -176,10 +176,9 @@ msgstr "" "rozmiar 108 bajtów, zob. też USTERKI poniżej." #. 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." @@ -636,7 +635,8 @@ msgid "B<SO_PEERCRED>" msgstr "B<SO_PEERCRED>" #. 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 " @@ -1742,11 +1742,10 @@ msgstr "USTERKI" #. 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 " @@ -1757,7 +1756,7 @@ msgid "" "specified as I<sizeof(struct sockaddr_un)>, then the returned address " "structure I<won't> have a null terminator in I<sun_path>." msgstr "" -"Przy wiązaniu gniazda z adresem, Linux jest jedną z implementacji dodających " +"Przy wiązaniu gniazda z adresem, Linux jest jedną z implementacji dodających " "kończące null, jeśli nie poda się go w I<sun_path>. Zwykle jest to " "bezproblemowe, gdy adres gniazda jest pozyskiwany będzie on o jeden bajt " "dłuższy niż podawany początkowo. Jest jednak jeden przypadek mogący " @@ -1946,17 +1945,35 @@ msgid "Program source" msgstr "Kod źródłowy programu" #. 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 "" +"/*\n" +" * Plik 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 (ochr. przed wielokr. przetw.)\n" + +#. type: Plain text +#: archlinux debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "" "/*\n" " * File server.c\n" " */\n" @@ -1965,20 +1982,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" @@ -2037,8 +2057,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" @@ -2051,13 +2071,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" @@ -2066,8 +2090,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" @@ -2091,104 +2115,8 @@ msgid "" "\\&\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 "" "/*\n" -" * Plik connection.h\n" -" */\n" -"\\&\n" -"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" -"#define BUFFER_SIZE 12\n" -"\\&\n" -"/*\n" " * Plik server.c\n" " */\n" "\\&\n" @@ -2196,20 +2124,23 @@ msgstr "" "#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" " /* Tworzenie gniazda lokalnego. */\n" "\\&\n" @@ -2268,8 +2199,8 @@ msgstr "" "\\&\n" " /* Oczekiwanie na następny pakiet danych. */\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" @@ -2282,13 +2213,17 @@ msgstr "" "\\&\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" " /* Dodanie otrzymanego składnika. */\n" "\\&\n" " result += atoi(buffer);\n" @@ -2297,8 +2232,8 @@ msgstr "" " /* Wysłanie wyniku. */\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" @@ -2322,29 +2257,126 @@ msgstr "" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" + +#. type: Plain text +#: archlinux debian-unstable opensuse-tumbleweed +#, 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/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" +" 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 "" "/*\n" " * Plik 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" -" /* Utworzenie gniazda lokalnego. */\n" +" /* Tworzenie gniazda lokalnego. */\n" "\\&\n" " data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n" " if (data_socket == -1) {\n" @@ -2360,7 +2392,7 @@ msgstr "" "\\&\n" " memset(&addr, 0, sizeof(addr));\n" "\\&\n" -" /* Połączenie gniazda z adresem gniazda. */\n" +" /* Łączenie gniazda z adresem gniazda. */\n" "\\&\n" " addr.sun_family = AF_UNIX;\n" " strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n" @@ -2372,34 +2404,34 @@ msgstr "" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" -" /* Wysłanie argumentów. */\n" +" /* Wysyłanie argumentów. */\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" " }\n" "\\&\n" -" /* Zażądanie wyniku. */\n" +" /* Żądanie wyniku. */\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" " /* Otrzymanie wyniku. */\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" "\\&\n" -" /* Upewnienie się, że bufor jest zakończony 0. */\n" +" /* Upewnienie się, że bufor kończy się 0. */\n" "\\&\n" " buffer[sizeof(buffer) - 1] = 0;\n" "\\&\n" @@ -2452,7 +2484,20 @@ msgid "Linux man-pages 6.03" msgstr "Linux man-pages 6.03" #. 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 "" +"Różne wywołania systemowe (np. B<bind>(2), B<connect>(2) i B<sendto>(2)) " +"przyjmują argument I<sockaddr_un> jako wejście. Niektóre inne wywołania " +"systemowe (np. B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2) i " +"B<accept>(2)) zwracają argument tego typu." + +#. 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 " @@ -2463,6 +2508,33 @@ msgstr "" "są te, które obowiązywały w momencie wywołania B<connect>(2) lub " "B<socketpair>(2)." +#. 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 "" +"Przy wiązaniu gniazda z adresem, Linux jest jedną z implementacji dodających " +"kończące null, jeśli nie poda się go w I<sun_path>. Zwykle jest to " +"bezproblemowe, gdy adres gniazda jest pozyskiwany będzie on o jeden bajt " +"dłuższy niż podawany początkowo. Jest jednak jeden przypadek mogący " +"spowodować mylące zachowanie: jeśli podany zostanie adres 108 bajtowy, bez " +"znaku null, to dodanie znaku null spowodowałoby przekroczenie długości " +"ścieżki poza I<sizeof(sun_path)>. W konsekwencji, przy pozyskiwaniu adresu " +"gniazda (np. poprzez B<accept>(2)), jeśli wejściowy argument I<addrlen> dla " +"pozyskiwanego wywołania jest podany jako I<sizeof(struct sockaddr_un)>, to " +"zwrócona struktura adresu I<nie> będzie miała kończącego null w I<sun_path>." + #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap @@ -3007,7 +3079,7 @@ msgstr "" " ret = connect(data_socket, (const struct sockaddr *) &addr,\n" " sizeof(addr));\n" " if (ret == -1) {\n" -" fprintf(stderr, \"The server is down.\\en\");\n" +" fprintf(stderr, \"Serwer jest wyłączony.\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" @@ -3087,7 +3159,7 @@ msgstr "" #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Ensure buffer is 0-terminated. */\n" -msgstr " /* Upewnienie się, że bufor kończy się 0. */\n" +msgstr " /* Upewnienie się, że bufor kończy się 0. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 @@ -3099,7 +3171,7 @@ msgstr " buffer[sizeof(buffer) - 1] = 0;\n" #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " printf(\"Result = %s\\en\", buffer);\n" -msgstr " printf(\"Result = %s\\en\", buffer);\n" +msgstr " printf(\"Wynik = %s\\en\", buffer);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 @@ -3114,16 +3186,982 @@ msgid " close(data_socket);\n" msgstr " close(data_socket);\n" #. type: TH -#: debian-unstable opensuse-tumbleweed +#: fedora-40 mageia-cauldron +#, no-wrap +msgid "2023-12-21" +msgstr "21 grudnia 2023 r." + +#. type: TH +#: fedora-40 mageia-cauldron +#, no-wrap +msgid "Linux man-pages 6.06" +msgstr "Linux man-pages 6.06" + +#. 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 "" +"/*\n" +" * Plik connection.h\n" +" */\n" +"\\&\n" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" +"\\&\n" +"/*\n" +" * Plik 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" +" /* Tworzenie gniazda lokalnego. */\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" +" * Ze względu na przenośność konieczne jest wyczyszczenie całej\n" +" * struktury, ponieważ niektóre implementacje zawierają dodatkowe\n" +" * (nieprzenośne) pola w strukturze.\n" +" */\n" +"\\&\n" +" memset(&name, 0, sizeof(name));\n" +"\\&\n" +" /* Skojarzenie gniazda z nazwą gniazda. */\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" +" * Przygotowanie do przyjmowania połączeń. Rozmiar dziennika zaległości\n" +" * ustawiony na 20. W trakcie przetwarzania jednego żądania, inne mogą\n" +" * zatem oczekiwać.\n" +" */\n" +"\\&\n" +" ret = listen(connection_socket, 20);\n" +" if (ret == -1) {\n" +" perror(\"listen\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* To jest główna pętla do obsługi połączeń. */\n" +"\\&\n" +" for (;;) {\n" +"\\&\n" +" /* Oczekiwanie na połączenie przychodzące. */\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" +" /* Oczekiwanie na następny pakiet danych. */\n" +"\\&\n" +" ret = read(data_socket, buffer, sizeof(buffer));\n" +" if (ret == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Upewnienie się, że bufor jest zakończony 0. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" /* Obsługa poleceń. */\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" +" /* Dodanie otrzymanego składnika. */\n" +"\\&\n" +" result += atoi(buffer);\n" +" }\n" +"\\&\n" +" /* Wysłanie wyniku. */\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" +" /* Zamknięcie gniazda. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" /* Wyjście na polecenie DOWN. */\n" +"\\&\n" +" if (down_flag) {\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" close(connection_socket);\n" +"\\&\n" +" /* Odlinkowanie gniazda. */\n" +"\\&\n" +" unlink(SOCKET_NAME);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +"\\&\n" +"/*\n" +" * Plik 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" +" /* Utworzenie gniazda lokalnego. */\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" +" * Ze względu na przenośność konieczne jest wyczyszczenie całej\n" +" * struktury, ponieważ niektóre implementacje zawierają dodatkowe\n" +" * (nieprzenośne) pola w strukturze.\n" +" */\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +"\\&\n" +" /* Połączenie gniazda z adresem gniazda. */\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, \"Serwer jest wyłączony.\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Wysłanie argumentów. */\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" +" /* Zażądanie wyniku. */\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" +" /* Otrzymanie wyniku. */\n" +"\\&\n" +" ret = read(data_socket, buffer, sizeof(buffer));\n" +" if (ret == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Upewnienie się, że bufor jest zakończony 0. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" printf(\"Wynik = %s\\en\", buffer);\n" +"\\&\n" +" /* Zamknięcie gniazda. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" + +#. type: TH +#: fedora-rawhide #, no-wrap -msgid "2023-07-15" -msgstr "15 lipca 2023 r." +msgid "2024-03-16" +msgstr "16 marca 2024 r." #. type: TH -#: debian-unstable opensuse-tumbleweed +#: fedora-rawhide +#, no-wrap +msgid "Linux man-pages 6.7" +msgstr "Linux man-pages 6.7" + +#. 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 "" +"/*\n" +" * Plik connection.h\n" +" */\n" +"\\&\n" +"#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n" +"#define BUFFER_SIZE 12\n" + +#. 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 "" +"/*\n" +" * Plik 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" +" /* Tworzenie gniazda lokalnego. */\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" +" * Ze względu na przenośność konieczne jest wyczyszczenie całej\n" +" * struktury, ponieważ niektóre implementacje zawierają dodatkowe\n" +" * (nieprzenośne) pola w strukturze.\n" +" */\n" +"\\&\n" +" memset(&name, 0, sizeof(name));\n" +"\\&\n" +" /* Skojarzenie gniazda z nazwą gniazda. */\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" +" * Przygotowanie do przyjmowania połączeń. Rozmiar dziennika zaległości\n" +" * ustawiony na 20. W trakcie przetwarzania jednego żądania, inne mogą\n" +" * zatem oczekiwać.\n" +" */\n" +"\\&\n" +" ret = listen(connection_socket, 20);\n" +" if (ret == -1) {\n" +" perror(\"listen\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* To jest główna pętla do obsługi połączeń. */\n" +"\\&\n" +" for (;;) {\n" +"\\&\n" +" /* Oczekiwanie na połączenie przychodzące. */\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" +" /* Oczekiwanie na następny pakiet danych. */\n" +"\\&\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Upewnienie się, że bufor jest zakończony 0. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" /* Obsługa poleceń. */\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" +" /* Dodanie otrzymanego składnika. */\n" +"\\&\n" +" result += atoi(buffer);\n" +" }\n" +"\\&\n" +" /* Wysłanie wyniku. */\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" +" /* Zamknięcie gniazda. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" /* Wyjście na polecenie DOWN. */\n" +"\\&\n" +" if (down_flag) {\n" +" break;\n" +" }\n" +" }\n" +"\\&\n" +" close(connection_socket);\n" +"\\&\n" +" /* Odlinkowanie gniazda. */\n" +"\\&\n" +" unlink(SOCKET_NAME);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" + +#. type: Plain text +#: fedora-rawhide #, no-wrap -msgid "Linux man-pages 6.05.01" -msgstr "Linux man-pages 6.05.01" +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 "" +"/*\n" +" * Plik 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" +" /* Tworzenie gniazda lokalnego. */\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" +" * Ze względu na przenośność konieczne jest wyczyszczenie całej\n" +" * struktury, ponieważ niektóre implementacje zawierają dodatkowe\n" +" * (nieprzenośne) pola w strukturze.\n" +" */\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +"\\&\n" +" /* Łączenie gniazda z adresem gniazda. */\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, \"Serwer jest wyłączony.\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Wysyłanie argumentów. */\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" +" /* Żądanie wyniku. */\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" +" /* Otrzymanie wyniku. */\n" +"\\&\n" +" r = read(data_socket, buffer, sizeof(buffer));\n" +" if (r == -1) {\n" +" perror(\"read\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" /* Upewnienie się, że bufor kończy się 0. */\n" +"\\&\n" +" buffer[sizeof(buffer) - 1] = 0;\n" +"\\&\n" +" printf(\"Wynik = %s\\en\", buffer);\n" +"\\&\n" +" /* Zamknięcie gniazda. */\n" +"\\&\n" +" close(data_socket);\n" +"\\&\n" +" exit(EXIT_SUCCESS);\n" +"}\n" #. type: TH #: opensuse-leap-15-6 @@ -3136,3 +4174,9 @@ msgstr "21 marca 2023 r." #, no-wrap msgid "Linux man-pages 6.04" msgstr "Linux man-pages 6.04" + +#. type: TH +#: opensuse-tumbleweed +#, no-wrap +msgid "Linux man-pages (unreleased)" +msgstr "Linux man-pages (niewydane)" |