diff options
Diffstat (limited to 'templates/man2/select_tut.2.pot')
-rw-r--r-- | templates/man2/select_tut.2.pot | 307 |
1 files changed, 296 insertions, 11 deletions
diff --git a/templates/man2/select_tut.2.pot b/templates/man2/select_tut.2.pot index 2907252d..47d1030f 100644 --- a/templates/man2/select_tut.2.pot +++ b/templates/man2/select_tut.2.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-01 17:07+0100\n" +"POT-Creation-Date: 2024-06-01 06:20+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 "SELECT_TUT" msgstr "" #. type: TH -#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#: archlinux debian-unstable opensuse-tumbleweed #, no-wrap -msgid "2023-10-31" +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 @@ -504,8 +504,7 @@ msgid "" msgstr "" #. type: Plain text -#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron -#: opensuse-tumbleweed +#: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "" "#include E<lt>arpa/inet.hE<gt>\n" @@ -517,6 +516,7 @@ msgid "" "#include E<lt>string.hE<gt>\n" "#include E<lt>sys/select.hE<gt>\n" "#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>sys/types.hE<gt>\n" "#include E<lt>unistd.hE<gt>\n" "\\&\n" "static int forward_port;\n" @@ -1401,15 +1401,294 @@ msgid "" msgstr "" #. type: TH -#: debian-unstable opensuse-tumbleweed +#: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap -msgid "2023-05-03" +msgid "2023-10-31" 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 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "" +"#include E<lt>arpa/inet.hE<gt>\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>netinet/in.hE<gt>\n" +"#include E<lt>signal.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/select.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"static int forward_port;\n" +"\\&\n" +"#undef max\n" +"#define max(x, y) ((x) E<gt> (y) ? (x) : (y))\n" +"\\&\n" +"static int\n" +"listen_socket(int listen_port)\n" +"{\n" +" int lfd;\n" +" int yes;\n" +" struct sockaddr_in addr;\n" +"\\&\n" +" lfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (lfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +"\\&\n" +" yes = 1;\n" +" if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR,\n" +" &yes, sizeof(yes)) == -1)\n" +" {\n" +" perror(\"setsockopt\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(listen_port);\n" +" addr.sin_family = AF_INET;\n" +" if (bind(lfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"bind\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" printf(\"accepting connections on port %d\\en\", listen_port);\n" +" listen(lfd, 10);\n" +" return lfd;\n" +"}\n" +"\\&\n" +"static int\n" +"connect_socket(int connect_port, char *address)\n" +"{\n" +" int cfd;\n" +" struct sockaddr_in addr;\n" +"\\&\n" +" cfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (cfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(connect_port);\n" +" addr.sin_family = AF_INET;\n" +"\\&\n" +" if (!inet_aton(address, (struct in_addr *) &addr.sin_addr.s_addr)) {\n" +" fprintf(stderr, \"inet_aton(): bad IP address format\\en\");\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" if (connect(cfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"connect()\");\n" +" shutdown(cfd, SHUT_RDWR);\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +" return cfd;\n" +"}\n" +"\\&\n" +"#define SHUT_FD1 do { \\e\n" +" if (fd1 E<gt>= 0) { \\e\n" +" shutdown(fd1, SHUT_RDWR); \\e\n" +" close(fd1); \\e\n" +" fd1 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +"\\&\n" +"#define SHUT_FD2 do { \\e\n" +" if (fd2 E<gt>= 0) { \\e\n" +" shutdown(fd2, SHUT_RDWR); \\e\n" +" close(fd2); \\e\n" +" fd2 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +"\\&\n" +"#define BUF_SIZE 1024\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int h;\n" +" int ready, nfds;\n" +" int fd1 = -1, fd2 = -1;\n" +" int buf1_avail = 0, buf1_written = 0;\n" +" int buf2_avail = 0, buf2_written = 0;\n" +" char buf1[BUF_SIZE], buf2[BUF_SIZE];\n" +" fd_set readfds, writefds, exceptfds;\n" +" ssize_t nbytes;\n" +"\\&\n" +" if (argc != 4) {\n" +" fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n" +" \"E<lt>forward-to-portE<gt> E<lt>forward-to-ip-addressE<gt>\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" signal(SIGPIPE, SIG_IGN);\n" +"\\&\n" +" forward_port = atoi(argv[2]);\n" +"\\&\n" +" h = listen_socket(atoi(argv[1]));\n" +" if (h == -1)\n" +" exit(EXIT_FAILURE);\n" +"\\&\n" +" for (;;) {\n" +" nfds = 0;\n" +"\\&\n" +" FD_ZERO(&readfds);\n" +" FD_ZERO(&writefds);\n" +" FD_ZERO(&exceptfds);\n" +" FD_SET(h, &readfds);\n" +" nfds = max(nfds, h);\n" +"\\&\n" +" if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd1, &readfds);\n" +" /* Note: nfds is updated below, when fd1 is added to\n" +" exceptfds. */\n" +" if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd2, &readfds);\n" +"\\&\n" +" if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0)\n" +" FD_SET(fd1, &writefds);\n" +" if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0)\n" +" FD_SET(fd2, &writefds);\n" +"\\&\n" +" if (fd1 E<gt> 0) {\n" +" FD_SET(fd1, &exceptfds);\n" +" nfds = max(nfds, fd1);\n" +" }\n" +" if (fd2 E<gt> 0) {\n" +" FD_SET(fd2, &exceptfds);\n" +" nfds = max(nfds, fd2);\n" +" }\n" +"\\&\n" +" ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL);\n" +"\\&\n" +" if (ready == -1 && errno == EINTR)\n" +" continue;\n" +"\\&\n" +" if (ready == -1) {\n" +" perror(\"select()\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" if (FD_ISSET(h, &readfds)) {\n" +" socklen_t addrlen;\n" +" struct sockaddr_in client_addr;\n" +" int fd;\n" +"\\&\n" +" addrlen = sizeof(client_addr);\n" +" memset(&client_addr, 0, addrlen);\n" +" fd = accept(h, (struct sockaddr *) &client_addr, &addrlen);\n" +" if (fd == -1) {\n" +" perror(\"accept()\");\n" +" } else {\n" +" SHUT_FD1;\n" +" SHUT_FD2;\n" +" buf1_avail = buf1_written = 0;\n" +" buf2_avail = buf2_written = 0;\n" +" fd1 = fd;\n" +" fd2 = connect_socket(forward_port, argv[3]);\n" +" if (fd2 == -1)\n" +" SHUT_FD1;\n" +" else\n" +" printf(\"connect from %s\\en\",\n" +" inet_ntoa(client_addr.sin_addr));\n" +"\\&\n" +" /* Skip any events on the old, closed file\n" +" descriptors. */\n" +"\\&\n" +" continue;\n" +" }\n" +" }\n" +"\\&\n" +" /* NB: read OOB data before normal reads. */\n" +"\\&\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &exceptfds)) {\n" +" char c;\n" +"\\&\n" +" nbytes = recv(fd1, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" send(fd2, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &exceptfds)) {\n" +" char c;\n" +"\\&\n" +" nbytes = recv(fd2, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" send(fd1, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &readfds)) {\n" +" nbytes = read(fd1, buf1 + buf1_avail,\n" +" BUF_SIZE - buf1_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf1_avail += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &readfds)) {\n" +" nbytes = read(fd2, buf2 + buf2_avail,\n" +" BUF_SIZE - buf2_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf2_avail += nbytes;\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &writefds) && buf2_avail E<gt> 0) {\n" +" nbytes = write(fd1, buf2 + buf2_written,\n" +" buf2_avail - buf2_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf2_written += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &writefds) && buf1_avail E<gt> 0) {\n" +" nbytes = write(fd2, buf1 + buf1_written,\n" +" buf1_avail - buf1_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf1_written += nbytes;\n" +" }\n" +"\\&\n" +" /* Check if write data has caught read data. */\n" +"\\&\n" +" if (buf1_written == buf1_avail)\n" +" buf1_written = buf1_avail = 0;\n" +" if (buf2_written == buf2_avail)\n" +" buf2_written = buf2_avail = 0;\n" +"\\&\n" +" /* One side has closed the connection, keep\n" +" writing to the other side until empty. */\n" +"\\&\n" +" if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n" +" SHUT_FD2;\n" +" if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n" +" SHUT_FD1;\n" +" }\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" + +#. type: TH +#: fedora-rawhide +#, no-wrap +msgid "Linux man-pages 6.7" msgstr "" #. type: TH @@ -1417,3 +1696,9 @@ msgstr "" #, no-wrap msgid "Linux man-pages 6.04" msgstr "" + +#. type: TH +#: opensuse-tumbleweed +#, no-wrap +msgid "Linux man-pages (unreleased)" +msgstr "" |