Skip to content

Latest commit

 

History

History
784 lines (752 loc) · 24.1 KB

file5.pas

File metadata and controls

784 lines (752 loc) · 24.1 KB
 
Nov 25, 2000
Nov 25, 2000
1
{$A+,B+,E+,F+,I+,L+,N-,O+,R-,S+,V-}
Nov 18, 2000
Nov 18, 2000
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
unit file5;
interface
uses
crt, dos,
{rcg11172000 no overlay under Linux.}
{overlay,}
common,
sysop4,
file0, file1, file2, file4, file8, file9, file11,
execbat;
procedure minidos;
procedure browse;
procedure uploadall;
implementation
uses archive1;
var
xword:array[1..9] of astr;
procedure parse(s:astr);
var i,j,k:integer;
begin
for i:=1 to 9 do xword[i]:='';
i:=1; j:=1; k:=1;
if (length(s)=1) then xword[1]:=s;
while (i<length(s)) do begin
inc(i);
if ((s[i]=' ') or (length(s)=i)) then begin
if (length(s)=i) then inc(i);
xword[k]:=copy(s,j,(i-j));
j:=i+1;
inc(k);
end;
end;
end;
procedure minidos;
var curdir,s,s1:astr;
abort,next,done,restr,nocmd,nospace:boolean;
procedure versioninfo;
begin
nl;
print('Telegard(R) Mini-DOS(R) Version '+ver);
print(' (C)Copyright 1988,89,90 The Telegard Team');
nl;
end;
procedure docmd(cmd:astr);
var fi:file of byte;
f:file;
ps,ns,es,op,np:astr;
s1,s2,s3:astr;
numfiles,tsiz:longint;
retlevel,i,j:integer;
b,ok,wasrestr:boolean;
function restr1:boolean;
begin
restr1:=restr;
if (restr) then wasrestr:=TRUE;
end;
begin
wasrestr:=FALSE;
abort:=FALSE; next:=FALSE; nocmd:=FALSE;
for i:=1 to 9 do xword[i]:=allcaps(xword[i]);
s:=xword[1];
Nov 25, 2000
Nov 25, 2000
77
78
79
{rcg11242000 DOSism.}
{if ((pos('\',xword[2])<>0) or (pos('..',xword[2])<>0)) and}
if ((pos('/',xword[2])<>0) or (pos('..',xword[2])<>0)) and
Nov 18, 2000
Nov 18, 2000
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
(restr) then exit;
if (s='DIR/W') then s:='DIR *.* /W';
if (s='?') or (s='HELP') then printf('minidos')
else
if (s='EDIT') or (s='EDLIN') then begin
if ((exist(xword[2])) and (xword[2]<>'')) then tedit(xword[2])
else
if (xword[2]='') then tedit1 else tedit(xword[2]);
end
else
if (s='EXIT') or (s='QUIT') then done:=TRUE
else
if ((s='DEL') or (s='DELETE')) and (not restr1) then begin
if ((not exist(xword[2])) and (not iswildcard(xword[2]))) or
(xword[2]='') then
print('File not found.')
else begin
xword[2]:=fexpand(xword[2]);
ffile(xword[2]);
repeat
if not ((dirinfo.attr and VolumeID=VolumeID) or
(dirinfo.attr and Directory=Directory)) then begin
assign(f,dirinfo.name);
{$I-} erase(f); {$I+}
if (ioresult<>0) then
print('"'+dirinfo.name+'": Could not delete!');
end;
nfile;
until (not found) or (hangup);
end;
end
else
if (s='TYPE') then begin
printf(fexpand(xword[2]));
if (nofile) then print('File not found.');
end
else
if ((s='REN') or (s='RENAME')) then begin
if ((not exist(xword[2])) and (xword[2]<>'')) then
print('File not found.')
else begin
xword[2]:=fexpand(xword[2]);
assign(f,xword[2]);
{$I-} rename(f,xword[3]); {$I+}
if (ioresult<>0) then print('File not found.');
end
end
else
if (s='DIR') then begin
b:=TRUE;
for i:=2 to 9 do if (xword[i]='/W') then begin
b:=FALSE;
xword[i]:='';
end;
if (xword[2]='') then xword[2]:='*.*';
s1:=curdir;
xword[2]:=fexpand(xword[2]);
fsplit(xword[2],ps,ns,es);
s1:=ps; s2:=ns+es;
if (s2='') then s2:='*.*';
if (not iswildcard(xword[2])) then begin
ffile(xword[2]);
Nov 25, 2000
Nov 25, 2000
143
144
145
146
147
{rcg11242000 DOSism.}
(*if ((found) and (dirinfo.attr=directory)) or
((length(s1)=3) and (s1[3]='\')) then begin {* root directory *}*)
if (((found) and (dirinfo.attr=directory)) or
(s1[1]='/')) then begin {* root directory *}
Nov 18, 2000
Nov 18, 2000
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
s1:=bslash(TRUE,xword[2]);
s2:='*.*';
end;
end;
nl; dir(s1,s2,b); nl;
end
else
if ((s='CD') or (s='CHDIR')) and (xword[2]<>'') and (not restr1) then begin
xword[2]:=fexpand(xword[2]);
{$I-} chdir(xword[2]); {$I+}
if (ioresult<>0) then print('Invalid pathname.');
end
else
if ((s='MD') or (s='MKDIR')) and (xword[2]<>'') and (not restr1) then begin
{$I-} mkdir(xword[2]); {$I+}
if (ioresult<>0) then print('Unable to create directory.');
end
else
if ((s='RD') or (s='RMDIR')) and (xword[2]<>'') and (not restr1) then begin
{$I-} rmdir(xword[2]); {$I+}
if (ioresult<>0) then print('Unable to remove directory.');
end
else
if (s='COPY') and (not restr1) then begin
if (xword[2]<>'') then begin
if (iswildcard(xword[3])) then
print('Wildcards not allowed in destination parameter!')
else begin
if (xword[3]='') then xword[3]:=curdir;
xword[2]:=bslash(FALSE,fexpand(xword[2]));
xword[3]:=fexpand(xword[3]);
ffile(xword[3]);
b:=((found) and (dirinfo.attr and directory=directory));
Nov 25, 2000
Nov 25, 2000
181
182
{rcg11242000 !!! Look at this. }
Nov 18, 2000
Nov 18, 2000
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
if ((not b) and (copy(xword[3],2,2)=':\') and
(length(xword[3])=3)) then b:=TRUE;
fsplit(xword[2],op,ns,es);
op:=bslash(TRUE,op);
if (b) then
np:=bslash(TRUE,xword[3])
else begin
fsplit(xword[3],np,ns,es);
np:=bslash(TRUE,np);
end;
j:=0;
abort:=FALSE; next:=FALSE;
ffile(xword[2]);
while (found) and (not abort) and (not hangup) do begin
if (not ((dirinfo.attr=directory) or (dirinfo.attr=volumeid))) then
begin
s1:=op+dirinfo.name;
if (b) then s2:=np+dirinfo.name else s2:=np+ns+es;
prompt(s1+' -> '+s2+' :');
copyfile(ok,nospace,TRUE,s1,s2);
if (ok) then begin
inc(j);
nl;
end else
if (nospace) then sprompt(#3#7+' - *Insufficient space*')
else sprompt(#3#7+' - *Copy failed*');
nl;
end;
if (not empty) then wkey(abort,next);
nfile;
end;
if (j<>0) then begin
prompt(' '+cstr(j)+' file');
if (j<>1) then prompt('s');
print(' copied.');
end;
end;
end;
end
else
if (s='MOVE') and (not restr1) then begin
if (xword[2]<>'') then begin
if (iswildcard(xword[3])) then
print('Wildcards not allowed in destination parameter!')
else begin
if (xword[3]='') then xword[3]:=curdir;
xword[2]:=bslash(FALSE,fexpand(xword[2]));
xword[3]:=fexpand(xword[3]);
ffile(xword[3]);
b:=((found) and (dirinfo.attr and directory=directory));
Nov 25, 2000
Nov 25, 2000
236
237
{rcg11242000 !!! Look at this. }
Nov 18, 2000
Nov 18, 2000
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
if ((not b) and (copy(xword[3],2,2)=':\') and
(length(xword[3])=3)) then b:=TRUE;
fsplit(xword[2],op,ns,es);
op:=bslash(TRUE,op);
if (b) then
np:=bslash(TRUE,xword[3])
else begin
fsplit(xword[3],np,ns,es);
np:=bslash(TRUE,np);
end;
j:=0;
abort:=FALSE; next:=FALSE;
ffile(xword[2]);
while (found) and (not abort) and (not hangup) do begin
if (not ((dirinfo.attr=directory) or (dirinfo.attr=volumeid))) then
begin
s1:=op+dirinfo.name;
if (b) then s2:=np+dirinfo.name else s2:=np+ns+es;
prompt(s1+' -> '+s2+' :');
movefile(ok,nospace,TRUE,s1,s2);
if (ok) then begin
inc(j);
nl;
end else
if (nospace) then sprompt(#3#7+' - *Insufficient space*')
else sprompt(#3#7+' - *Move failed*');
nl;
end;
if (not empty) then wkey(abort,next);
nfile;
end;
if (j<>0) then begin
prompt(' '+cstr(j)+' file');
if (j<>1) then prompt('s');
print(' moved.');
end;
end;
end;
end
else
if (s='CLS') then cls
else
if (length(s)=2) and (s[1]>='A') and (s[1]<='Z') and
(s[2]=':') and (not restr1) then begin
{$I-} getdir(ord(s[1])-64,s1); {$I+}
if (ioresult<>0) then print('Invalid drive.')
else begin
{$I-} chdir(s1); {$I+}
if (ioresult<>0) then begin
print('Invalid drive.');
chdir(curdir);
end;
end;
end
else
if (s='IFL') then begin
if (xword[2]='') then begin
(*
nl;
print('IFL v1.30 - May 09 1989 - Interior File Listing Utility');
print('Copyright 1989 by Martin Pollard. All rights reserved!');
print('Licensed for internal usage in Telegard v'+ver);
*)
nl;
print('Syntax is: "IFL filename"');
nl;
(*
print('IFL produces a listing of files contained in an archive file.');
print('Archive formats currently supported include:');
nl;
print(' ARC - Developed by System Enhancement Associates');
print(' and enhanced by PKware (PKARC & PKPAK)');
print(' and NoGate Consulting (PAK)');
print(' LZH - Developed by Haruyasu Yoshizaki');
print(' ZIP - Developed by PKware');
print(' ZOO - Developed by Rahul Dhesi');
nl;
print('Support for other formats may be included in the future.');
nl;
*)
end else begin
s1:=xword[2];
if (pos('.',s1)=0) then s1:=s1+'*.*';
lfi(s1,abort,next);
end;
end
else
if (s='SEND') and (xword[2]<>'') then begin
if exist(xword[2]) then unlisted_download(fexpand(xword[2]))
else print('File not found.');
end
else
if (s='VER') then versioninfo
else
if (s='FORMAT') then begin
nl;
print('HA HA HA - Very funny - You must be dumber than you look.');
nl;
end else
if (s='DIRSIZE') then begin
nl;
if (xword[2]='') then print('Needs a parameter.')
else begin
numfiles:=0; tsiz:=0;
ffile(xword[2]);
while (found) do begin
inc(tsiz,dirinfo.size);
inc(numfiles);
nfile;
end;
if (numfiles=0) then print('No files found!')
else print('"'+allcaps(xword[2])+'": '+cstrl(numfiles)+' files, '+
cstrl(tsiz)+' bytes.');
end;
nl;
end
else
if (s='DISKFREE') then begin
if (xword[2]='') then j:=exdrv(curdir) else j:=exdrv(xword[2]);
nl;
print(cstrl(freek(j)*1024)+' bytes free on '+chr(j+64)+':');
nl;
end
else
if (s='EXT') and (not restr1) then begin
s1:=cmd;
j:=pos('EXT',allcaps(s1))+3; s1:=copy(s1,j,length(s1)-(j-1));
while (copy(s1,1,1)=' ') do s1:=copy(s1,2,length(s1)-1);
if ((incom) or (outcom)) then
s1:=s1+' >'+systat.remdevice+' <'+systat.remdevice;
if (length(s1)>127) then begin nl; print('Command too long!'); nl; end
else
shelldos(TRUE,s1,retlevel);
end
else
if ((s='CONVERT') or (s='CVT')) and (not restr1) then begin
if (xword[2]='') then begin
nl;
print(s+' - Telegard archive conversion command.');
nl;
print('Syntax is: "'+s+' <Old Archive-name> <New Archive-extension>"');
nl;
print('Telegard will convert from the one archive format to the other.');
print('You only need to specify the 3-letter extension of the new format.');
nl;
end else begin
if (not exist(xword[2])) or (xword[2]='') then print('File not found.')
else begin
i:=arctype(xword[2]);
if (i=0) then invarc
else begin
s3:=xword[3]; s3:=copy(s3,length(s3)-2,3);
j:=arctype('FILENAME.'+s3);
fsplit(xword[2],ps,ns,es);
if (length(xword[3])<=3) and (j<>0) then
s3:=ps+ns+'.'+systat.filearcinfo[j].ext
else
s3:=xword[3];
if (j=0) then invarc
else begin
ok:=TRUE;
Nov 25, 2000
Nov 25, 2000
402
403
404
405
406
407
{rcg11242000 DOSism.}
{
conva(ok,i,j,systat.temppath+'1\',sqoutsp(fexpand(xword[2])),
sqoutsp(fexpand(s3)));
}
conva(ok,i,j,systat.temppath+'1/',sqoutsp(fexpand(xword[2])),
Nov 18, 2000
Nov 18, 2000
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
sqoutsp(fexpand(s3)));
if (ok) then begin
assign(fi,sqoutsp(fexpand(xword[2])));
{$I-} erase(fi); {$I+}
if (ioresult<>0) then
star('Unable to delete original: "'+
sqoutsp(fexpand(xword[2]))+'"');
end else
star('Conversion unsuccessful.');
end;
end;
end;
end;
end else
if ((s='UNARC') or (s='UNZIP') or
(s='PKXARC') or (s='PKUNPAK') or (s='PKUNZIP')) and (not restr1) then begin
if (xword[2]='') then begin
nl;
print(s+' - Telegard archive de-compression command.');
nl;
print('Syntax is: "'+s+' <Archive-name> Archive filespecs..."');
nl;
print('The archive type can be ANY archive format which has been');
print('configured into Telegard via System Configuration.');
nl;
end else begin
i:=arctype(xword[2]);
if (not exist(xword[2])) then print('File not found.') else
if (i=0) then invarc
else begin
s3:='';
if (xword[3]='') then s3:=' *.*'
else
for j:=3 to 9 do
if (xword[j]<>'') then s3:=s3+' '+fexpand(xword[j]);
s3:=copy(s3,2,length(s3)-1);
shel1;
pexecbatch(TRUE,'tgtemp1.bat','',bslash(TRUE,curdir),
arcmci(systat.filearcinfo[i].unarcline,fexpand(xword[2]),s3),
retlevel);
shel2;
end;
end;
end
else
if ((s='ARC') or (s='ZIP') or
(s='PKARC') or (s='PKPAK') or (s='PKZIP')) and (not restr1) then begin
if (xword[2]='') then begin
nl;
print(s+' - Telegard archive compression command.');
nl;
print('Syntax is: "'+s+' <Archive-name> Archive filespecs..."');
nl;
print('The archive type can be ANY archive format which has been');
print('configured into Telegard via System Configuration.');
nl;
end else begin
i:=arctype(xword[2]);
if (i=0) then invarc
else begin
s3:='';
if (xword[3]='') then s3:=' *.*'
else
for j:=3 to 9 do
if (xword[j]<>'') then s3:=s3+' '+fexpand(xword[j]);
s3:=copy(s3,2,length(s3)-1);
shel1;
pexecbatch(TRUE,'tgtemp1.bat','',bslash(TRUE,curdir),
arcmci(systat.filearcinfo[i].arcline,fexpand(xword[2]),s3),
retlevel);
shel2;
end;
end;
end else begin
nocmd:=TRUE;
if (s<>'') then
if (not wasrestr) then print('Bad command or file name')
else print('Restricted command.');
end;
end;
begin
chdir(bslash(FALSE,systat.afilepath));
restr:=(not cso);
done:=FALSE;
nl;
print('Type "EXIT" to return to Telegard.');
nl;
versioninfo;
if (restr) then begin
print('Only *.MSG, *.ANS, *.40C and *.TXT files may be modified.');
print('Activity restricted to "'+systat.afilepath+'" path only.');
nl;
end;
repeat
getdir(0,curdir);
prompt('<'+curdir+'> '); inputl(s1,128); parse(s1);
docmd(s1);
if (not nocmd) then sysoplog('> '+s1);
until (done) or (hangup);
chdir(start_dir);
end;
procedure browse;
const perpage=15;
var f:ulfrec;
filenum:array[1..20] of integer;
s:astr;
i,a1,a2,numadd,pl,topp,otopp,savflistopt:integer;
c:char;
abort,next,done,done1,showlist:boolean;
procedure listpage;
begin
abort:=FALSE; next:=FALSE;
if (topp>pl) then topp:=otopp;
otopp:=topp;
bnp:=FALSE;
while (topp-otopp<perpage) and (topp<=pl) and
(not abort) and (not hangup) do begin
if (topp<=pl) then begin
seek(ulff,topp); read(ulff,f);
pbn(abort,next);
pfn(topp,f,abort,next);
end;
inc(topp);
end;
end;
begin
fiscan(pl); { loads memuboard }
nl;
sprint(#3#5+memuboard.name+#3#4+' - '+cstr(pl)+' files');
if (pl=0) then exit;
nl;
prt('Start at (1-'+cstr(pl)+',Q=Quit) : '); inu(topp);
if (badini) then topp:=1;
if ((topp<1) or (topp>pl)) then exit;
done:=FALSE; showlist:=TRUE; otopp:=topp;
savflistopt:=thisuser.flistopt; thisuser.flistopt:=30;
repeat
if (showlist) then listpage;
showlist:=FALSE; abort:=FALSE; next:=FALSE;
nl;
prt(#3#5+'['+cstr(topp)+']'+#3#4+' Browse files (1-'+cstr(pl)+',?=help) : ');
input(s,4);
if ((value(s)>=1) and (value(s)<=pl)) then begin
nl;
seek(ulff,value(s)); read(ulff,f);
fileinfo(f,FALSE,abort,next);
s:='xxxx';
end;
if (length(s)>=1) then c:=s[1] else c:=^M;
i:=value(copy(s,2,length(s)-1));
case c of
'?':begin
nl;
print('###:File description');
lcmds(9,3,'Download','-Back up a page');
lcmds(9,3,'Jump','List or <CR> for next page');
lcmds(9,3,'Upload','Numbered download');
lcmds(9,3,'Quit','View interior');
end;
'L',^M:showlist:=TRUE; {* do nothing *}
'B','-':begin
dec(topp,perpage*2);
if (topp<1) then topp:=1;
showlist:=TRUE;
end;
'D':if ((i>=1) and (i<=pl)) then begin
seek(ulff,i); read(ulff,f);
abort:=FALSE;
dlx(f,i,abort);
end else begin
idl;
fiscan(pl);
end;
'J':begin
if ((i<1) or (i>pl)) then begin
i:=0;
nl; prt('Goto which file? (1-'+cstr(pl)+') : '); inu(i);
if (badini) then i:=0;
end;
if (i>=1) and (i<=pl) then topp:=i;
showlist:=TRUE;
end;
'N':begin
if (i>=1) and (i<=pl) then begin
filenum[1]:=i;
numadd:=1;
end else begin
nl;
print('Numbered download.');
print('Enter single file number, or multiple file numbers');
print('seperated by commas, max 20.');
prt(':'); input(s,78);
done1:=FALSE; numadd:=0;
if (s<>'') then
repeat
if ((value(s)>=1) and (value(s)<=filesize(ulff)-1)) then begin
inc(numadd); filenum[numadd]:=value(s);
end;
if (pos(',',s)=0) then done1:=TRUE
else s:=copy(s,pos(',',s)+1,length(s)-pos(',',s));
until (done1) or (numadd=20);
end;
done1:=FALSE;
if (numadd=1) then begin
seek(ulff,filenum[1]); read(ulff,f);
nl;
if (okdl(f)) then
if (pynq('Download immediately? ')) then begin
seek(ulff,filenum[1]); read(ulff,f);
abort:=FALSE;
dlx(f,filenum[1],abort);
done1:=TRUE;
end;
end;
if (not done1) then begin
nl;
print('File list:');
for i:=1 to numadd do begin
seek(ulff,filenum[i]); read(ulff,f);
print(' '+sqoutsp(f.filename));
end;
nl;
if pynq('Add these files to your batch queue? ') then begin
a2:=0;
for i:=1 to numadd do begin
seek(ulff,filenum[i]); read(ulff,f);
a1:=numbatchfiles;
if (okdl(f)) then ymbadd(memuboard.dlpath+f.filename);
if (numbatchfiles<>a1) then inc(a2);
end;
nl;
print(cstr(a2)+' files added to batch queue.');
end;
end;
end;
'U':begin
iul;
fiscan(pl);
end;
'V':begin
if (i>=1) and (i<=pl) then begin
abort:=FALSE; next:=FALSE;
lfin(i,abort,next);
end
else lfii;
fiscan(pl);
end;
'Q':done:=TRUE;
end;
until (done) or (hangup);
close(ulff);
thisuser.flistopt:=savflistopt;
end;
procedure uploadall;
var bn,savflistopt:integer;
abort,next,sall:boolean;
procedure uploadfiles(b:integer; var abort,next:boolean);
var fi:file of byte;
f:ulfrec;
v:verbrec;
fn:astr;
convtime:real;
oldboard,pl,rn,gotpts,i:integer;
c:char;
ok,convt,firstone:boolean;
begin
oldboard:=fileboard;
firstone:=TRUE;
if (fileboard<>b) then changefileboard(b);
if (fileboard=b) then begin
loaduboard(fileboard);
nl;
sprint('Scanning '+#3#5+memuboard.name+#3#1+' ('+memuboard.dlpath+')');
ffile(memuboard.dlpath+'*.*');
while (found) do begin
if not ((dirinfo.attr and VolumeID=VolumeID) or
(dirinfo.attr and Directory=Directory)) then begin
fn:=align(dirinfo.name);
recno(fn,pl,rn); { loads memuboard again .. }
if (rn=0) then begin
assign(fi,memuboard.dlpath+fn);
{$I-} reset(fi); {$I+}
if (ioresult=0) then begin
f.blocks:=trunc((filesize(fi)+127.0)/128.0);
close(fi);
if (firstone) then pbn(abort,next);
firstone:=FALSE;
sprompt(' '+#3#3+fn+' '+#3#4+mln(cstr(f.blocks div 8),3)+' New:');
cl(5); inputl(f.description,60);
ok:=TRUE;
if (copy(f.description,1,1)='.') then begin
if (length(f.description)=1) then begin
abort:=TRUE;
exit;
end;
c:=upcase(f.description[2]);
case c of
'D':begin
{$I-} erase(fi); {$I+} i:=ioresult;
ok:=FALSE;
end;
'N':begin
next:=TRUE;
exit;
end;
'S':ok:=FALSE;
end;
end;
if (ok) then begin
v.descr[1]:='';
if (copy(f.description,1,1)='\') then begin
f.description:=copy(f.description,2,length(f.description)-1);
nl;
print('You may use up to four lines of 50 characters each.');
print('Enter a blank line to end.');
nl;
i:=1;
repeat
prt(cstr(i)+':');
mpl(50);
inputl(v.descr[i],50);
if (v.descr[i]='') then i:=4;
inc(i);
until ((i=5) or (hangup));
if (v.descr[1]<>'') then f.vpointer:=nfvpointer
else begin
nl; print('No verbose description saved.');
end;
nl;
end;
if (v.descr[1]='') then f.vpointer:=-1;
(* arcstuff(ok,convt,f.blocks,convtime,FALSE,uboards[fileboard]^.dlpath,fn);*)
doffstuff(f,fn,gotpts);
if (ok) then begin
newff(f,v);
sysoplog(#3#3+'Upload "'+sqoutsp(fn)+'" on '+memuboard.name);
end;
end;
end;
end;
end;
nfile;
end;
end;
fileboard:=oldboard;
end;
begin
savflistopt:=thisuser.flistopt; thisuser.flistopt:=1;
nl; print('Upload files into directories -'); nl;
abort:=FALSE; next:=FALSE;
sall:=pynq('Search all directories? ');
nl;
print('Enter a single "\" in front of description to enter a verbose');
print('description too. Enter "." to stop uploading, ".S" to skip this file,');
print('".N" to skip to the next directory, and ".D" to delete this file.');
if (sall) then begin
bn:=0;
while (not abort) and (bn<=maxulb) and (not hangup) do begin
if (fbaseac(bn)) then uploadfiles(bn,abort,next);
inc(bn);
wkey(abort,next);
if (next) then abort:=FALSE;
end;
end else
uploadfiles(fileboard,abort,next);
thisuser.flistopt:=savflistopt;
end;
end.