irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit c8b223aa61ede6f4c1d673f2b697c5c1738bf58f
parent aa4687d695556157dd851c6ed959f9e637108ead
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 17 Jun 2012 01:04:33 +0200

no output fifo for now

Diffstat:
Makefile | 2+-
irctk.c | 19++++++-------------
2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -Wall -g -DENABLE_THREADS -D_REENTRANT +CFLAGS = -Wall -Wno-unused-but-set-variable -g -DENABLE_THREADS -D_REENTRANT LIBS = -lpthread -lnsl -lssl -lircclient all: irctk diff --git a/irctk.c b/irctk.c @@ -526,10 +526,11 @@ void destroy(fifo *f) { pthread_mutex_destroy(&f->mutex); } -// fifos for input and output +// fifo for input // we want to read lines at the time we get them even if we are delaying writes -// on the irc channel, and we want to output lines without blocking -fifo fifo_in, fifo_out; +// on the irc channel +/* TODO fifo_out for output to avoid blocking if stdout blocks */ +fifo fifo_in; /* Our main chan is either the first CLI chan or our own chan if there are no @@ -1011,17 +1012,12 @@ static void* fifo_in_thread (void *arg) { return 0; } -// The fifo_out thread entry point -static void* fifo_out_thread (void *arg) { - return 0; -} - // Start the IRC thread and monitor stdin int start (int max_wait) { irc_session_t * s; - pthread_t tid_irc, tid_in, tid_out; + pthread_t tid_irc, tid_in; line l; struct timeval tp1, tp2; long tp; @@ -1038,8 +1034,6 @@ int start (int max_wait) die(E_THREAD, "Could not create thread: %s", strerror(errno)); if (pthread_create (&tid_in, 0, fifo_in_thread, (void*) NULL) != 0) die(E_THREAD, "Could not create thread: %s", strerror(errno)); - if (pthread_create (&tid_out, 0, fifo_out_thread, (void*) NULL) != 0) - die(E_THREAD, "Could not create thread: %s", strerror(errno)); debug("Thread started!"); @@ -1139,9 +1133,8 @@ int main (int argc, char **argv) strncpy(args.last_chan_in, first_chan(), MAX_LEN-1); strncpy(args.last_chans_out, first_chan(), MAX_LEN-1); - // initialize the fifos + // initialize the fifo init(&fifo_in); - init(&fifo_out); // start trying to connet with the initial retry interval return start(args.retry_after);