XRootD
XrdW41Dirs Class Reference
+ Collaboration diagram for XrdW41Dirs:

Static Public Member Functions

static XrdOucTListExpand (const char *Path, XrdOucTList *ptl)
 

Detailed Description

Definition at line 86 of file XrdWait41.cc.

Member Function Documentation

◆ Expand()

XrdOucTList * XrdW41Dirs::Expand ( const char *  Path,
XrdOucTList ptl 
)
static

Definition at line 178 of file XrdWait41.cc.

179 {
180  struct dirent *dp;
181  struct stat Stat;
182  const char *eText;
183  char buff[1024], *sfxDir;
184  DIR *DFD;
185 
186  if (!(DFD = opendir(Path)))
187  {eText = XrdSysE2T(errno);
188  std::cerr <<"wait41: " <<eText <<" opening directory" <<Path <<std::endl;
189  return ptl;
190  }
191 
192  strcpy(buff, Path); sfxDir = buff + strlen(Path);
193  if (*(sfxDir-1) != '/') *sfxDir++ = '/';
194 
195  errno = 0;
196  while((dp = readdir(DFD)))
197  {if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue;
198  strcpy(sfxDir, dp->d_name);
199  if (stat(buff, &Stat))
200  {eText = XrdSysE2T(errno);
201  std::cerr <<"wait41: " <<eText <<" processing " <<buff <<std::endl;
202  continue;
203  }
204  if (S_ISREG(Stat.st_mode)) ptl = new XrdOucTList(buff, 0, ptl);
205  errno = 0;
206  }
207 
208  if (errno)
209  {eText = XrdSysE2T(errno);
210  std::cerr <<"wait41: " <<eText <<" reading directory" <<Path <<std::endl;
211  }
212 
213  closedir(DFD);
214  return ptl;
215 }
struct stat Stat
Definition: XrdCks.cc:49
int stat(const char *path, struct stat *buf)
struct dirent * readdir(DIR *dirp)
int closedir(DIR *dirp)
DIR * opendir(const char *path)
XrdOucString Path
const char * XrdSysE2T(int errcode)
Definition: XrdSysE2T.cc:104

References closedir(), opendir(), Path, readdir(), Stat, stat(), and XrdSysE2T().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: