예제 #1
0
파일: axpbysrch.c 프로젝트: AIDman/Kaldi
void GoToTown(char pre)
{
   FILENODE *fptr, **bp;
   int n, *ix, *iy, *ia, *ib;

   fptr = GetSumm(pre, &n, &ix, &iy, &ia, &ib, &bp);
   if (!fptr)
   {
      DoIt(pre);
      fptr = GetSumm(pre, &n, &ix, &iy, &ia, &ib, &bp);
      assert(fptr);
   }
   fprintf(stdout, "%d:\n", __LINE__);
   PrintTable(n, ix, iy, ia, ib, bp);
   GenFiles(pre, n, ix, iy, ia, ib, bp);

   KillAllFN(fptr);
   free(bp);
   free(ix);
}
예제 #2
0
파일: gen.cpp 프로젝트: pazuzu156/shark
void GenFiles(std::string root, std::string dir, std::string pkg, std::string prefix)
{
	std::cout << "GEN FILES\n";
	std::stringstream dirname;
	dirname << dir << prefix;
	DIR* dirs = opendir(dirname.str().c_str());
	struct dirent* file;
	if(dirs == NULL)
	{
		std::cout << "Error: dir " << dirname.str() << " does not exist\n";
		return;
	}
	while((file = readdir(dirs)))
	{
		std::string name = file->d_name;
		if(file->d_type != DT_DIR)
		{
			//std::cout << "DIR:" <<  file->d_name << std::endl;
			//std::string name = file->d_name;
			if(name != "." && name != "..")
			{
				std::stringstream cmd;
				cmd << "echo \"" << prefix << name << "\" >> files";
				std::cout << cmd.str() << std::endl;
				system(cmd.str().c_str());
				//std::stringstream newpre;
				//newpre << prefix << name << "/";
				//GenLinks(root, dir, pkg, newpre.str().c_str());	
			}
		}
		else
		{
			if(name != "." && name != "..")
			{
				std::stringstream newpre;
				newpre << prefix << file->d_name << "/";
				GenFiles(root, dir, pkg, newpre.str());
			}
		}
	}
}