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