コード例 #1
0
ファイル: pfs.c プロジェクト: berkus/moto
Enumeration*
pfs_getEntries(PosixFileSystem* pfs, char* path){
   DIR* dirp = eopendir(path);
   struct dirent *dp;
   
   Vector* v= vec_createDefault();
   if (dirp) {
      while ((dp = readdir(dirp)) != NULL) {
         vec_add(v,estrdup(dp->d_name)); 
         
      }
      closedir(dirp);
   }
   return vec_elements(v);
}
コード例 #2
0
void find_network_interfaces_sys (struct network_control_block *cb) {
 DIR *dir;
 struct dirent *entry;

 dir = eopendir ("/sys/class/net");
 if (dir != NULL) {
  while (entry = ereaddir (dir)) {
   char tmp[BUFFERSIZE];
   if (entry->d_name[0] == '.') continue;

#if 0
   ioctl (0, SIOCGIFNAME, entry->d_name, &tmp);

   puts (tmp);

   cb->add_network_interface (entry->d_name, tmp, 0x00000001);
#else
   cb->add_network_interface (entry->d_name, "Generic Network Interface", 0x00000001);
#endif
  }
  eclosedir (dir);
 }
}