#include #include #include #include #include #include "ncdread.h" /****************************************************************************/ int main(int argc, char *argv[]) { char *s,st[100]; const char *p; int drive; int len; drive = getdisk()+1; if ( argc < 2 ) { Just_Show_Current: getcurdir(drive,st); printf("%c:\\%s\n",drive+'A'-1,st); return 0; } s = argv[1]; if ( strchr(s,':') ) { drive = toupper(s[0])-'A'+1; if ( !s[2] ) goto Just_Show_Current; } if ( chdir(s) == 0 ) { _chdrive(drive); return 0; } getcurdir(drive,st); p = FindFirstDir(st,s); if ( *p ) { strcpy(st,p); len = strlen(st); if ( st[len-1] == '\\' ) st[len-1]=0; chdir(st); _chdrive(drive); } while ( *p ) { printf("%s\n",p); p = FindNextDir(); } return 0; }