home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
pibterm
/
pibt3sp1
/
adjustfn.pas
next >
Wrap
Pascal/Delphi Source File
|
1985-10-03
|
4KB
|
100 lines
(*----------------------------------------------------------------------*)
(* Adjust_FN --- Adjust file name of incoming file *)
(*----------------------------------------------------------------------*)
PROCEDURE Adjust_FN( FileRef : AnyStr;
VAR Drive : AnyStr;
VAR FileName : AnyStr;
VAR FileType : AnyStr );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Adjust_FN *)
(* *)
(* Purpose: Adjust file name of incoming file for Kermit *)
(* *)
(* Calling Sequence: *)
(* *)
(* *)
(* Adjust_FN( FileRef : AnyStr; *)
(* VAR Drive : AnyStr; *)
(* VAR FileName : AnyStr; *)
(* VAR FileType : AnyStr ); *)
(* *)
(* Remarks: *)
(* *)
(* This routine prevents an existing file from being overwritten *)
(* by changing the file name. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Insert_Pos : INTEGER;
Count : INTEGER;
BEGIN (* Adjust_FN *)
FOR Count := 1 TO LENGTH( FileRef ) DO
IF ( FileRef[Count] IN ['a'..'z'] ) THEN
FileRef[Count] := CHR( ORD( FileRef[Count] ) AND $DF );
IF ( POS('.', FileRef) <> 0 ) THEN
BEGIN
FileName := COPY( FileRef, 1, POS('.', FileRef) - 1 );
FileType := COPY( FileRef, POS('.', FileRef) + 1, 3 );
END
ELSE
BEGIN
FileName := FileRef;
FileType := '';
END;
IF ( POS(':', FileName) <> 0 ) THEN
BEGIN
Drive := COPY( FileName, 1, POS(':', FileName) - 1 );
DELETE( FileName, 1, POS(':', FileName) );
IF ( FileName = '' ) THEN
BEGIN
FileName := '*';
FileType := '*';
END;
END
ELSE
Drive := '!';
WHILE ( POS('*',FileName) <> 0 ) DO
BEGIN
Insert_Pos := POS('*', FileName);
DELETE( FileName, Insert_Pos, 1 );
WHILE ( LENGTH(FileName) < 8 ) DO
INSERT( '?', FileName, Insert_Pos );
END;
WHILE ( POS('*',FileType) <> 0 ) DO
BEGIN
Insert_Pos := POS('*', FileType);
DELETE( FileType, Insert_Pos, 1 );
WHILE ( LENGTH(FileType) < 3 ) DO
INSERT( '?', FileType, Insert_Pos );
END;
WHILE ( LENGTH(FileName) < 8 ) DO
FileName := FileName + ' ';
WHILE ( LENGTH(FileType) < 3 ) DO
FileType := FileType + ' ';
END (* Adjust_FN *);
ə