Xref: utzoo comp.sys.ibm.pc:34740 comp.unix.questions:16343 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!ken From: ken@cs.rochester.edu (Ken Yap) Newsgroups: comp.sys.ibm.pc,comp.unix.questions Subject: Re: anon ftp to Simtel Message-ID: <1989Sep15.053951.3736@cs.rochester.edu> Date: 15 Sep 89 05:39:51 GMT References: <11651@boulder.Colorado.EDU> <371@crash.cts.com> <1100@koko.CSUStan.EDU> Reply-To: ken@cs.rochester.edu Distribution: usa Organization: U of Rochester, CS Dept, Rochester, NY 14627, (716) 275-1448 Lines: 55 Keywords: ftp, simtel If you have used binary mode instead of tenex mode to a TOPS20 machine, don't despair. Here is bintnx.c to fix those files. It is short enough to post here. I didn't write it. I found it somewhere on Simtel. /*********************************************************************** Convert a TOPS-20 file transferred in FTP "binary" mode to "tenex" mode. In "binary" mode, we have 2 36-bit words in 9 8-bit bytes. In "tenex" mode, we want the top 32 bits of each 36-bit group, giving 8 8-bit bytes. Who knows what FTP did if the file had an odd number of 36-bit words. [08-Oct-87] ***********************************************************************/ #include main() { int c,d; for (;;) { c = getchar(); if (c == EOF) break; putchar(c); /* 0..7 */ c = getchar(); putchar(c); /* 8..15 */ c = getchar(); putchar(c); /* 16..23 */ c = getchar(); putchar(c); /* 24..31 */ d = getchar(); c = (d << 4); d = getchar(); c |= 0xFF & (d >> 4); putchar(c); /* 4..11 */ c = (d << 4); d = getchar(); c |= 0xFF & (d >> 4); putchar(c); /* 12..19 */ c = (d << 4); d = getchar(); c |= 0xFF & (d >> 4); putchar(c); /* 20..27 */ c = (d << 4); d = getchar(); c |= 0xFF & (d >> 4); putchar(c); /* 28..36 */ } }