2 * stream filter to change 8 bit bytes into printable ascii
3 * computes the number of bytes, and three kinds of simple checksums
4 * incoming bytes are collected into 32-bit words, then printed in base 85
5 * exp(85,5) > exp(2,32)
6 * the ASCII characters used are between '!' and 'u'
7 * 'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
9 * Paul Rutter Joe Orost
10 * philabs!per petsd!joe
12 * WARNING: this version is not compatible with the original as sent out
13 * on the net. The original encoded from ' ' to 't'; which cause problems
14 * with some mailers (stripping off trailing blanks).
31 #define EN(c) (int) ((c) + '!')
39 if ((Crot & 0x80000000)) {
65 if(word < 0) { /* Because some don't support unsigned long */
67 word = word - (long)(85 * 85 * 85 * 85 * 32);
71 word = word - (long)(85 * 85 * 85 * 85 * 32);
73 charout(EN((word / (long)(85 * 85 * 85 * 85)) + tmp));
74 word %= (long)(85 * 85 * 85 * 85);
75 charout(EN(word / (85 * 85 * 85)));
76 word %= (85 * 85 * 85);
77 charout(EN(word / (85 * 85)));
79 charout(EN(word / 85));
88 if (ccount == MAXPERLINE) {
101 fprintf(stderr,"bad args to %s\n", argv[0]);
104 printf("xbtoa Begin\n");
106 while ((c = getchar()) != EOF) {
110 while (bcount != 0) {
113 /* n is written twice as crude cross check*/
114 printf("\nxbtoa End N %ld %lx E %lx S %lx R %lx\n", n, n, Ceor, Csum, Crot);