Пример #1
0
static int find_dir(char *buf, int start, int end, int split, char *mask) {
  char path[MAXPATH];
  int wildcards;
  int idx;
  int dir;
  
  if (start == split) {
    path[0] = '.';
    path[1] = 0;
  } else {
    memcpy(path, buf + start, split - start);
    path[split - start] = 0;
  }

  dir = _opendir(path);
  if (dir < 0) return dir;

  if (split == end) {
    *mask++ = '*';
  } else {
    wildcards = 0;
    idx = split;
    while (idx < end) {
      if (buf[idx] == '*' || buf[idx] == '?') wildcards = 1;
      *mask++ = buf[idx++];
    }

    if (!wildcards) *mask++ = '*';
  }

  *mask++ = 0;
  return dir;
}
Пример #2
0
DIR *opendir(const char *pathname)
{
    	DIR *(*_opendir)(const char *pathname);
	*(void **)(&_opendir) = dlsym(RTLD_NEXT, "opendir");

	DIR *rep = _opendir(pathname);
	return  rep;
}
Пример #3
0
SDL_bool dr_load_driver_dir(char *dirname) {
    DIR *pdir;
    struct stat buf;
    struct SceIoDirent *pfile;
    if (!(pdir=_opendir (dirname))) {
        printf("Couldn't find %s\n",dirname);
        return SDL_FALSE; 
    }
    while(pfile=_readdir(pdir)) {
        char *filename=alloca(strlen(pfile->d_name)+strlen(dirname)+2);
        sprintf(filename,"%s/%s",dirname,pfile->d_name);
        sceIoGetstat(filename,&buf);
        if (S_ISREG(buf.st_mode)) {
            dr_load_driver(filename);
        }
    }
    _closedir(pdir);
    return SDL_TRUE;
}
Пример #4
0
void *opendir(const char* name) {
    return _opendir(name);
}