ORIGINAL DOC Update history: 1/1/88 - Frank da Cruz. Add exit(0); to end of main() to give good return code upon success. Modified 3/11/86 Howie Kaye -- Columbia University added UNIX and Microsoft C compatibility changed I/O to be buffered note: there is a bug built into the EOF handling which causes the output file to grow everytime a file is packed/unpacked. This is because 2 nulls and a space are added at the end of each run. As the data is past the end of the file, it does not affect the program produced. [1] Version adapted from the DEC-20 code to run on Lattice-C (v 2.14) on an IBM PC/AT under DOS 3.0. Alan Phillips, Lancaster University UK Original by Bill Catchings, Columbia University, July 1984 This program takes a file and encodes it into printable characters. These printable files can then be decoded by the programs MSPCBOOT.BAS or MSPCTRAN.BAS as the need may be. The file is encoded by taking three consecutive eight bit bytes and dividing them into four six bit bytes. An ASCII zero was then added to the resulting four characters. to make them all printable ASCII characters in the range of the character zero to the character underscore. In order to reduce the size of the file null repeat count was used. The null repeat count compresses up to 78 consecutive nulls into only two characters. This is done by using the character tilde (~) as an indication that a group of repetitive nulls has occured. The character following the tilde is number of nulls in the group. The number is also converted in to a printable character by adding an ASCII zero. The highest number of nulls is therefore the highest printable character tilde. This is equal to tilde minus zero nulls or 78 nulls. Because of the three byte to four byte encoding the repeat counting can only start with the first character of a three byte triplet. This C program was written specifically for the DEC-20 and as such will not easily be transported to another system. The main problem lies in the file I/O routines. It is necessary to make sure that untranslated eight bit bytes are input from the input file. The main change would be to make the OPEN statement reflect this for your particular system and brand of UNIX and C. The rest of the program should be transportable with little or no problems.