Ejemplo n.º 1
0
void ListEngine::connectDownloader()
{
    connect(this, SIGNAL(download(QUrl,QUrl)), m_parent->downloader(), SLOT(download(QUrl,QUrl)));
    connect(m_parent->downloader(), SIGNAL(downloadComplete(QUrl,QUrl)), this, SLOT(downloadComplete(QUrl,QUrl)));
    connect(this, SIGNAL(listDir(QUrl)), m_parent->downloader(), SLOT(listDir(QUrl)));
    connect(m_parent->downloader(), SIGNAL(listingComplete(QUrl)), this, SLOT(listingComplete(QUrl)));
}
Ejemplo n.º 2
0
void DatFile::listDir(uint32_t position, vector<uint32_t>& result) const
{
    vector<uint8_t> nodeData = readBlocks(position, sizeof(BTNode));
    BTNode* node = reinterpret_cast<BTNode*>(nodeData.data());

    if(node->numEntries > kMaxEntries)
    {
        throw runtime_error("Node has bad entry count");
    }

    for(uint32_t i = 0; i < node->numEntries; i++)
    {
        if(node->nextNode[0] != 0)
        {
            listDir(node->nextNode[i], result);
        }

        result.push_back(node->entries[i].id);
    }

    if(node->nextNode[0] != 0)
    {
        listDir(node->nextNode[node->numEntries], result);
    }
}
void pslSelfJobs(char *ooDir, char *conFile, char *finishCsh, char *logDir)
/* Scan ooDir and make up a condor file to produce
 * any missing self.psl files. */
{
struct slName *chromDir, *chrom;
struct slName *contigDir, *contig;
char fileName[512];
struct ctgInfo *ciList = NULL, *ci;
FILE *out = mustOpen(conFile, "w");
FILE *finish = mustOpen(finishCsh, "w");
char *chromName;
int len;

if (mkdir(logDir, 0775) < 0)
    {
    if (errno != EEXIST)
	{
	perror("");
	errAbort("Couldn't make log directory %s", logDir);
	}
    }

writeConHead(out, ooDir);
fprintf(out, 
	"arguments\t= geno.lst geno.lst genomic /var/tmp/hg/h/10.ooc self.psl");
fprintf(out, "\n");

chromDir = listDir(ooDir, "*");
for (chrom = chromDir; chrom != NULL; chrom = chrom->next)
    {
    chromName = chrom->name;
    len = strlen(chromName);
    if (len > 2) 
    	continue;
    sprintf(fileName, "%s/%s", ooDir, chromName);
    contigDir = listDir(fileName, "*");
    for (contig = contigDir; contig != NULL; contig = contig->next)
	{
	ci = getCtgInfo(ooDir, chrom->name, contig->name);
	slAddHead(&ciList, ci);
	}
    }

slSort(&ciList, ctgInfoCmp);
for (ci = ciList; ci != NULL; ci = ci->next)
    {
    sprintf(fileName, "%s/%s/%s/geno.lst",
	ooDir, ci->chrom, ci->contig);
    if (fileExists(fileName))
	{
	if (ci->cloneCount <= squareSize)
	    makeSelfJob(out, ooDir, ci->chrom, ci->contig, logDir);
	else
	    makeCompoundJob(finish, out, ci, ooDir, logDir);
	}
    }
fclose(out);
}
Ejemplo n.º 4
0
void listDir(struct fs_node* nodeDir,int level){
	int i = 0;
	struct dirent* node = 0;
	while ((node=readdir_fs(nodeDir,i))!=0){
		fs_node* fsnode = finddir_fs(nodeDir,node->name);
		for(int i = 0;i<level;i++) kprintf("   "); 
		if (fsnode != NULL){
			if ((fsnode->flags&0x7)==FS_DIRECTORY){
				kprintf("[%s]\n",trim(fsnode->name));
				
				if (fsnode->name[0]!='.')
					listDir(fsnode,level+1);
			}
			else if ((fsnode->flags&0x1)==FS_FILE){
				kprintf("%s\n",fsnode->name);
				char buf[256];
				kprintf("----\n");
				unsigned x = 0;
				while(1==1){
					unsigned int sz = read_fs(fsnode,0+x,256,buf);
					x+=256;
					if (sz != 0){
						for(unsigned int i = 0;i<sz;i++)
							kprint(buf[i]);
					}
					else break;
				}
				kprintf("\n----\n");
			}
			//kprintf("\n");
		}
		i++;
	}
}
Ejemplo n.º 5
0
static struct gbRelease* findReleases(struct gbIndex* index, int ncbiDb)
/* find release directories for the specified database (genbank or refseq) */
{
struct slName* dirList = NULL;
struct slName* dir;
char processedDir[PATH_LEN], dbPath[PATH_LEN];
struct gbRelease* releases = NULL;

safef(processedDir, sizeof(processedDir), "%s/%s", index->gbRoot,
      GB_PROCESSED_DIR);
if (ncbiDb == GB_GENBANK)
    strcpy(dbPath, "genbank");
else if (ncbiDb == GB_REFSEQ)
    strcpy(dbPath, "refseq");
strcat(dbPath, ".*");
dirList = listDir(processedDir, dbPath);
dir = dirList;
while (dir != NULL)
    {
    slSafeAddHead(&releases, gbReleaseNew(index, ncbiDb, dir->name));
    dir = dir->next;
    }
slFreeList(&dirList);

slSort(&releases, releaseCmp);
return releases;
}
Ejemplo n.º 6
0
void Runner::run()
{
	if((device.fd=open(device.filename.c_str(), O_RDONLY))==-1)
    {
    	std::cout <<"Cannot open device"<< std::endl;
    	return;
    }

	if(readBootEntry()==-1)		return;
	if(readFAT()==-1)			return;
	if(readDirEntry()==-1)		return;

	switch(action)
	{
		case PRINTBOOT:
			printFSinfo();
			break;
		case LISTDIR:
			listDir();
			break;
		case EIGHTPTHREE:
			eightPthree();
			break;
		case LONGFN:
			longFN();
			break;
		default:
			std::cout <<"what should I do?"<< std::endl;
	}

	close(device.fd);
}
Ejemplo n.º 7
0
//Add folder to playlist
void addFolder(char dir[], 
		struct playlist *play_list[], 
		int *max_item)
