]> git.tdb.fi Git - libs/core.git/blobdiff - grep.cpp
Move files around to prepare for assimilation into core
[libs/core.git] / grep.cpp
index eaf1663e7cf1098b42aabd4b9dc454b5f09f61e6..68ecf874f46b919306c703f5e6fc07c2af4b5249 100644 (file)
--- a/grep.cpp
+++ b/grep.cpp
@@ -2,19 +2,19 @@
 #include <iostream>
 #include <string>
 #include <msp/core/getopt.h>
-#include "regex.h"
+#include <msp/strings/regex.h>
 
 using namespace std;
 using namespace Msp;
 
 int main(int argc, char **argv)
 {
-       bool debug=false;
+       bool debug = false;
        GetOpt getopt;
        getopt.add_option('d', "debug", debug, GetOpt::NO_ARG);
        getopt(argc, argv);
 
-       const list<string> &args=getopt.get_args();
+       const vector<string> &args = getopt.get_args();
 
        if(args.empty())
        {
@@ -22,13 +22,13 @@ int main(int argc, char **argv)
                return 1;
        }
 
-       Regex regex(argv[1]);
+       Regex regex(args[0]);
        if(debug)
                cout<<regex.disassemble();
        string line;
        while(getline(cin, line))
        {
-               if(RegMatch match=regex.match(line))
+               if(RegMatch match = regex.match(line))
                        cout<<line<<'\n';
        }