コード例 #1
0
ファイル: files.c プロジェクト: ErisBlastar/osfree
/*************************************
*
*  Search for a file in the given directory.
*
**************************************/
BOOL __far __pascal FindFile( char __far * szDir, char __far * szWildName, struct _find_t __far * FileInfo )
{
  char szFilesPath[_MAX_PATH];
  short int LastCharPos;

  /* First time through. */
  if( szDir != NULL )
  {
    /* Build full path for search directory and wild name of file. */
    _fstrcpy( szFilesPath, szDir );

    /* Is there already a dir. separator? */
    LastCharPos = ( _fstrlen( szFilesPath ) / sizeof(char) ) - 1;
    if( szFilesPath[LastCharPos] != DIR_CHAR_SEPARATOR )
    {
      _fstrcat( szFilesPath, DIR_STRING_SEPARATOR );
    }

    _fstrcat( szFilesPath, szWildName );
      
    if( !_dos_findfirst( szFilesPath, _A_NORMAL, FileInfo ) ) return TRUE;
  }

  /* No first time through. */
  else
  {
    if( !_dos_findnext( FileInfo ) ) return TRUE;
  }
  
  /* Failure. */
  return FALSE;
}
コード例 #2
0
ファイル: DU.C プロジェクト: OS2World/UTIL-DISK-DU-DF
unsigned long calc_dir(char *pathname)
{
  struct find_t  direntry;
  char apu[_MAX_PATH];
  int done;
  unsigned long sum=0;

  level++;
  strcpy(apu,pathname);
  strcat(apu,FILEMASK);
  done=_dos_findfirst(apu,_A_NORMAL+_A_RDONLY+_A_HIDDEN+_A_SYSTEM+
			  _A_SUBDIR+_A_ARCH,&direntry);
  while (!done) {
    sum+=direntry.size;
    if (direntry.size % cluster_size == 0) true_sum+=direntry.size;
     else true_sum+=cluster_size+direntry.size-(direntry.size%cluster_size);
    if (!(direntry.attrib&_A_SUBDIR)) file_counter++;
    if ((direntry.attrib  & _A_SUBDIR)&& (strcmp(direntry.name,".."))&&
	(strcmp(direntry.name,"."))) {
      strcpy(apu,pathname);
      strcat(apu,direntry.name);
      strcat(apu,"\\");
      sum+=calc_dir(apu);
    }
    done=_dos_findnext(&direntry);
  }
 if ((level<=sublevels+1)||(sublevels<=0)) printf("%7luk %s\n",sum/1024,pathname);
 level--;
 return sum;
}
コード例 #3
0
ファイル: LBMCOMP.C プロジェクト: NonCreature0714/descent
void main(int argc, char * argv[])	{
	int numfiles = 0;
 	struct find_t find;
	char * cp;
	char * cp1;

	setbuf(stdout, NULL);	// unbuffered output via printf

	argv++; argc--;
	for (;argc--;argv++)
	{
		if( !_dos_findfirst( *argv, 0xffff, &find ) )
		{
			dofile( find.name );
			numfiles++;
			while( !_dos_findnext( &find ) )	{
				numfiles++;
				dofile( find.name );
			}
	 	}
	}

	if ( numfiles < 1 )	{
		printf( "lbmcomp- this program compresses bbm files by removing\n");
		printf( "unused chunks. The command line is the file specs\n" );
		printf( "to convert. ie.. lbmcomp john*.bbm adam*.bbm\n\n" );
		exit(1);
	}


}
コード例 #4
0
ファイル: FILE.C プロジェクト: LesInk/Test
T_word32 FileGetSize(T_byte8 *p_filename)
{
    T_word32 size ;
#if defined(WIN32)
    FILE *fp;

    DebugRoutine("FileGetSize");
    fp = fopen(p_filename, "rb");
    size = filelength(fileno(fp));
    fclose(fp);
    DebugEnd() ;
#else
    struct find_t fileinfo ;

    DebugRoutine("FileGetSize") ;

    /* Get information about the file. */
    if (_dos_findfirst(p_filename, _A_NORMAL, &fileinfo) == 0)  {
        /* If we found the file, return the file size. */
        size = fileinfo.size ;
    } else {
        /* If we didn't find the file, return a zero. */
        size = 0 ;
    }

    DebugEnd() ;
#endif

    return size ;
}
コード例 #5
0
ファイル: attrib.c プロジェクト: ErisBlastar/osfree
LOCAL void PROC do_mask (char *pathend) {
        static struct find_t fi;

        adds (pathend, mask);
        if (_dos_findfirst (path, findattr, &fi))
                return;

        do {    const char *p;
                p = fi.name-1; do p++; while (*p == '.');
                if (*p == '\0') continue;               /* name == dots */

                adds (pathend, fi.name); found++;
            {   ATTR attr = attr2str (OLD_ATTR, fi.attrib);

                if (*NEW_PART != '\0') {
                    attr = (attr & attr_keep) | attr_set;
                    if (_dos_setfileattr (path,
                                          attr2str (NEW_ATTR, attr)
                                          & (ATTR)~_A_SUBDIR)) {
                        sayerror (E_ACCESS, "access denied", path);
                        continue;
            }   }    }

                say (info, path);
        } while (_dos_findnext (&fi) == 0);
}
コード例 #6
0
LPSTR DirectoryName(
/************************************************************************/
int 	iDirectory,
LPSTR 	lpName)
{
#ifdef WIN32

#else
int retc;
struct find_t dir;

retc = _dos_findfirst( "*.*", _A_SUBDIR, &dir );
while ( !retc )
	{
	if ( dir.attrib & _A_SUBDIR && dir.name[0] != '.' )
		{ // If this is a subdirectory
		if ( --iDirectory < 0 )
			{
			lstrcpy( lpName, dir.name );
			return( lpName );
			}
		}
	retc = _dos_findnext( &dir );
	}

#endif
return( NULL );
}
コード例 #7
0
ファイル: llstat.c プロジェクト: doniexun/OrangeC
int __ll_namedstat(const char *file, void *__statbuf)
{
    struct stat *sb = __statbuf;
    struct find_t finddata;
    if (!_dos_findfirst(file, 0x17, &finddata))
    {
      struct ftime *ft = &finddata.wr_time;
      int timex;
    struct tm tmx;
      tmx.tm_year = ft->ft_year +1980 - 1900;
      tmx.tm_mon = ft->ft_month-1 ;
      tmx.tm_mday = ft->ft_day ;
      tmx.tm_hour = ft->ft_hour ;
      tmx.tm_min = ft->ft_min ;
      tmx.tm_sec = 2 * ft->ft_tsec ;
      timex = mktime(&tmx) ;
      sb->st_atime = sb->st_mtime = sb->st_ctime = timex ;
      if (finddata.attrib & FA_DIREC)
        sb->st_mode = S_IFDIR;
      else 
          sb->st_mode = S_IFREG;
      sb->st_mode |= S_IREAD;
      if (!(finddata.attrib & FA_RDONLY))
          sb->st_mode |= S_IWRITE;
      sb->st_size = *(int *)(&finddata.size);
      return 0;
    }
    return -1;	
}
コード例 #8
0
LPSTR DriveName(
/************************************************************************/
int 	iDrive,
LPSTR 	lpName)
{
#ifdef WIN32

#else
STRING szString;
struct find_t vol;
WORD	wType;

lpName[0] = 'a' + iDrive;
lpName[1] = ':';
lpName[2] = '\0';
lstrcpy( szString, lpName );
lstrcat( szString, "\\*.*" ); /* wildcard search of root dir */

lstrcat( lpName, " [" );
wType = GetExtendedDriveType(iDrive);
if ( iDrive != CURRENTDRIVE &&
	(wType == DRIVE_REMOVABLE || wType == DRIVE_CDROM) )
	lstrcat( lpName, "unknown" );
else
	{
	if ( !_dos_findfirst( szString, _A_VOLID, &vol ) )
		lstrcat( lpName, RemoveDots(vol.name) );
	else	lstrcat( lpName, "unlabeled" );
	}
lstrcat( lpName, "]" );
#endif

return( lpName );
}
コード例 #9
0
int ReaDirArray(char *path)
{
      struct find_t ff;
      char pattern[67];
      struct DirEntry *base = &DirRoot;

      strcpy(pattern, path);
      if ('/' != LAST_CHAR(pattern) && '\\' != LAST_CHAR(pattern))
            strcat(pattern, "\\");
      strcat(pattern, "*.*");
      if (SUCCESS == _dos_findfirst(pattern, 0xff, &ff)) do
      {
            struct DirEntry *node;

            if (NULL == (node = malloc(sizeof(struct DirEntry))))
                  return ERROR;
            base->next = node;
            strcpy(base->fname, ff.name);
            node->next = NULL;
            *node->fname = '\0';
            base = node;
            
      } while (SUCCESS == _dos_findnext(&ff));
      return SUCCESS;
}
コード例 #10
0
ファイル: sys.c プロジェクト: TijmenW/FreeDOS
int stat(const char *file_name, struct stat *buf)
{
  struct find_t find_tbuf;
  UNREFERENCED_PARAMETER(buf);
  
  return _dos_findfirst(file_name, _A_NORMAL | _A_HIDDEN | _A_SYSTEM, &find_tbuf);
}
コード例 #11
0
ファイル: io_attr.cpp プロジェクト: CS-svnmirror/farmanager
BOOL MYRTLEXP GetFileAttr( CONSTSTR fname,ATTR_TYPE& at )
  {
#if defined(__GNUC__) || defined(__QNX__)
   struct stat s;
   if ( !FIO_STAT(fname,&s) ) return FALSE;
   at = s.st_mode;
  return TRUE;
#else
#if defined(__REALDOS__) || defined(__HWIN16__)
    struct ffblk f;
    if ( findfirst( fname,&f,-1 ) != 0 ) return FALSE;
    at = f.ff_attrib;
    return TRUE;
#else
#if defined(__PROTDOS__)
    struct find_t f;
    if ( _dos_findfirst( fname,-1,&f ) != 0 ) return FALSE;
    at = f.attrib;
    return TRUE;
#else
#if defined(__HWIN32__)
    at = GetFileAttributes( fname );
    if ( at == MAX_DWORD ) return FALSE;
    return TRUE;
#else
  #error ERR_PLATFORM
#endif
#endif
#endif
#endif
}
コード例 #12
0
ファイル: fileos2.c プロジェクト: Albermg7/boost
void
file_dirscan( 
	char *dir,
	scanback func,
	void	*closure )
{
    PATHNAME f;
    string filespec[1];
    long handle;
    int ret;
    struct _find_t finfo[1];

    /* First enter directory itself */

    memset( (char *)&f, '\0', sizeof( f ) );

    f.f_dir.ptr = dir;
    f.f_dir.len = strlen(dir);

    dir = *dir ? dir : ".";

    /* Special case \ or d:\ : enter it */
    string_copy( filespec, dir );

    if( f.f_dir.len == 1 && f.f_dir.ptr[0] == '\\' )
 	    (*func)( closure, dir, 0 /* not stat()'ed */, (time_t)0 );
    else if( f.f_dir.len == 3 && f.f_dir.ptr[1] == ':' )
 	    (*func)( closure, dir, 0 /* not stat()'ed */, (time_t)0 );
    else
        string_push_back( filespec, '/' );

    string_push_back( filespec, '*' );

    /* Now enter contents of directory */

    if( DEBUG_BINDSCAN )
        printf( "scan directory %s\n", filespec->value );

    /* Time info in dos find_t is not very useful.  It consists */
    /* of a separate date and time, and putting them together is */
    /* not easy.  So we leave that to a later stat() call. */

    if( !_dos_findfirst( filespec->value, _A_NORMAL|_A_RDONLY|_A_SUBDIR, finfo ) )
    {
        string filename[1];
        string_new( filename );
        do
        {
            
            f.f_base.ptr = finfo->name;
            f.f_base.len = strlen( finfo->name );

            string_truncate( filename, 0 );
            path_build( &f, filename, 0 );
            (*func)( closure, filename->value, 0 /* not stat()'ed */, (time_t)0 );
        }
        while( !_dos_findnext( finfo ) );
        string_free( filename );
    }
}
コード例 #13
0
ファイル: WAVEDIT.CPP プロジェクト: jimmccurdy/ArchiveGit
void convert_files(const char *pName,
						 int nNewAmplitude,
						 int nPercent,
						 DWORD __huge *pdwHistogram,
						 int nNewBits,
						 const char *pExtension,
						 const char *pDestDir)
{
	struct _find_t findbuf;

	for (unsigned uRet = _dos_findfirst(pName, _A_NORMAL|_A_RDONLY, &findbuf);
		  uRet == 0;
		  uRet = _dos_findnext(&findbuf))
	{
		char cbDestName[_MAX_PATH];
		char *p;

	/*
	// Prepend the path we want.
	*/

		if (pDestDir == NULL)
		{
			*cbDestName = '\0';
		}
		else
		{
			strcpy(cbDestName, pDestDir);
			p = cbDestName + strlen(cbDestName);
			if (p[-1] != '\\' && p[-1] != ':')
			{
				*p++ = '\\';
				*p = 0;
			}
		}

		strcat(cbDestName, findbuf.name);

	/*
	// Append the extension we want.
	*/

		if ((p = strrchr(cbDestName, '.')) == NULL)
		{
			strcat(cbDestName, pExtension);
		}
		else
		{
			strcpy(p, pExtension);
		}

		convert_file(findbuf.name,
						 cbDestName,
						 nNewAmplitude,
						 nPercent,
						 pdwHistogram,
						 nNewBits);
	}
}
コード例 #14
0
ファイル: emdir.c プロジェクト: OS2World/APP-WORDPROC-dvips
int ll_findfirst (const char *path, int attr, struct ll_findbuffer *buffer)
{
  int res;
  ll_attr = attr;
  res = _dos_findfirst((char *)path, attr, (struct find_t *)buffer);
  if (res != 0) return 0;
  if ( (buffer->attrib&ll_attr) == 0)
    return ll_findnext(buffer);
  return 1;
}
コード例 #15
0
ファイル: MK386.C プロジェクト: BGCX261/zlmtank-svn-to-git
void find_source( char *fpath, char *fname ) {
    int fpath_len = strlen( fpath );
    struct find_t fb;

    if (!_dos_findfirst( strcat( fpath, fname), _A_NORMAL, &fb ) )
    do {
        fpath[ fpath_len ] = '\0';
        get_one_source( strcat( fpath, fb.name) );
    } while( ! _dos_findnext( &fb ) );
}
コード例 #16
0
ファイル: gema.c プロジェクト: CarlWright/gema
void
expand_wildcard ( const char* file_spec, COStream out ) {
/*  Expand wild card file name on MS-DOS.
    (On Unix, this is not needed because expansion is done by the shell.)
 */
#ifdef MSDOS						       
#if defined(_FIND_T_DEFINED)  /* Microsoft C on MS-DOS */
  struct _find_t fblk;
  if ( _dos_findfirst( file_spec, _A_NORMAL|_A_ARCH|_A_RDONLY, &fblk )
       == 0 ) {
    /* first match found */
    do {
      merge_pathnames( out, FALSE, file_spec, fblk.name, NULL );
      cos_putch( out, '\n' );
    }
    while ( _dos_findnext( &fblk ) == 0 );
  }
  else
#elif defined(_WIN32)  /* Microsoft C/C++ on Windows NT */
  struct _finddata_t fblk;
  long handle;
  handle = _findfirst( (char*)file_spec, &fblk );
  if ( handle != -1 ) {
    /* first match found */
    do {
      if ( !(fblk.attrib & _A_SUBDIR) ) {		   
	merge_pathnames( out, FALSE, file_spec, fblk.name, NULL );
	cos_putch( out, '\n' );
      }
    }
    while ( _findnext( handle, &fblk ) == 0 );
    _findclose( handle );
  }
  else
#elif defined(__TURBOC__)  /* Borland Turbo C */
  struct ffblk fblk;
  if ( findfirst( file_spec, &fblk, FA_ARCH|FA_RDONLY ) == 0 ) {
    /* first match found */
    do {
      merge_pathnames( out, FALSE, file_spec, fblk.ff_name, NULL );
      cos_putch( out, '\n' );
    }
    while ( findnext( &fblk ) == 0 );
  }
  else
#endif /* Borland */
  if ( strchr(file_spec,'*') != NULL )
    fprintf( stderr, "No match for \"%s\"\n", file_spec );
  else
#endif /* MSDOS */
  {
    cos_puts( out, file_spec );
    cos_putch( out, '\n' );
  } 
}
コード例 #17
0
ファイル: dirwrap.c プロジェクト: donfanning/syncterm
int	DLLCALL	glob(const char *pattern, int flags, void* unused, glob_t* glob)
{
    struct	find_t ff;
	size_t	found=0;
	char	path[MAX_PATH+1];
	char*	p;
	char**	new_pathv;

	if(!(flags&GLOB_APPEND)) {
		glob->gl_pathc=0;
		glob->gl_pathv=NULL;
	}

	if(_dos_findfirst((char*)pattern,(flags&GLOB_PERIOD) ? _A_HIDDEN : _A_NORMAL,&ff)!=0)
		return(GLOB_NOMATCH);

	do {
		if((flags&GLOB_PERIOD || ff.name[0]!='.') &&
			(!(flags&GLOB_ONLYDIR) || ff.attrib&_A_SUBDIR)) {
			if((new_pathv=realloc(glob->gl_pathv
				,(glob->gl_pathc+1)*sizeof(char*)))==NULL) {
				globfree(glob);
				return(GLOB_NOSPACE);
			}
			glob->gl_pathv=new_pathv;

			/* build the full pathname */
			SAFECOPY(path,pattern);
			p=getfname(path);
			*p=0;
			strcat(path,ff.name);

			if((glob->gl_pathv[glob->gl_pathc]=malloc(strlen(path)+2))==NULL) {
				globfree(glob);
				return(GLOB_NOSPACE);
			}
			strcpy(glob->gl_pathv[glob->gl_pathc],path);
			if(flags&GLOB_MARK && ff.attrib&_A_SUBDIR)
				strcat(glob->gl_pathv[glob->gl_pathc],"/");

			glob->gl_pathc++;
			found++;
		}
	} while(_dos_findnext(&ff)==0);
	_dos_findclose(&ff);

	if(found==0)
		return(GLOB_NOMATCH);

	if(!(flags&GLOB_NOSORT)) {
		qsort(glob->gl_pathv,found,sizeof(char*),glob_compare);
	}

	return(0);	/* success */
}
コード例 #18
0
ファイル: ffind.c プロジェクト: cixonline/ameol
/* Searches for the first file that matches the given filename pattern.
 */
