static int enterDirectory(Stream_t *Dir) { int r; char drive; if(currentDir == Dir) return 0; /* still the same directory */ leaveDirectory(0); drive = getDrive(Dir); r=enterDrive(Dir, drive); if(r) return r; currentDir = COPY(Dir); dynDirPath = getPwd(getDirentry(Dir)); if(!dynDirPath) dirPath=emptyString; else { if(!dynDirPath[3] && concise) dynDirPath[2]='\0'; dirPath=dynDirPath; } /* print directory title */ if(!concise) printf("\nDirectory for %s\n", dirPath); if(!wide && !concise) printf("\n"); dirsOnDrive++; bytesInDir = 0; filesInDir = 0; return 0; }
static int enterDirectory(Stream_t *Dir) { int r; char *drive; char *slash; if(currentDir == Dir) return 0; /* still the same directory */ leaveDirectory(0); drive = getDrive(Dir); r=enterDrive(Dir, drive); if(r) return r; currentDir = COPY(Dir); dirPath = getPwd(getDirentry(Dir)); if(!dirPath) dirPath=emptyString; if(concise && (slash = strrchr(dirPath, '/')) != NULL && slash[1] == '\0') *slash = '\0'; /* print directory title */ if(!concise) printf("\nDirectory for %s\n", dirPath); if(!wide && !concise) printf("\n"); dirsOnDrive++; bytesInDir = 0; filesInDir = 0; return 0; }