static int buf_allocd;
struct dirent **namelist, *const *de;
- char *subpathp;
const char *path_or_0= path_or_buf==buf ? 0 : path_or_buf;
int nentries, pathl, esave, buf_want, i;
if (path_or_0) strcpy(buf,path_or_0);
buf[pathl]= '/';
- subpathp= buf+pathl+1;
+ pathl++;
if (nentries < 0) {
- strcpy(subpathp,"\\?"); errno= esave;
+ strcpy(buf+pathl,"\\?"); errno= esave;
problem_e(buf,-1,"scandir failed");
return;
}
for (i=0, de=namelist; i<nentries; i++, de++) {
- strcpy(subpathp, (*de)->d_name);
+ strcpy(buf+pathl, (*de)->d_name);
node(buf);
free(*de);
}