HFIND EXPORT WINAPI Amuser_FindFirst( LPSTR npFilename, UINT attrib, FINDDATA FAR * npFindData )
{
#ifdef WIN32
   return( _findfirst( npFilename, npFindData ) );
#else
   char FileName[ _MAX_PATH ];

   lstrcpy( FileName, npFilename );
   return( _dos_findfirst( FileName, attrib, npFindData ) ? -1 : 0 );
#endif
}
コード例 #19
0
unsigned LocalFindFirst( char *pattern, void *info, unsigned info_len, int attrib )
/*********************************************************************************/
{
    unsigned        rc;

    rc = _dos_findfirst( pattern, attrib, &Findbuf );
    if( rc )
        return( StashErrCode( rc , OP_LOCAL ) );
    makeDOSDTA( &Findbuf, info );
    return( 0 );
}
コード例 #20
0
ファイル: dirosi.c プロジェクト: ABratovic/open-watcom-v2
static DIR_TYPE *___opendir( const char *dirname, DIR_TYPE *dirp )
/****************************************************************/
{
    if( dirp->d_first != _DIR_CLOSED ) {
        _dos_findclose( (struct _find_t *)dirp->d_dta );
        dirp->d_first = _DIR_CLOSED;
    }
    if( _dos_findfirst( dirname, SEEK_ATTRIB, (struct _find_t *)dirp->d_dta ) ) {
        return( NULL );
    }
    dirp->d_first = _DIR_ISFIRST;
    return( dirp );
}
コード例 #21
0
BOOL COXFileList::Search()
	{
#ifdef WIN32
	COXFileSpec* pFile;
	WIN32_FIND_DATA fileData;
	HANDLE hFindFile;
	BOOL bFileFound(TRUE);
		
	hFindFile = FindFirstFile(m_path.GetPath(), &fileData);
	if(hFindFile != INVALID_HANDLE_VALUE)
		{
		while (bFileFound)
			{
			if (((fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) &&
				(fileData.cFileName[0] != _T('.')))
				{
				pFile = new COXFileSpec;
				pFile->SetFileName(fileData.cFileName);
				pFile->SetTime(CTime(fileData.ftLastWriteTime));
				ASSERT(fileData.nFileSizeHigh == 0);
				pFile->SetLength(fileData.nFileSizeLow);
				pFile->SetAttributes((CFile::Attribute)fileData.dwFileAttributes);
				m_fileArray.Add(pFile);
				}

			bFileFound = FindNextFile(hFindFile,&fileData);
			}
		FindClose(hFindFile);
		}
	return TRUE;

#else
	COXFileSpec* pFile;
	_find_t fileInfo;
	BOOL bFileFound;
	
	bFileFound = (_dos_findfirst(m_path.GetPath(), _A_NORMAL | _A_ARCH, &fileInfo) == 0);
	while (bFileFound)
		{
		pFile = new COXFileSpec;
		pFile->SetFileName(fileInfo.name);
		pFile->SetTime(CTime((WORD)fileInfo.wr_date, (WORD)fileInfo.wr_time));
		pFile->SetLength(fileInfo.size);
		pFile->SetAttributes((CFile::Attribute)fileInfo.attrib);
		m_fileArray.Add(pFile);
		bFileFound = (_dos_findnext(&fileInfo) == 0);
		}		
	return TRUE;
#endif
	}
コード例 #22
0
ファイル: BACKMAP5.C プロジェクト: Arc0re/dukenukem3d
getfilenames(char *kind)
{
	short type;
	struct find_t fileinfo;

	if (strcmp(kind,"SUBD") == 0)
	{
		strcpy(kind,"*.*");
		if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0)
			return(-1);
		type = 1;
	}
	else
	{
		if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0)
			return(-1);
		type = 0;
	}
	do
	{
		if ((type == 0) || ((fileinfo.attrib&16) > 0))
			if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0))
			{
				if (menunamecnt < MAXMENUFILES)
				{
					strcpy(menuname[menunamecnt],fileinfo.name);
					menuname[menunamecnt][16] = type;
					menunamecnt++;
				}
				//else
				//   printmessage("Too many files! (max=MAXMENUFILES)");
			}
	}
	while (_dos_findnext(&fileinfo) == 0);

	return(0);
}
コード例 #23
0
ファイル: tuifs.c プロジェクト: AreaScout/vice
static struct file_list *file_list_read_nolfn(const char *path, const char *pattern)
{
    char *cwd = ioutil_current_dir();
    struct file_list *fl = NULL;
    struct find_t f;