/*! \brief Adds all files in folder and subfolders to playlist recurcevely
 *
 * \param dir path to the directory to add
 * \param play_list array of pointers to playlist items
 * \param max_item the number of the last playlist item
 */
{
	int num, i;
	struct filelist *list[MAX_LIST];
	num = listDir(dir, list);
	for (i=0; i<=num; i++) {
		if ( list[i]->f_type == 'm' ) {
			if ((*max_item)<MAX_LIST-1) 
				(*max_item)++;
			else
				break;
			addFile(play_list, list, dir,*max_item,i);
		}

		if ( list[i]->f_type == 'd' ) {
			char tmp[MAX_FILE_NAME];
			strcpy(tmp,dir);
			strcat(tmp,list[i]->f_name);
			strcat(tmp,"/");
			addFolder(tmp, play_list, max_item);
		}
	}
}
Ejemplo n.º 8
0
static struct gbRelease* newestReleaseWithAligns(struct gbIndex* index,
                                                 char* database, unsigned srcDb)
/* find the newest release for srcDb that has alignements */
{
/* can't look at update objects, since they haven't been loaded */
struct gbRelease* release;
char alIdxPat[PATH_LEN];
safef(alIdxPat, sizeof(alIdxPat), "*.%s", ALIDX_EXT);

for (release = index->rels[gbSrcDbIdx(srcDb)]; release != NULL;
     release = release->next)
    {
    char relDir[PATH_LEN];
    struct slName* idxFiles;
    safef(relDir, sizeof(relDir), "%s/%s/%s/%s", GB_ALIGNED_DIR, release->name,
          database, GB_FULL_UPDATE);
    idxFiles = listDir(relDir, alIdxPat);
    if (idxFiles != NULL)
        {
        slFreeList(&idxFiles);
        verbose(1, "checking %s for %s\n", release->name, database);
        return release;
        }
    }
return NULL;
}
Ejemplo n.º 9
0
void listDir(std::vector<std::string>& filePathVec, char* path)
{
    DIR              *pDir ;   
    struct dirent    *ent  ;   
    int               i=0  ;   
    char              childpath[512];  

    pDir = opendir(path);  
    memset(childpath, 0, sizeof(childpath));

    while( (ent = readdir(pDir)) != NULL )
    {
        if(ent->d_type & DT_DIR)
        {   
            if(0 == strcmp(ent->d_name,".") || 0 == strcmp(ent->d_name,"..") )
                    continue;
            
            sprintf(childpath, "%s/%s", path, ent->d_name);
            //printf("path:%s\n", childpath);  
            
            listDir(filePathVec, childpath);
        }  
        else
        {   
            //std::cout<<ent->d_name<<std::endl;
            filePathVec.push_back(ent->d_name);
        }
    }
    closedir(pDir);
}
Ejemplo n.º 10
0
 std::vector<std::string> listFiles(const std::string& directory, bool recursive) {
     // create a vector to store the files
     std::vector<std::string> files;
     // create a vector to store the directories
     std::stack<std::string> directories;
     // adds the specified directory to the vector
     directories.push(directory);
     // loop through all the directories using a depth-first search
     while (!directories.empty()) {
         // retrieve the last directory in the vector, beginning with the initial directory
         auto directory = directories.top();
         // immediately remove the directory that was found
         directories.pop();
         // loop through every file within the directory
         for (auto&& file : listDir(directory)) {
             // specify the correct path within the directory
             auto path = directory + "/" + file;
             // check if the given path is a directory
             if (isDir(path)) {
                 // check if the function is recursive
                 if (recursive) {
                     // append the path to the directories vector
                     directories.push(path);
                 }
             }
             else {
                 // append the path to the paths vector
                 files.push_back(path);
             }
         }
     }
     // return the list of files
     return files;
 }
