From: John Hodge Date: Tue, 1 Mar 2011 06:58:09 +0000 (+0800) Subject: Made IRC use select() X-Git-Tag: rel0.10~175 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b96d38a6740c05ef7544113459407f7e31492af1;p=tpg%2Facess2.git Made IRC use select() - Also fixed filesystem xMKDIR --- diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index b4892e79..c7535fa2 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -61,7 +61,26 @@ int main(int argc, const char *argv[], const char *envp[]) for( ;; ) { - ProcessIncoming(&srv); + fd_set readfds; + int rv; + + FD_ZERO(&readfds); + FD_SET(0, &readfds); // stdin + FD_SET(srv.FD, &readfds); + + rv = select(srv.FD, &readfds, 0, 0, NULL); + if( rv == -1 ) break; + + if(FD_ISSET(0, &readfds)) + { + // User input + } + + // Server response + if(FD_ISSET(srv.FD, &readfds)) + { + ProcessIncoming(&srv); + } } close(srv.FD); diff --git a/Usermode/Filesystem/Makefile b/Usermode/Filesystem/Makefile index 4cf24a37..410a01b5 100644 --- a/Usermode/Filesystem/Makefile +++ b/Usermode/Filesystem/Makefile @@ -19,7 +19,7 @@ install: $(DIRS) $(FILES) clean: $(DIRS): - $(xMKDIR) $(DISTROOT)/$@ + $(xMKDIR) $(DISTROOT)/$@; true $(FILES): $(xCP) $@ $(DISTROOT)/$@