예제 #1
0
int
expand_wildcard(char *path, int initiate)
{
#if SYS_MSDOS || SYS_OS2
    static DeclareFind(p);
    static char temp[FILENAME_MAX + 1];
    register char *leaf;

    if ((leaf = strchr(path, '/')) == 0
	&& (leaf = strchr(path, '\\')) == 0)
	leaf = path;
    else
	leaf++;

    if ((initiate && DirFindFirst(strcpy(temp, path), p))
	|| DirFindNext(p)) {
	(void) strcpy(leaf, DirEntryStr(p));
	return TRUE;
    }
#endif /* SYS_MSDOS || SYS_OS2 */
#if SYS_VMS
    static struct FAB zfab;
    static struct NAM znam;
    static char my_esa[NAM$C_MAXRSS];	/* expanded: SYS$PARSE */
    static char my_rsa[NAM$C_MAXRSS];	/* expanded: SYS$SEARCH */

    if (initiate) {
	zfab = cc$rms_fab;
	zfab.fab$l_fop = FAB$M_NAM;
	zfab.fab$l_nam = &znam;	/* FAB => NAM block     */
	zfab.fab$l_dna = "*.*;";	/* Default-selection    */
	zfab.fab$b_dns = strlen(zfab.fab$l_dna);

	zfab.fab$l_fna = path;
	zfab.fab$b_fns = strlen(path);

	znam = cc$rms_nam;
	znam.nam$b_ess = sizeof(my_esa);
	znam.nam$l_esa = my_esa;
	znam.nam$b_rss = sizeof(my_rsa);
	znam.nam$l_rsa = my_rsa;

	if (sys$parse(&zfab) != RMS$_NORMAL) {
	    perror(path);
	    exit(EXIT_FAILURE);
	}
    }
    if (sys$search(&zfab) == RMS$_NORMAL) {
	strncpy(path, my_rsa, znam.nam$b_rsl)[znam.nam$b_rsl] = '\0';
	return (TRUE);
    }
#endif /* SYS_VMS */
#if SYS_MSDOS
#endif
    return FALSE;
}
예제 #2
0
int DirFindFirst (FileInfo *pFile)
{
	dirFirstFlag = 1;
	dirDirsFlag = 1;

	if (!strcmp(pDirCmmdrPath, "/")) {
		return DirFindNext (pFile);
	}
	else {
		strcpy (pFile->pName, "(Parent Dir)/"); 
		pFile->type = 4; pFile->size = 0;
	}
	return 1;
}