Ejemplo n.º 11
0
void TrashImpl::migrateOldTrash()
{
    kdDebug() << k_funcinfo << endl;
    const TQString oldTrashDir = TDEGlobalSettings::trashPath();
    const TQStrList entries = listDir( oldTrashDir );
    bool allOK = true;
    TQStrListIterator entryIt( entries );
    for (; entryIt.current(); ++entryIt) {
        TQString srcPath = TQFile::decodeName( *entryIt );
        if ( srcPath == "." || srcPath == ".." || srcPath == ".directory" )
            continue;
        srcPath.prepend( oldTrashDir ); // make absolute
        int trashId;
        TQString fileId;
        if ( !createInfo( srcPath, trashId, fileId ) ) {
            kdWarning() << "Trash migration: failed to create info for " << srcPath << endl;
            allOK = false;
        } else {
            bool ok = moveToTrash( srcPath, trashId, fileId );
            if ( !ok ) {
                (void)deleteInfo( trashId, fileId );
                kdWarning() << "Trash migration: failed to create info for " << srcPath << endl;
                allOK = false;
            } else {
                kdDebug() << "Trash migration: moved " << srcPath << endl;
            }
        }
    }
    if ( allOK ) {
        // We need to remove the old one, otherwise the desktop will have two trashcans...
        kdDebug() << "Trash migration: all OK, removing old trash directory" << endl;
        synchronousDel( oldTrashDir, false, true );
    }
}
void testDirListEmpty(RTTEST hTest)
{
    VBOXHGCMSVCFNTABLE  svcTable;
    VBOXHGCMSVCHELPERS  svcHelpers;
    SHFLROOT Root;
    PRTDIR pcDir = (PRTDIR)0x10000;
    SHFLHANDLE Handle;
    SHFLDIRINFO DirInfo;
    uint32_t cFiles;
    int rc;

    RTTestSub(hTest, "List empty directory");
    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                   "/test/mapping", "testname");
    testRTDirOpenpDir = pcDir;
    rc = createFile(&svcTable, Root, "test/dir",
                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
    RTTEST_CHECK_RC_OK(hTest, rc);
    rc = listDir(&svcTable, Root, Handle, 0, sizeof (SHFLDIRINFO), NULL,
                 &DirInfo, sizeof(DirInfo), 0, &cFiles);
    RTTEST_CHECK_RC(hTest, rc, VERR_NO_MORE_FILES);
    RTTEST_CHECK_MSG(hTest, testRTDirReadExDir == pcDir,
                     (hTest, "Dir=%llu\n", LLUIFY(testRTDirReadExDir)));
    RTTEST_CHECK_MSG(hTest, cFiles == 0,
                     (hTest, "cFiles=%llu\n", LLUIFY(cFiles)));
    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    RTTestGuardedFree(hTest, svcTable.pvService);
    RTTEST_CHECK_MSG(hTest,
                     testRTDirClosepDir == pcDir,
                     (hTest, "pDir=%llu\n", LLUIFY(testRTDirClosepDir)));
}
Ejemplo n.º 13
0
void qaDirs(char *qaDir, char *faDir)
/* check that all the files in faDir have quality
 * files in faDir. */
{
char qaName[512];
char faName[512];
char cloneName[512];
int ix = 0;
struct slName *el, *list;
struct qaSeq *qaList;

printf("Comparing %s and %s\n", qaDir, faDir);
list = listDir(faDir, "*.fa");
for (el = list; el != NULL; el = el->next)
    {
    strcpy(cloneName, el->name);
    chopSuffix(cloneName);
    sprintf(qaName, "%s/%s.qa", qaDir, cloneName);
    sprintf(faName, "%s/%s.fa", faDir, cloneName);
    if (!fileExists(qaName))
        warn("%s doesn't exist", qaName);
    qaList = qaReadBoth(qaName, faName);
    qaSeqFreeList(&qaList);
    if ((++ix & 0x3f) == 0)
          {
	  printf(".");
	  fflush(stdout);
	  }
    }
printf("\n");
}
Ejemplo n.º 14
0
int main(int argc,char *argv[])
//int main()
{

//	listDir("/home");
	listDir(argv[1]);
	return 0;
}
nsresult nsAbMDBDirectory::RemoveCardFromAddressList(nsIAbCard* card)
{
  nsresult rv = NS_OK;
  uint32_t listTotal;
  int32_t i, j;

  // These checks ensure we don't run into null pointers
  // as we did when we caused bug 280463.
  if (!mDatabase)
  {
    rv = GetAbDatabase();
    NS_ENSURE_SUCCESS(rv, rv);
  }

  if (!m_AddressList)
  {
    rv = mDatabase->GetMailingListsFromDB(this);
    NS_ENSURE_SUCCESS(rv, rv);

    // If the previous call didn't gives us an m_AddressList (and succeeded)
    // then we haven't got any mailing lists to try and remove the card from.
    // So just return without doing anything
    if (!m_AddressList)
      return NS_OK;
  }

  rv = m_AddressList->GetLength(&listTotal);
  NS_ENSURE_SUCCESS(rv,rv);

  for (i = listTotal - 1; i >= 0; i--)
  {
    nsCOMPtr<nsIAbDirectory> listDir(do_QueryElementAt(m_AddressList, i, &rv));
    if (listDir)
    {
      // First remove the instance in the database
      mDatabase->DeleteCardFromMailList(listDir, card, false);

      // Now remove the instance in any lists we hold.
      nsCOMPtr<nsIMutableArray> pAddressLists;
      listDir->GetAddressLists(getter_AddRefs(pAddressLists));
      if (pAddressLists)
      {  
        uint32_t total;
        rv = pAddressLists->GetLength(&total);
        for (j = total - 1; j >= 0; j--)
        {
          nsCOMPtr<nsIAbCard> cardInList(do_QueryElementAt(pAddressLists, j, &rv));
          bool equals;
          rv = cardInList->Equals(card, &equals);  // should we checking email?
          if (NS_SUCCEEDED(rv) && equals)
            pAddressLists->RemoveElementAt(j);
        }
      }
    }
  }
  return NS_OK;
}
void checkOut(char *dir)
/* Check out - check directory to make sure it has
 * a .out file for each .fa file, and that .out file
 * is non-empty. */
{
char outName[512];
struct slName *outList, *outEl, *faList, *faEl;
struct hash *outHash = newHash(16);
boolean missingAny = FALSE, zeroAny = FALSE;

printf("Listing *.fa.out\n");
outList = listDir(dir, "*.fa.out");
for (outEl = outList; outEl != NULL; outEl = outEl->next)
    hashAdd(outHash, outEl->name, NULL);
printf("Listing *.fa\n");
faList = listDir(dir, "*.fa");
printf("Missing .out\n");
for (faEl = faList; faEl != NULL; faEl = faEl->next)
    {
    sprintf(outName, "%s.out", faEl->name);
    if (!hashLookup(outHash, outName))
	{
	printf("%s\n", faEl->name);
	missingAny = TRUE;
	}
    }
if (!missingAny)
    printf("  none\n");
printf("Zero size .out\n");
for (outEl = outList; outEl != NULL; outEl = outEl->next)
    {
    long size;
    sprintf(outName, "%s/%s", dir, outEl->name);
    size = fileSize(outName);
    if (size <= 0)
	{
	printf("%s\n", outEl->name);
	zeroAny = TRUE;
	}
    }
if (!zeroAny)
    printf("  none\n");
}
Ejemplo n.º 17
0
void caller(){
    char buffer[BUFFER];
    char currWDir[BUFFER];
    int err;
    char *token;
    token = strtok(buffer," \t");


    while(1){
        bzero(buffer, BUFFER);
        prompt();
        fgets(buffer, BUFFER, stdin);

        if(compare(buffer, "cd") == 0){
            token = strchr(buffer,' ');
            
            if(token != NULL){
                token += 1;
                *strchr(token,'\n')='\0';
                 // printf("here\n");
                changeDir(token);
            }else{
                chdir("/home");
            }
        }else if(compare(buffer,"mkdir") == 0){
            makeDir(buffer);
        }else if(compare(buffer,"pwd") == 0){
            getcwd(currWDir, BUFFER);
            printf("%s\n", currWDir);
        }else if(compare(buffer,"rmdir") == 0){
            remDir(buffer);
        }else if(compare(buffer,"ls") == 0){
            token = strtok(buffer," \t");
            char *token2 = strtok(NULL," \t");
            if(token2 == NULL){
                listDir();
            }else if(compare(token2, "-l") == 0){
                listDirL();
            }else{
                printf("Command not recognized!\n");
            }
        }else if(compare(buffer, "exit") == 0){
            exit(0);
        }else if(compare(buffer, "cp") == 0){
            token = strtok(buffer," \t");
            char *src = strtok(NULL," \t");
            char *dest = strtok(NULL," \t");
            copy(src, dest);
        }else{
            exec(buffer);
            exit(1);
        }
    }
}
Ejemplo n.º 18
0
QStringList Common::listDir(QString path, QString suffix)
{
	QStringList list;
	QDir d(path);
	QStringList files = d.entryList(QStringList() << QString("*.%1").arg(suffix)
									, QDir::NoDotAndDotDot | QDir::Files, QDir::Name);
	foreach (QString f, files)
		list << path + "/" + f;
	QStringList subdirs = d.entryList(QDir::NoDotAndDotDot | QDir::Dirs, QDir::Name);
	foreach (QString s, subdirs)
		list << listDir(d.filePath(s), suffix);
	return list;
}
Ejemplo n.º 19
0
void processSlices(struct hash *mahoneyHash, 
	char *inFull, char *outDir)
