Made IRC use select()
authorJohn Hodge <[email protected]>
Tue, 1 Mar 2011 06:58:09 +0000 (14:58 +0800)
committerJohn Hodge <[email protected]>
Tue, 1 Mar 2011 06:58:09 +0000 (14:58 +0800)
- Also fixed filesystem xMKDIR

Usermode/Applications/irc_src/main.c
Usermode/Filesystem/Makefile

index b4892e7..c7535fa 100644 (file)
@@ -61,7 +61,26 @@ int main(int argc, const char *argv[], const char *envp[])
        \r
        for( ;; )\r
        {\r
-               ProcessIncoming(&srv);\r
+               fd_set  readfds;\r
+                int    rv;\r
+               \r
+               FD_ZERO(&readfds);\r
+               FD_SET(0, &readfds);    // stdin\r
+               FD_SET(srv.FD, &readfds);\r
+               \r
+               rv = select(srv.FD, &readfds, 0, 0, NULL);\r
+               if( rv == -1 )  break;\r
+               \r
+               if(FD_ISSET(0, &readfds))\r
+               {\r
+                       // User input\r
+               }\r
+               \r
+               // Server response\r
+               if(FD_ISSET(srv.FD, &readfds))\r
+               {\r
+                       ProcessIncoming(&srv);\r
+               }\r
        }\r
        \r
        close(srv.FD);\r
index 4cf24a3..410a01b 100644 (file)
@@ -19,7 +19,7 @@ install:      $(DIRS) $(FILES)
 clean:
 
 $(DIRS):
-       $(xMKDIR) $(DISTROOT)/$@
+       $(xMKDIR) $(DISTROOT)/$@; true
 
 $(FILES):
        $(xCP) $@ $(DISTROOT)/$@

UCC git Repository :: git.ucc.asn.au