home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
lan
/
lanmkdir.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-06-18
|
6KB
|
183 lines
program makedir(input,output);
{
Program reads datafile of filenames, and writes as output the
batch file 'x1.bat' for making directories.
These directories themselves are piped to a data file,
named 'x1.dat'.
}
const
version = '1.00';
progname = 'LANMKDIR ';
ctlh = #08;
cret = #13;
linf = #10;
ctrlz= #26;
diagnostic = false; {enables, disables diagnostic messages}
echoline= 'echo -------------------------------- >>x1.dat ';
type
string2=string[2];
string3=string[3];
label
notag;
var
infiler: file of char;
outfiler:text;
ch:char;
drive:string[1];
subdir:string[6];
text_string,
text_string1,
text_string2:string[80];
time_string:string[80];
kounter:integer;
yr,mo,da,hr,mn:string[2];
fname:string[12];
floppydrive,harddrive:string[2];
input_file:string[12];
reading:boolean;
i,command_length:integer;
command_temp: string[128];
command_line: string[128] absolute cseg:$0080;
procedure boxlike;
begin
clrscr;
gotoxy(0,0);
writeln ('┌─────────────────────────────────────────────────────────────────────────────┐');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('│ │');
writeln ('└─────────────────────────────────────────────────────────────────────────────┘');
gotoxy(29,3);
write ('F L O P P Y - L A N');
gotoxy(52,4);
write ('System (C) by:');
gotoxy(52,6);
write ('Leonard P. Levine');
gotoxy(52,7);
write ('3942 N. Oakland Ave. #241');
gotoxy(52,8);
write ('Shorewood, WI 53211');
gotoxy(52,9);
write ('(414) 962-4719');
gotoxy(52,10);
write ('len@evax.milw.wisc.edu');
gotoxy(3,12);
write ('Program:',progname);
gotoxy(52,12);
write('Version: ',version);
gotoxy(7,9);
write ('Floppy Drive: ',floppydrive);
gotoxy(7,10);
write (' Hard Drive: ',harddrive);
gotoxy(7,6);
write (' Input File: ',input_file);
gotoxy(3,8);
write(' ');
end;
procedure lastbox;
begin
gotoxy(1,13);
writeln ('├─────────────────────────────────────────────────────────────────────────────┤');
writeln ('│ Messages like: "File not found" and "Invalid Directory" are normal only │');
writeln ('│ after new files are added to the lan datafile. │');
writeln ('└─────────────────────────────────────────────────────────────────────────────┘');
end;
{main Program}
begin
command_temp := command_line;
command_length := length(command_temp);
floppydrive:= 'A:';
harddrive := 'C:';
if command_length <> 0 then
begin
while copy(command_temp,1,1) = ' ' do
command_temp := copy(command_temp,2,44)+' '; {clear out blanks}
floppydrive := copy(command_temp,1,1) + ':';
harddrive := copy(command_temp,2,1) + ':';
end;
input_file := 'LAN.FIL';
if command_length > 5 then input_file := copy(command_temp,4,12);
boxlike;
kounter := 1;
write ('Files Supported: ');
if diagnostic then writeln('Inputting from file "',input_file,'".');
assign (infiler,input_file);
assign (outfiler,'x1.bat');
{$I-}
Reset(infiler);
if ioresult <> 0 then
begin
gotoxy(1,15);
writeln('File ',input_file,' does not exist');
halt
end;
{$I+}
reset (infiler);
rewrite(outfiler);
if diagnostic then
begin
writeln;
writeln ('Output to file "X1.BAT":');
writeln ('echo -------------------------------- >x1.dat ');
end;
if not diagnostic then
writeln(outfiler,'@echo off');
writeln(outfiler,'echo --System Messages, if any-----');
writeln(outfiler,'echo -------------------------------- >x1.dat ');
while not eof(infiler) do
begin {endfiler}
{ Characters:1234567890 }
text_string := 'file: ';
reading := true;
while reading do
begin {reading}
read(infiler,ch);
case ch of
ctrlz: reading := false;
cret: reading := false;
linf: reading := false;
else begin
text_string := text_string + ch;
end;
end;
end; {reading}
if text_string <> 'file: ' then
begin {goodline}
text_string1 := 'dir ' + floppydrive + copy(text_string,11,60) + ' >>x1.dat';
text_string2 := 'dir ' + harddrive + copy(text_string,11,60) + ' >>x1.dat';
if diagnostic then writeln(text_string1);
if diagnostic then writeln(echoline);
if diagnostic then writeln(text_string2);
if diagnostic then writeln(echoline);
write (kounter:4,ctlh,ctlh,ctlh,ctlh);
kounter := kounter + 1;
writeln(outfiler,text_string1);
writeln(outfiler,echoline);
writeln(outfiler,text_string2);
writeln(outfiler,echoline);
end;
end; {endfiler}
close(outfiler);
lastbox;
end.