/* Output database files for slices. */
{
struct slName *imageFileList = NULL, *imageFile;
char outRa[PATH_LEN], outTab[PATH_LEN];

imageFileList = listDir(inFull, "*.jpg");
safef(outRa, sizeof(outRa), "%s/slices.ra", outDir);
slicesRa(outRa);
safef(outTab, sizeof(outRa), "%s/slices.tab", outDir);
slicesTab(imageFileList, inFull, mahoneyHash, outTab);
}
Ejemplo n.º 20
0
void CommandDir::listDirRecursive(const MyString& path, VirtualDiskNode* vfs, bool only_dir /*= false*/)
{
    _tprintf(_T(" %s 的目录\n\n"), path.c_str());
    listDir(path, vfs, only_dir);
    DirHandler dir_handler = vfs->openDir(path);
    for (DirIterator iter = dir_handler.getIterator(); !iter.isDone(); iter.next())
    {
        state s = iter.getItem();
        if (s.type == DIR_TYPE && !s.name.startWith(_T(".")))
        {
            listDirRecursive(s.path, vfs, only_dir);
        }
    }
}
Ejemplo n.º 21
0
void cleanupLocks(char *lockDir)
/* Remove all locks. */
{
struct slName *dir = listDir(lockDir, "*");
char name[512];
struct slName *one;

for (one = dir; one != NULL; one = one->next)
    {
    sprintf(name, "%s/%s", lockDir, one->name);
    remove(name);
    }
rmdir(lockDir);
}
Ejemplo n.º 22
0
QStringList TCleanConfig::listDir(const QString& path) {

	QDir dir(path);
	QStringList file_list;

    foreach(const QString file, dir.entryList(QDir::Files)) {
		file_list << QFileInfo(dir, file).absoluteFilePath();
	}

    foreach(const QString sub_dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
		file_list << listDir(path +"/"+ sub_dir);
	}

	return file_list;
}
Ejemplo n.º 23
0
list loadWeizmann( bool train, bool test, int n_train ) {
	std::vector< std::string > file_names = listDir( weizmann_dir+"/rgb/" );
	std::sort( file_names.begin(), file_names.end() );

	std::mt19937 rand;
	for( int i=1; i<(int)file_names.size(); i++ )
		std::swap( file_names[i], file_names[rand()%(i+1)] );

	list r;
	for( int i=train?0:n_train; (test || i<n_train) && i<file_names.size(); i++ ) {
		dict d = loadEntry( file_names[i] );
		if( len(d) )
			r.append( d );
	}
	return r;
}
Ejemplo n.º 24
0
int main(int argc, char * argv[])
{
    //printf("argc = %d\n", argc);
    if(argc != 2)
        return argc;
    std::string workspace = argv[1];
    if(workspace[workspace.size() - 1] != '/')
        workspace += "/";
    std::string src = workspace + "src/java/com/Control/";
    des = workspace + "test/com/Control/";
    std::cout << workspace << std::endl;
    std::cout << src << std::endl;
    std::cout << des << std::endl;
    listDir(src.c_str());
    return 0;
}
Ejemplo n.º 25
0
void CommandDir::exec(VirtualDiskNode* vfs)
{
    if (!vfs)
    {
        assert(0);
        return;
    }
    
    if (m_pathes.isEmpty())
    {
        m_pathes.append(vfs->pwd());
    }

    for (int i = 0; i < m_pathes.size(); ++i)
    {
        MyString path = m_pathes[i];
        if (!isNormalizedPath(path))
        {
            path = vfs->pathNormalize(path);
        }
        path = path.toLower();
        if (!vfs->isExist(path))
        {
            throw CommandException(_T("系统找不到指定路径\n"));
        }
        if (vfs->isFile(path))
        {
            FileHandler file_handler = vfs->openFile(path);
            state s = file_handler.stat();
            displayState(s, false);
            _tprintf(_T("%15d 个文件%14d 字节\n"), 1, s.size);
            _tprintf(_T("%15d 个目录\n"), 0);
        }
        if (vfs->isDir(path))
        {
            if (m_recursive)
            {
                listDirRecursive(path, vfs, m_only_dir);
            }
            else
            {
                listDir(path, vfs, m_only_dir);
            }
        }
    }
    return;
}
Ejemplo n.º 26
0
void checkDownloadOrphans(char *downDir, char *composite, struct hash *allDownloadNames)
/* check for orphans in the download directory. */
{
verbose(1, "-----------------------------------------------------------------\n");
verbose(1, "Checking that wgEncode* files in the download dir exist in metaDb\n");
verbose(1, "-----------------------------------------------------------------\n");
char buffer[10 * 1024];
safef(buffer, sizeof buffer, "%s", downDir);
struct slName *list = listDir(buffer, "wgEncode*"), *el;
for(el=list;el;el=el->next)
    {
    if (!hashLookup(allDownloadNames, el->name))
	{
	warn("orphan download file %s/%s not found in metaDb\n", buffer, el->name);
	}
    }
}
Ejemplo n.º 27
0
void showAllNts()
/* Creat a form that lets user select an NT
 * layout to examine. */
{
struct slName *ntList, *ntEl;
printf("<H1>Check Layout</H1>\n");
printf("<H3>Click on a link below to see finished vs. unfinished alignments</H3>\n");
printf("<PRE>");
ntList = listDir(indexDir, "NT*.index");
for (ntEl = ntList; ntEl != NULL; ntEl = ntEl->next)
    {
    char *root = ntEl->name;
    char *s = strrchr(root, '.');
    *s = 0;
    printf("<A HREF=\"../cgi-bin/checkLayout?NT=%s\">%s</A>\n", root, root);
    }
}
void motifSig(char *outName, char *seqDir, char *motifDir, 
	int controlCount, char *controls[])
