[Coco] Coco Digest, Vol 49, Issue 38
Willard Goosey
goosey at virgo.sdc.org
Fri Aug 17 01:12:07 EDT 2007
>From: "Paul Fitch" <pfitchjr at bellsouth.net>
>Date: Thu, 16 Aug 2007 06:01:50 -0400
>I have a Basic09 utility called delLF, but none of the others.
OK, I've put an archive called http://www.sdc.org/~goosey/os9/conv.lzh
on my webpage. It contains:
deff -- removes form feeds (which clear the screen!)
detab -- replaces tabs with spaces
nolf -- removed linefeeds (for lfcr terminated files, IE MS-DOS)
lf2cr -- transforms linefeeds into carriage returns (UNIX files)
These are all filters that read stdin and write stdout.
nolf and lf2cr are from the Net somewhere, probably on rtsi or
maltedmedia (in the old Princeton file archive). Hopefully I can be
forgiven for repackaging them this way.
Less forgivable, perhaps, is my source for deff and detab, which
follows. Can you spot the hideous style errors? ;-) Please forgive
me, this is OLD code. In my defense, I can only say that I was
writing these without the C compiler's docs, and wasn't sure how
complete a clib I had to work with.
Willard
--
Willard Goosey goosey at sdc.org
Socorro, New Mexico, USA
"I've never been to Contempt! Isn't that somewhere in New Mexico?"
--- Yacko
--------cut here--------
#include <stdio.h>
main(argc,argv)
char *argv[];
{
int c,ff=0x0c;
if(argc>1)
{
printf("deff -- remove form feeds from a pipe\n");
printf("Usage: deff < file1 > file2\n");
exit(0);
}
while((c=getchar()) != EOF)
{
if(c != ff)
putchar(c);
}
}
-----cut here----
#include <stdio.h>
#define TAB 8
main(argc,argv)
char *argv[];
{
int c,i,ff=0x09;
if(argc>1)
{
printf("detab -- remove tabs from a pipe\n");
printf("Usage: detab < file1 > file2\n");
exit(0);
}
while((c=getchar()) != EOF)
{
if(c != ff)
putchar(c);
else
{
for(i=0;i<TAB;i++)
putchar(' ');
}
}
}
More information about the Coco
mailing list