dfadir.cpp

来自「一个类似STL的自动机的源代码库」· C++ 代码 · 共 43 行

CPP
43
字号
#include <astl.h>#include <dir_cursor.h>#include <tools.h>#include <stream.h>#include <iostream>#include <string>#include <algorithm>#include <cstdio>         // perror#include <sys/types.h>    // opendir#include <dirent.h>using namespace std;const string USAGE = "[dir]";const string DESCRIPTION = "build a DFA from a directory tree\n   \dir\troot directory (initial state)";int main(int argc, char **argv){  config c(argc, argv, 0, "", USAGE, DESCRIPTION);  if (find(c.begin(), c.end(), "-h") != c.end())    c.usage();  string root = ".";  if (c.arg_pos < argc) root = argv[c.arg_pos];  DIR *just_testing = opendir(root.c_str());  if (just_testing == NULL) {    string error_msg = string(argv[0]) + ": " + root;    perror(error_msg.c_str());    exit(2);  }  closedir(just_testing);  DFA_stream out(cout);  if (c.state_mark)    clone(out, dfirst_markc(directoryc(root)));  else    clone(out, dfirstc(directoryc(root)));  return 0;}      

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?