commit | 284f3d1e604ebf568178e04e6a1fa4a66675547f | [log] [tgz] |
---|---|---|
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | Wed Jun 17 19:29:01 2015 +0900 |
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | Thu Jun 18 11:25:45 2015 +0900 |
tree | 015631ed32c3ce8dce8d072fc88b8197dcee8bb5 | |
parent | 30b8e60d2c6871d3fa501262c0ea347a8d337bb6 [diff] [blame] |
[C++] Implement wildcard
diff --git a/func.cc b/func.cc index 2fd95ae..64702ea 100644 --- a/func.cc +++ b/func.cc
@@ -216,7 +216,13 @@ } void WildcardFunc(const vector<Value*>&, Evaluator*, string*) { - printf("TODO(wildcard)"); + shared_ptr<string> pat = args[0]->Eval(ev); + for (StringPiece tok : WordScanner(*pat)) { + char orig = tok[tok.size()]; + tok[tok.size()] = '\0'; + glob(tok.data()); + tok[tok.size()] = orig; + } } void DirFunc(const vector<Value*>&, Evaluator*, string*) {