home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
old
/
ckermit5a190
/
ckipct.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-11-22
|
2KB
|
66 lines
/*
* CKIPCT.REXX
*
* This program is a de-boo'er for the Amiga, written in Amiga REXX. It is
* intended for use as a decoder for a BOO file of Amiga Kermit.
*
* Written by Stephen Walton, 20 October 1990. Based on MSBPCT.C
*
*/
parse arg InName
if InName = '' then do
say 'usage: rx ckipct boo-file'
exit 10
end
if ~open(InFile,InName,'Read') then do
say 'Can''t open file' InName
exit 10
end
OutName = readln(InFile)
if Outname = '' then do
say 'Illegal BOO file'
exit
end
call open OutFile, OutName,'Write'
say 'Creating file' OutName 'from input BOO file' InName
NULLCHAR = fixchar('~')
line = readln(InFile)
do while ~eof(InFile)
do while length(line) >= 2
if fixchar(left(line,1)) = NULLCHAR then do /* Handle null compress */
line = substr(line,2)
do fixchar(left(line,1)) /* For repeat count... */
call writech(OutFile,d2c(0)) /* ...output nulls */
end
line = substr(line,2) /* Trim off output count */
end
else do /* Decode a quad */
a = fixchar(left(line,1))
b = fixchar(substr(line,2,1))
c = fixchar(substr(line,3,1))
d = fixchar(substr(line,4,1))
call writech(OutFile,d2c(((a*4) + (b%16))//256))
call writech(OutFile,d2c(((b*16) + int(c/4))//256))
call writech(OutFile,d2c((c*64 + d)//256))
line = substr(line,5) /* Trim off the quad */
end
end
line = readln(InFile)
end
call close(InFile)
call close(OutFile)
exit
fixchar: procedure
parse arg c
return c2d(c) - c2d('0')