[net.micro.amiga] EOF, SEEK, and fast output to PAR: and SER:

rokicki@Navajo.ARPA (Tomas Rokicki) (04/13/86)

First, a complaint---why the heck does ctl-\ (EOF) return a new line
and then EOF?  (Try typing it to the CLI prompt, you'll see what I
mean.)  That extra new line is messing things up!  Can this be fixed?
Please?

Secondly, Seek seems to take an inordinate amount of time.  When reading
a file, it is much faster to have a for loop read one hundred characters,
than to execute a Seek forward one hundred bytes.  Another kludge required
to get around this.

Finally, for those of you driving SER: or PAR: from C, there is a way to
get much faster output than the default single-character buffered output.
Stick in the following magic lines:

if ((fp=fopen(iname,"r"))==NULL)
   err("! hey, buddy, give me a break") ;  /* this your code */
if (fp->_buff==NULL)
   if ((fp->_buff=malloc(BUFSIZ))!=NULL) {
      fp->_buflen = BUFSIZ ;
      fp->_flags |= _ALLBUF ;
   }

Don't forget to declare malloc (char *malloc()) and include stdio.h.  This
works with Manx; haven't tested it with Lattice, and makes things incredibly
faster.  For an explanation of how it works, I'd have to explain the I/O
library, and since that belongs to Manx, I'm not sure I can legally do that.
It won't screw up i/o to disk, either, so I use it in any open that can go
to the printer, serial port, or disk.  I believe it will mess up console
I/O (buffering things that go to the screen in huge chunks is not generally
wise), so be careful.

I've been playing with the blitter lately; that thing is incredibly fast.