[wiki] [sites] ii: add updates ucspi patch for release 1.8 || Jan Klemkow
commit 064fa214b16276f3e6ff12e5791671fbcf5e984f
Author: Jan Klemkow <j.klemkow_AT_wemelug.de>
Date: Mon Feb 26 22:33:54 2018 +0100
ii: add updates ucspi patch for release 1.8
diff --git a/tools.suckless.org/ii/patches/ii-1.8-ucspi.diff b/tools.suckless.org/ii/patches/ii-1.8-ucspi.diff
new file mode 100644
index 00000000..487e5874
--- /dev/null
+++ b/tools.suckless.org/ii/patches/ii-1.8-ucspi.diff
_AT_@ -0,0 +1,335 @@
+diff -up ii-1.8/ii.c ii-1.8-mod/ii.c
+--- ii-1.8/ii.c Sun Feb 4 14:36:09 2018
++++ ii-1.8-mod/ii.c Mon Feb 26 22:24:36 2018
+_AT_@ -1,16 +1,13 @@
+ /* See LICENSE file for license details. */
+ #include <sys/select.h>
+-#include <sys/socket.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#include <sys/un.h>
+
+ #include <ctype.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <netdb.h>
+-#include <netinet/in.h>
+ #include <pwd.h>
+ #include <signal.h>
+ #include <stdarg.h>
+_AT_@ -20,6 +17,9 @@
+ #include <time.h>
+ #include <unistd.h>
+
++#define READ_FD 6
++#define WRITE_FD 7
++
+ char *argv0;
+
+ #include "arg.h"
+_AT_@ -56,16 +56,16 @@ static void channel_rm(Channel *);
+ static void create_dirtree(const char *);
+ static void create_filepath(char *, size_t, const char *, const char *, const char *);
+ static void ewritestr(int, const char *);
+-static void handle_channels_input(int, Channel *);
+-static void handle_server_output(int);
++static void handle_channels_input(Channel *);
++static void handle_server_output(void);
+ static int isnumeric(const char *);
+-static void loginkey(int, const char *);
+-static void loginuser(int, const char *, const char *);
+-static void proc_channels_input(int, Channel *, char *);
+-static void proc_channels_privmsg(int, Channel *, char *);
+-static void proc_server_cmd(int, char *);
++static void loginkey(const char *);
++static void loginuser(const char *, const char *);
++static void proc_channels_input(Channel *, char *);
++static void proc_channels_privmsg(Channel *, char *);
++static void proc_server_cmd(char *);
+ static int read_line(int, char *, size_t);
+-static void run(int, const char *);
++static void run(const char *);
+ static void setup(void);
+ static void sighandler(int);
+ static int tcpopen(const char *, const char *);
+_AT_@ -319,84 +319,22 @@ channel_leave(Channel *c)
+ }
+
+ static void
+-loginkey(int ircfd, const char *key)
++loginkey(const char *key)
+ {
+ snprintf(msg, sizeof(msg), "PASS %s
", key);
+- ewritestr(ircfd, msg);
++ ewritestr(WRITE_FD, msg);
+ }
+
+ static void
+-loginuser(int ircfd, const char *host, const char *fullname)
++loginuser(const char *host, const char *fullname)
+ {
+ snprintf(msg, sizeof(msg), "NICK %s
USER %s localhost %s :%s
",
+ nick, nick, host, fullname);
+ puts(msg);
+- ewritestr(ircfd, msg);
++ ewritestr(WRITE_FD, msg);
+ }
+
+ static int
+-udsopen(const char *uds)
+-{
+- struct sockaddr_un sun;
+- size_t len;
+- int fd;
+-
+- if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+- fprintf(stderr, "%s: socket: %s
", argv0, strerror(errno));
+- exit(1);
+- }
+-
+- sun.sun_family = AF_UNIX;
+- if (strlcpy(sun.sun_path, uds, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) {
+- fprintf(stderr, "%s: UNIX domain socket path truncation
", argv0);
+- exit(1);
+- }
+- len = strlen(sun.sun_path) + 1 + sizeof(sun.sun_family);
+- if (connect(fd, (struct sockaddr *)&sun, len) == -1) {
+- fprintf(stderr, "%s: connect: %s
", argv0, strerror(errno));
+- exit(1);
+- }
+- return fd;
+-}
+-
+-static int
+-tcpopen(const char *host, const char *service)
+-{
+- struct addrinfo hints, *res = NULL, *rp;
+- int fd = -1, e;
+-
+- memset(&hints, 0, sizeof(hints));
+- hints.ai_family = AF_UNSPEC; /* allow IPv4 or IPv6 */
+- hints.ai_flags = AI_NUMERICSERV; /* avoid name lookup for port */
+- hints.ai_socktype = SOCK_STREAM;
+-
+- if ((e = getaddrinfo(host, service, &hints, &res))) {
+- fprintf(stderr, "%s: getaddrinfo: %s
", argv0, gai_strerror(e));
+- exit(1);
+- }
+-
+- for (rp = res; rp; rp = rp->ai_next) {
+- fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+- if (fd == -1)
+- continue;
+- if (connect(fd, res->ai_addr, res->ai_addrlen) == -1) {
+- close(fd);
+- fd = -1;
+- continue;
+- }
+- break; /* success */
+- }
+- if (fd == -1) {
+- fprintf(stderr, "%s: could not connect to %s:%s: %s
",
+- argv0, host, service, strerror(errno));
+- exit(1);
+- }
+-
+- freeaddrinfo(res);
+- return fd;
+-}
+-
+-static int
+ isnumeric(const char *s)
+ {
+ errno = 0;
+_AT_@ -445,22 +383,22 @@ channel_print(Channel *c, const char *buf)
+ }
+
+ static void
+-proc_channels_privmsg(int ircfd, Channel *c, char *buf)
++proc_channels_privmsg(Channel *c, char *buf)
+ {
+ snprintf(msg, sizeof(msg), "<%s> %s", nick, buf);
+ channel_print(c, msg);
+ snprintf(msg, sizeof(msg), "PRIVMSG %s :%s
", c->name, buf);
+- ewritestr(ircfd, msg);
++ ewritestr(WRITE_FD, msg);
+ }
+
+ static void
+-proc_channels_input(int ircfd, Channel *c, char *buf)
++proc_channels_input(Channel *c, char *buf)
+ {
+ char *p = NULL;
+ size_t buflen;
+
+ if (buf[0] != '/' && buf[0] != '
Received on Mon Feb 26 2018 - 22:34:49 CET
This archive was generated by hypermail 2.3.0
: Mon Feb 26 2018 - 22:36:22 CET