X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=grep.cpp;fp=grep.cpp;h=eaf1663e7cf1098b42aabd4b9dc454b5f09f61e6;hp=8c369a56f0c2fb3834c9d3ba5b0eed998ed92e67;hb=df1a66180655104af15f9bb6067b4eaa1421f5ff;hpb=c88a239ff3b218ad0226e8c53356350ccc1f7014 diff --git a/grep.cpp b/grep.cpp index 8c369a5..eaf1663 100644 --- a/grep.cpp +++ b/grep.cpp @@ -1,6 +1,7 @@ /* $Id$ */ #include #include +#include #include "regex.h" using namespace std; @@ -8,21 +9,27 @@ using namespace Msp; int main(int argc, char **argv) { - if(argc<2) + bool debug=false; + GetOpt getopt; + getopt.add_option('d', "debug", debug, GetOpt::NO_ARG); + getopt(argc, argv); + + const list &args=getopt.get_args(); + + if(args.empty()) { cerr<<"Usage: "<\n"; return 1; } Regex regex(argv[1]); - cout<