Page 1 of 1

Useful C utility

Posted: January 16th, 1985, 1:11 am
by Info-Mac
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site uw-beaver
Path: utzoo!watmath!clyde!cbosgd!ulysses!allegra!bellcore!decvax!tektronix!uw-beaver!info-mac
From: info-mac@uw-beaver
Newsgroups: fa.info-mac
Subject: Useful C utility
Message-ID:
Date: Mon, 24-Dec-84 21:41:50 EST
Article-I.D.: uw-beave.297
Posted: Mon Dec 24 21:41:50 1984
Date-Received: Wed, 26-Dec-84 01:57:26 EST
Sender: daemon@uw-beaver
Organization: U of Washington Computer Science
Lines: 42

From: Joel Malman

For all those Mac users on ArpaNet TACs trying to use BinHex:

You probably know that you can not easily use macput and macget through the
TAC. What you can do is to read the BinHex program into a MacTerminal
document, but wait.... The TAC does funny things with trailing blanks. It
was suggested that if you append a vertical bar (|) to the end of each line
BinHex would not mind, therefore the trailing spaces would not be a
problem.

Here is a tiny C program (which can be used as a filter) to append the
vertical bar to the end of every line.

#include
main()
{
char s[100];
for (;;) {

if (gets(s) == 0)
exit (0);
printf ("%s|\n", s);
}
}

Once you compile this program (I called it hexfilter), you can use it like:

$ cat freeware.hcx | hexfilter > freeware.bar

- or -

$ hexfilter freeware.bar


You can then "cat" freeware.bar into a MacTerminal document and run the
BinHex program to convert it into a Mac application. Mac Get/Put not
required.

Hope this helps.

joel