diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-03 20:45:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-03 20:45:14 -0700 |
commit | 6d943605ad7c5989716a3f9c05392f1394980a05 (patch) | |
tree | 20be4a7ca60de0e9fb6d30d492d56be25165ec4b /cpp/tangle/030tangle.cc | |
parent | 844697c2ab154509cb8fa876bf6094c948caf817 (diff) | |
download | mu-6d943605ad7c5989716a3f9c05392f1394980a05.tar.gz |
1014 - reorganize build system to prepare for .mu layers
Diffstat (limited to 'cpp/tangle/030tangle.cc')
-rw-r--r-- | cpp/tangle/030tangle.cc | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/cpp/tangle/030tangle.cc b/cpp/tangle/030tangle.cc index 52bf4c61..ec34c944 100644 --- a/cpp/tangle/030tangle.cc +++ b/cpp/tangle/030tangle.cc @@ -1,12 +1,9 @@ #include<sys/param.h> -int tangle_files_in_cwd() { +int tangle(int argc, const char* argv[]) { list<string> result; - vector<char*> files = sorted_files(".", /*no extension*/ ""); - for (vector<char*>::iterator p = files.begin(); p != files.end(); ++p) { - if ((*p)[0] < '0' || (*p)[0] > '9') continue; - if (!Last_file.empty() && *p > Last_file) break; - ifstream in(*p); + for (int i = 1; i < argc; ++i) { + ifstream in(argv[i]); tangle(in, result); } for (list<string>::iterator p = result.begin(); p != result.end(); ++p) @@ -367,23 +364,3 @@ string trim(const string& s) { ++last; return string(first, last); } - -#include<dirent.h> - -vector<char*> sorted_files(const char* dirname, const char* ext) { - vector<char*> result; - dirent** files; - int num_files = scandir(dirname, &files, NULL, alphasort); - for (int i = 0; i < num_files; ++i) { - unsigned long n = strlen(files[i]->d_name), extn = strlen(ext); - if (n < extn) continue; - if (strncmp(&files[i]->d_name[n-extn], ext, extn)) continue; - if (!isdigit(files[i]->d_name[0])) continue; - char* s = new char[n+1]; - strncpy(s, files[i]->d_name, n+1); - result.push_back(s); - free(files[i]); - } - free(files); - return result; -} |