/* motifSig - Combine info from multiple control runs and main improbizer run. */
{
FILE *f = mustOpen(outName, "w");
struct slName *mfList = listDir(motifDir, "*"), *mf;
struct improbRunInfo *iriList = NULL,  *iriSmallList = NULL, *iri;

for (mf = mfList; mf != NULL; mf = mf->next)
    {
    iriSmallList = analyseOneMotifRun(mf->name, seqDir, motifDir, controlCount, controls);
    iriList = slCat(iriList, iriSmallList);
    }
for (iri = iriList; iri != NULL; iri = iri->next)
    improbRunInfoTabOut(iri, f);
carefulClose(&f);
}
Ejemplo n.º 29
0
int MainWindow::checkXmlFolder( const QString &s_XmlPath, const int n )
{
    bool        b_hasXsd = false;

    QStringList sl_FilenameList;
    QStringList sl_baseNames;

// **********************************************************************************************

    listDir( sl_FilenameList, s_XmlPath, false );

    if ( sl_FilenameList.count() != 2*n+1 )
    {
        QMessageBox::critical( this, getApplicationName( true ), tr( "Number of files is wrong" ) );
        return( -60 );
    }
    else
    {
        for ( int i=0; i<2*n+1; i++ )
        {
            QFileInfo fi( sl_FilenameList.at( i ) );

            if ( fi.fileName() != "article-doi_v3.2.xsd" )
                sl_baseNames.append( fi.completeBaseName() );
            else
                b_hasXsd = true;
        }

        if ( b_hasXsd == false )
        {
            QMessageBox::critical( this, getApplicationName( true ), tr( "File article-doi_v3.2.xsd is missing" ) );
            return( -60 );
        }

        for ( int i=0; i<2*n; i++ )
        {
            if ( sl_baseNames.count( sl_baseNames.at( i ) ) != 2 )
            {
                QMessageBox::critical( this, getApplicationName( true ), tr( "File name is wrong. Please check\n\n  " ).append( sl_baseNames.at( i ) ).append( tr( ".*" ) ) );
                return( -60 );
            }
        }
    }

    return( _NOERROR_ );
}
Ejemplo n.º 30
0
// sends the listing of the directory - data part
void d_list(char **params, short *abor, int fd,
	struct state *cstate, struct config *configuration) {
	int accepted, retcode, subn, r;
	char buf[BUFSIZE], dir[32], path[128], tmp[2 * BUFSIZE];

	// accept connection / connect to the client
	if (spawnConnection(cstate, &accepted)) {
		retcode = 5;
		write(fd, &retcode, sizeof (int));
		return;
	}
	// read path to dir from the control thread
	readUntil(dir, fd, 0, 32);
	// join the path
	if (getFullPath(path, cstate, configuration, dir) == -1) {
		retcode = 5;
		write(fd, &retcode, sizeof (int));
		close(accepted);
		return;
	}
	// loads the listing of the directory
	// determined by path to string pointed to by buf
	listDir(path, buf);
	// sends the list in ASCII mode
	r = strlen(buf);
	// converts \n to \r\n sequence,
	// return how much is the result longer
	if ((subn = im2as(tmp, buf, BUFSIZE)) == -1) {
		retcode = 5;
		write(fd, &retcode, sizeof (int));
		close(accepted);
		return;
	}
	r += subn;
	memcpy(buf, tmp, BUFSIZE * 2);
	if (write(accepted, buf, r) == -1) {
		retcode = 5;
		write(fd, &retcode, sizeof (int));
		close(accepted);
		return;
	}
	close(accepted);
	// report the result
	retcode = 2;
	write(fd, &retcode, sizeof (int));
}