X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=examples%2Fgrep.cpp;fp=examples%2Fgrep.cpp;h=c87ee72171615ec8056adcf687f8f0e74d78b621;hp=0000000000000000000000000000000000000000;hb=628d762fbfd512aedde6f313f66594291dad4eb1;hpb=e240e074ce15c17d644e378067c2941aefcd5611 diff --git a/examples/grep.cpp b/examples/grep.cpp new file mode 100644 index 0000000..c87ee72 --- /dev/null +++ b/examples/grep.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +using namespace std; +using namespace Msp; + +int main(int argc, char **argv) +{ + bool debug = false; + GetOpt getopt; + getopt.add_option('d', "debug", debug, GetOpt::NO_ARG); + getopt(argc, argv); + + const vector &args = getopt.get_args(); + + if(args.empty()) + { + cerr<<"Usage: "<\n"; + return 1; + } + + Regex regex(args[0]); + if(debug) + cout<