Functions | |
std::string | fname2idxname (const std::string &fname) |
std::string | itoa (int i) |
std::vector< std::string > | wildcard_correct (const std::vector< std::string > &fnames) |
std::vector< std::string > | wildcard_correct (const std::string &fname) |
|
00070 { 00071 std::string::size_type pathend = fname.rfind('/', fname.length()); 00072 std::string idxname = (pathend != std::string::npos ) ? fname.substr(pathend+1) : fname; 00073 00074 idxname += ".idx"; 00075 00076 return idxname; 00077 }
|
|
00080 { 00081 std::stringstream sstr; 00082 sstr << i; 00083 00084 std::string str; 00085 sstr >> str; 00086 00087 while ( str.length() < 3 ) { 00088 str = std::string("0") + str; 00089 } 00090 00091 return str; 00092 }
|
|
00035 { 00036 static char pbuf[8192]; 00037 static const std::string lsCom("/bin/ls "); 00038 00039 std::vector<std::string> newfnames; 00040 std::string fname; 00041 std::stringstream fnstream; 00042 std::vector<std::string>::const_iterator it = fnames.begin(); 00043 00044 while ( it != fnames.end() ) { 00045 if ( ( it->find('*', 0) != std::string::npos ) || 00046 ( it->find('?', 0) != std::string::npos ) ) { 00047 // list and get the wildcard files 00048 std::string com = lsCom + (*it); 00049 FILE* ftmp = popen(com.c_str(), "r"); 00050 00051 fnstream.clear(); 00052 while ( fgets(pbuf, 8192, ftmp) != NULL ) { 00053 fnstream << pbuf; 00054 } 00055 00056 while ( ! (fnstream>>fname).eof() ) { 00057 newfnames.push_back(fname); 00058 } 00059 } 00060 else { 00061 newfnames.push_back(*it); 00062 } 00063 ++it; 00064 } 00065 00066 return newfnames; 00067 }
|
|
00006 { 00007 static char pbuf[8192]; 00008 static const std::string lsCom("/bin/ls "); 00009 00010 std::vector<std::string> newfnames; 00011 00012 if ( ( fname.find('*', 0) != std::string::npos ) || 00013 ( fname.find('?', 0) != std::string::npos ) ) 00014 { 00015 FILE* ftmp = popen((lsCom+fname).c_str(), "r"); 00016 00017 std::stringstream fnstream; 00018 while ( fgets(pbuf, 8192, ftmp) != NULL ) { 00019 fnstream << pbuf; 00020 } 00021 00022 std::string tfn; 00023 while ( ! (fnstream>>tfn).eof() ) { 00024 newfnames.push_back(tfn); 00025 } 00026 } 00027 else { 00028 newfnames.push_back(fname); 00029 } 00030 00031 return newfnames; 00032 }
|