diff options
-rw-r--r-- | enumerate/enumerate.cc | 17 | ||||
-rw-r--r-- | enumerate/makefile | 2 | ||||
-rw-r--r-- | makefile | 2 |
3 files changed, 6 insertions, 15 deletions
diff --git a/enumerate/enumerate.cc b/enumerate/enumerate.cc index 58497909..2777c407 100644 --- a/enumerate/enumerate.cc +++ b/enumerate/enumerate.cc @@ -1,3 +1,4 @@ +#include<assert.h> #include<cstdlib> #include<dirent.h> #include<vector> @@ -7,14 +8,11 @@ using std::string; #include<iostream> using std::cout; -int enumerate_files_in_cwd_until(string last_file); -string flag_value(const string& flag, int argc, const char* argv[]); - int main(int argc, const char* argv[]) { - return enumerate_files_in_cwd_until(flag_value("--until", argc, argv)); -} + assert(argc == 3); + assert(string(argv[1]) == "--until"); + string last_file(argv[2]); -int enumerate_files_in_cwd_until(string last_file) { dirent** files; int num_files = scandir(".", &files, NULL, alphasort); for (int i = 0; i < num_files; ++i) { @@ -26,10 +24,3 @@ int enumerate_files_in_cwd_until(string last_file) { // don't bother freeing files return 0; } - -string flag_value(const string& flag, int argc, const char* argv[]) { - for (int i = 1; i < argc-1; ++i) - if (string(argv[i]) == flag) - return argv[i+1]; - return ""; -} diff --git a/enumerate/makefile b/enumerate/makefile index b8760460..e1a06f63 100644 --- a/enumerate/makefile +++ b/enumerate/makefile @@ -1,4 +1,4 @@ -tangle: makefile +enumerate: makefile enumerate.cc c++ -O3 -Wall -Wextra -fno-strict-aliasing enumerate.cc -o enumerate clean: diff --git a/makefile b/makefile index cc8af389..5dd114c2 100644 --- a/makefile +++ b/makefile @@ -16,7 +16,7 @@ core.mu: [0-9]*.mu mu.cc cat $$(./enumerate/enumerate --until zzz |grep '.mu$$') > core.mu enumerate/enumerate: - cd enumerate && make && ./enumerate test + cd enumerate && make tangle/tangle: cd tangle && make && ./tangle test |