X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=examples%2Fgrep.cpp;h=ca23499a2165480d1f705d5a58a9a3f40aac914a;hp=c87ee72171615ec8056adcf687f8f0e74d78b621;hb=7be37ad97a2fd3494cb5d56badb45997353ff709;hpb=628d762fbfd512aedde6f313f66594291dad4eb1 diff --git a/examples/grep.cpp b/examples/grep.cpp index c87ee72..ca23499 100644 --- a/examples/grep.cpp +++ b/examples/grep.cpp @@ -9,26 +9,20 @@ using namespace Msp; int main(int argc, char **argv) { bool debug = false; + string re_str; GetOpt getopt; getopt.add_option('d', "debug", debug, GetOpt::NO_ARG); + getopt.add_argument("regex", re_str, GetOpt::REQUIRED_ARG); getopt(argc, argv); - const vector &args = getopt.get_args(); - - if(args.empty()) - { - cerr<<"Usage: "<\n"; - return 1; - } - - Regex regex(args[0]); + Regex regex(re_str); if(debug) - cout<