    if (cwd == NULL) {
        return NULL;
    }

    if (ioutil_chdir(path) < 0) {
        goto end;
    }

    if (_dos_findfirst("*.*", (_A_NORMAL | _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR | _A_ARCH), &f)) {
        goto end;
    }

    fl = file_list_create();

    /* (We skip `.' here.) */

    while (!_dos_findnext(&f)) {
        strlwr(f.name);
        if (pattern == NULL || (f.attrib & _A_SUBDIR)) {
            file_list_add_item(fl, f.name, (f.attrib & _A_SUBDIR) ? FT_DIR : FT_NORMAL);
            continue;
        }
        {
            char *p = lib_stralloc(pattern);
            char *element;

            element = strtok(p, ";");
            do {
                if (fnmatch(element, f.name, FNM_NOCASE) == 0) {
                    file_list_add_item(fl, f.name, (f.attrib & _A_SUBDIR) ? FT_DIR : FT_NORMAL);
                }
                element = strtok(NULL, ";");
            } while (element != NULL);
            lib_free(p);
        }
    }

    file_list_sort(fl);

end:
    ioutil_chdir(cwd);
    return fl;
}
コード例 #24
0
ファイル: wildcard.c プロジェクト: EleanorRobson/oracc
void 
_wildcard (int *argcp, char ***argvp)
{
  int i, old_argc, new_argc, new_alloc;
  char **old_argv, **new_argv;
  char line[256], *p, *q;
  struct find_t find;

  old_argc = *argcp; old_argv = *argvp;
  for (i = 1; i < old_argc; ++i)
    if (old_argv[i] != NULL && strpbrk (old_argv[i], "?*") != NULL)
      break;
  if (i >= old_argc)
    return;                 /* do nothing */
  new_argv = NULL; new_alloc = 0; new_argc = 0;
  for (i = 0; i < old_argc; ++i)
    {
      if (i == 0 || old_argv[i] == NULL
          || strpbrk (old_argv[i], "?*") == NULL
          || _dos_findfirst (old_argv[i], _A_NORMAL, &find) != 0)
        {
          WPUT (old_argv[i]);
        }
      else
        {
          strcpy (line, old_argv[i]);
          p = q = line;
          while (*q != 0)
            {
              if (*q == ':' || *q == '\\' || *q == '/')
                p = q + 1;
              ++q;
            }
          do  {
            if (strcmp (find.name, ".") != 0 &&
                strcmp (find.name, "..") != 0)
              {
                strcpy (p, find.name);
                q = xstrdup (line);
                WPUT (q);
              }
          } while (_dos_findnext (&find) == 0);
        }
    }
  WPUT (NULL); 
  --new_argc;
  *argcp = new_argc; *argvp = new_argv;
  return;
}
コード例 #25
0
ファイル: spve.c プロジェクト: Ukusbobra/open-watcom-v2
static int file_exists( const CHAR_TYPE *filename )                     /* 05-apr-91 */
{
#if defined(__OS2__) || defined( __NT__ )
    if( __F_NAME(access,_waccess)( filename, 0 ) == 0 )
        return( 1 );
#else
    /* should use _dos_findfirst to avoid DOS APPEND bug */
    struct find_t  find_buf;
    
    if( _dos_findfirst( filename,
            _A_NORMAL | _A_RDONLY | _A_HIDDEN | _A_SYSTEM, &find_buf ) == 0 )
        return( 1 );
#endif
    return( 0 );
}
コード例 #26
0
ファイル: findfile.c プロジェクト: gameplayer22/d2x-1
int	FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct)
{
	unsigned retval;
	
	if (_FileFindFlag) return -1;
	
	retval = _dos_findfirst(search_str, 0, &_FileFindStruct);
	if (retval) return (int)retval;
	else {
		ffstruct->size = _FileFindStruct.size;
		strcpy(ffstruct->name, _FileFindStruct.name);
		_FileFindFlag = 1;
		return (int)retval;
	}
}
コード例 #27
0
ファイル: list.c プロジェクト: avinashtrivedi/windows_command
void main(int count,char *argv[]){
   struct find_t q ;
   int a;
   if(count==1)
      argv[1]="*.*";
      a = _dos_findfirst(argv[1],1,&q);
      if(a==0){
         while (!a){
            printf(" %s\n", q.name);
            a = _dos_findnext(&q);
         }
      }
      else{
         printf("File not found");
      }
}
コード例 #28
0
ファイル: wfilenam.cpp プロジェクト: ABratovic/open-watcom-v2
bool WEXPORT WFileName::attribs( char* attribs ) const
{
    struct find_t fileinfo;
    #define FIND_STYLE _A_NORMAL
    int rc = _dos_findfirst( *this, FIND_STYLE, &fileinfo );
    if( rc == 0 ) {
        if( attribs != NULL ) {
            *attribs = fileinfo.attrib;
        }
    }
    #undef FIND_STYLE
    #ifndef __WINDOWS__
    _dos_findclose( &fileinfo );
    #endif
    return( rc == 0 );
}
コード例 #29
0
ファイル: mklib.c プロジェクト: OS2World/LIB-VIDEO-MGL
int main(int argc,char *argv[])
{
	struct find_t	blk;
	char			basename[_MAX_PATH];
	char			suffix[_MAX_PATH] = "";
	char			findname[_MAX_PATH];
	char			findsuffix[_MAX_PATH];
	char			command[_MAX_PATH];
	int				id,result,suffixlen;
	FILE			*f;

	if (argc != 2 && argc != 3)
		return -1;
	strcpy(basename,argv[1]);
	if (argc > 2)
		strcpy(suffix,argv[2]);
	strcpy(findname,basename);
	strcat(findname,"*");
	strcat(findname,suffix);
	strcat(findname,".fnt");
	strcpy(findsuffix,suffix);
	strcat(findsuffix,".fnt");
	suffixlen = strlen(findsuffix);
	if ((f = fopen("font.rc","w")) == NULL)
		return -1;
	id = 1;
	result = _dos_findfirst(findname,_A_NORMAL,&blk);
	while (result == 0) {
		if (!(blk.attrib & _A_SUBDIR) &&
				strlen(blk.name) == strlen(findname)+1 &&
				stricmp(&blk.name[strlen(blk.name)-suffixlen],findsuffix) == 0) {
			fprintf(f,"%d FONT LOADONCALL MOVEABLE DISCARDABLE %s\n", id,blk.name);
			id++;
			}
		result = _dos_findnext(&blk);
		}
	fclose(f);

	sprintf(command,"cp empty.dll %s%s.fon", basename, suffix);
	system(command);

	sprintf(command,"c:\\c\\bc50\\bin\\brc -fe%s%s.fon font.rc", basename, suffix);
	system(command);

	unlink("font.rc");
	return 0;
}
コード例 #30
0
ファイル: attrib.c プロジェクト: ErisBlastar/osfree
LOCAL void PROC do_path (char *pathend) {
        struct find_t fi;

        do_mask (pathend); if (recurse == 0) return;

        adds (pathend, "*.*");
        if (_dos_findfirst (path, DIR_ATTR, &fi))
                return;

        do {    const char *p;
                if ((fi.attrib & _A_SUBDIR) == 0) continue;
                p = fi.name-1; do p++; while (*p == '.');
                if (*p == '\0') continue;               /* name == dots */

                do_path (adds (adds (pathend, fi.name), "\\"));
        } while (_dos_findnext (&fi) == 0);
}