WvStreams
wvstreamlistex2.cc
00001 /* 
00002  * A WvStream example.
00003  *
00004  * Some text about this example...
00005  */
00006 
00007 #include <wvistreamlist.h>
00008 #include <wvpipe.h>
00009 
00010 int main()
00011 {
00012     const char *argv1[] = { "sh", "-c", 
00013                             "while :; do echo foo; sleep 3; done", NULL };
00014     const char *argv2[] = { "sh", "-c", 
00015                             "while :; do echo snorkle; sleep 1; done", NULL };
00016 
00017     WvPipe stream1(argv1[0], argv1, false, true, false);
00018     WvPipe stream2(argv2[0], argv2, false, true, false);
00019     stream1.autoforward(*wvcon);
00020     stream2.autoforward(*wvcon);
00021     
00022     WvIStreamList l;
00023     l.append(&stream1, false);
00024     l.append(&stream2, false);
00025     
00026     while (stream1.isok() || stream2.isok())
00027     {
00028         if (l.select(-1))
00029             l.callback();
00030     }
00031 }