#version $50 #reserve 6 #copyright "D.cmd Written By Stephen J. Carden Copyright 1995 K-Products" #address $7000 #include runtime.h #include bbs_pro.h #define DISK 4 char filespec [80]; main() { byte ch; cr_lf(); echose ("BBS Express! Pro DIR v5.0"); echose (" (c) 1995 K-Products "); cr_lf(); strcpy (filespec, parm1); if (length(filespec) == 0) { strcpy (filespec, "Dx:*.*"); filespec[2] = Defdrive; } ch = filespec[length(filespec)]; if (ch == '<' || ch == '>' || ch == ':') strcat (filespec, "*.*"); do_directory(); MIOsuspend(); close (DISK); MIOresume(); if (aborted) { cr_lf(); echose("Aborted..."); } } lowerstr (char *s) { byte x; for (x=1; x <= length(s); ++x) s [x] = locase (s[x]); } do_directory() { char instr [60], filename[15], filesize[10]; byte total_files; total_files = 0; aborted = 0; MIOsuspend(); close (DISK); if (open (DISK, filespec, 6, 128) != OK) { MIOresume(); echoSE("Directory not found!"); return; } do { MIOsuspend(); if (inputSD (DISK, instr) != OK) break; MIOresume(); moveblock (Filename+1,Instr+1,12); filename[0]=12; lowerstr (filename); if (instr[9] = 'R') { /* "free sectors" line */ cr_lf(); if (Total_Files & 1 > 0) cr_lf(); echoS (" "); echoB (Total_Files); echoS (" files, "); lowerstr (instr); echoSE (instr); return; } else if (instr[14] = '<') strcpy (filesize, ""); else if (instr[14] > 32) strcpy (filesize, "-BIG-"); else { moveblock (filesize+1, instr+15, 5); filesize[0]=5; } if (length (instr) < 30) echoSE (instr); else { ++total_files; echoS (filename); echoS (" "); echoS (filesize); if (total_files & 1 == 0) cr_lf(); else echoS(" "); } } while (IOresult (DISK) == OK && aborted == 0); }