#include <modglue/modglue.hh> modglue::pipe foopipe("foo", modglue::pipe::input, 0); modglue::pipe barpipe("bar", modglue::pipe::output, 1); void print(const string& txt) { cout << "received " << txt << " on foo pipe" << endl; cout << "sending something on bar pipe" << endl; while(txt!="end") { string str; if(!foopipe.read(str,2)) break; } barpipe.sender("thank you!"); } int main(int argc, char **argv) { modglue::main mm(&argc, &argv); mm.add(pipe1); mm.add(pipe2); foopipe.receiver.connect(slot(print)); mm.run(); }
For all download information please visit the download page of cadabra.
Several small programs are bundled with modglue. They provide some additional functionality that was easy to implement with the library, or are generally useful for command-line driven programs.
- ptywrap
- Starts a program with stdin/stdout/stderr connected to a pseudo tty device, and map them to fd 0,1,2. This can be used to trick programs like ftp or sed into thinking that they are running interactively.
is all you need to know.> ptywrap [unix executable]
- prompt
- The prompt utility wraps other programs such that their input has the well-known readline behaviour. In other words, you can use the cursor keys for editing, there is a history, and so on. Useful for programs like ftp that lack this functionality.