[wiki] [sites] ii: add patch for ucspi support || Jan Klemkow
commit 92965b1f1ab596991c5811aef21e0ea848067810
Author: Jan Klemkow <j.klemkow_AT_wemelug.de>
Date: Sat May 7 03:42:36 2016 +0200
ii: add patch for ucspi support
diff --git a/tools.suckless.org/ii/patches/ii-1.7-ucspi.diff b/tools.suckless.org/ii/patches/ii-1.7-ucspi.diff
new file mode 100644
index 0000000..6dcc642
--- /dev/null
+++ b/tools.suckless.org/ii/patches/ii-1.7-ucspi.diff
_AT_@ -0,0 +1,165 @@
+diff --git a/ii.1 b/ii.1
+index dd1f6e3..c293c37 100644
+--- a/ii.1
++++ b/ii.1
+_AT_@ -20,6 +20,10 @@ server with basic command line tools.
+ For example if you will join a channel just do echo "/j #channel" > in
+ and ii creates a new channel directory with in and out file.
+ .SH SYNOPSIS
++.B tcpclient
++host
++port
++.RB [ tlsc ]
+ .B ii
+ .RB [ \-s
+ .IR servername ]
+_AT_@ -93,5 +97,7 @@ Write to ii (at) modprobe (dot) de for suggestions, fixes, 7|-|>< ;) etc.
+ Copyright \(co 2005-2006 by Anselm R. Garbe <garbeam (at) gmail (dot) com> and
+ Copyright \(co 2005-2008 by Nico Golde <nico (at) ngolde (dot) de>
+ .SH SEE ALSO
++.BR tcpclient(1),
++.BR tlsc(1),
+ .BR echo (1),
+ .BR tail (1),
+diff --git a/ii.c b/ii.c
+index d93266c..5305869 100644
+--- a/ii.c
++++ b/ii.c
+_AT_@ -5,9 +5,7 @@
+ #include <netdb.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <sys/socket.h>
+ #include <sys/select.h>
+-#include <netinet/in.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <limits.h>
+_AT_@ -19,6 +17,9 @@
+ #include <time.h>
+ #include <unistd.h>
+
++#define READ_FD 6
++#define WRITE_FD 7
++
+ #ifndef PIPE_BUF /* FreeBSD don't know PIPE_BUF */
+ #define PIPE_BUF 4096
+ #endif
+_AT_@ -33,7 +34,6 @@ struct Channel {
+ Channel *next;
+ };
+
+-static int irc;
+ static time_t last_response;
+ static Channel *channels = NULL;
+ static char *host = "irc.freenode.net";
+_AT_@ -148,31 +148,7 @@ static void login(char *key, char *fullname) {
+ nick, nick, host, fullname ? fullname : nick);
+ else snprintf(message, PIPE_BUF, "NICK %s
USER %s localhost %s :%s
",
+ nick, nick, host, fullname ? fullname : nick);
+- write(irc, message, strlen(message)); /* login */
+-}
+-
+-static int tcpopen(unsigned short port) {
+- int fd;
+- struct sockaddr_in sin;
+- struct hostent *hp = gethostbyname(host);
+-
+- memset(&sin, 0, sizeof(struct sockaddr_in));
+- if(!hp) {
+- perror("ii: cannot retrieve host information");
+- exit(EXIT_FAILURE);
+- }
+- sin.sin_family = AF_INET;
+- memcpy(&sin.sin_addr, hp->h_addr, hp->h_length);
+- sin.sin_port = htons(port);
+- if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+- perror("ii: cannot create socket");
+- exit(EXIT_FAILURE);
+- }
+- if(connect(fd, (const struct sockaddr *) &sin, sizeof(sin)) < 0) {
+- perror("ii: cannot connect to host");
+- exit(EXIT_FAILURE);
+- }
+- return fd;
++ write(WRITE_FD, message, strlen(message)); /* login */
+ }
+
+ static size_t tokenize(char **result, size_t reslen, char *str, char delim) {
+_AT_@ -219,7 +195,7 @@ static void proc_channels_privmsg(char *channel, char *buf) {
+ snprintf(message, PIPE_BUF, "<%s> %s", nick, buf);
+ print_out(channel, message);
+ snprintf(message, PIPE_BUF, "PRIVMSG %s :%s
", channel, buf);
+- write(irc, message, strlen(message));
++ write(WRITE_FD, message, strlen(message));
+ }
+
+ static void proc_channels_input(Channel *c, char *buf) {
+_AT_@ -273,7 +249,7 @@ static void proc_channels_input(Channel *c, char *buf) {
+ else
+ snprintf(message, PIPE_BUF,
+ "PART %s :ii - 500 SLOC are too much
", c->name);
+- write(irc, message, strlen(message));
++ write(WRITE_FD, message, strlen(message));
+ close(c->fd);
+ /*create_filepath(infile, sizeof(infile), c->name, "in");
+ unlink(infile); */
+_AT_@ -288,7 +264,7 @@ static void proc_channels_input(Channel *c, char *buf) {
+ snprintf(message, PIPE_BUF, "%s
", &buf[1]);
+
+ if (message[0] != '
Received on Sat May 07 2016 - 03:42:59 CEST
This archive was generated by hypermail 2.3.0
: Sat May 07 2016 - 03:48:13 CEST