[net.micro.cpm] Aztec CII I/O Redirection

keithr@azure.UUCP (Keith Rule) (03/08/84)

am. The difference is amazing.
  
One word of caution, buffering I/O may cause problems if you
redirect  I/O to some character device. Some things to think
about when you are mucking in "croot.c" might be adding  the
ability  to  redirect  to  stderr  using  "2>" or maybe even
adding psuedo-pipes. I've tried both ideas and they seem  to
work  (though  psuedo-pipes  made  "croot.o"  larger  than I
wished for everyday use).
  
                         Good Luck
  
                         Keith Rule
  
               textronix!tekmdp!azure!keithr
  
  
  

keithr@azure.UUCP (Keith Rule) (03/26/84)

(Reposting)
 
The problem of slow redirected I/O  in Aztec C is caused  by
I/O  being  unbuffered. This causes each byte of output that
is redirected to a file to be written seperately (Read  sec-
tor, place byte, write sector). No wonder is so slow.
 
The solution I've been using is simply changing  the  unbuf-
fered  I/O  into  buffered I/O. I've also added a few exten-
tions  which  are  "2>"  (redirect  stderr),  "2>>"  (append
stderr) and ">>" (append stdout).
 
To implement the fix find the file called "CROOT.C"  in  the
source   to  your  library.  It  contains  a  function  call
"Croot()".  Replace the while loop that starts  with  "while
(Argc < MAXARGS)" with the following--
 
 
        while (Argc < MAXARGS) {
                while (*cp == ' ' || *cp == '')
                   ++cp;
                if (*cp == NULL)
                   break;
                k = -1;
                switch (*cp) {
                   case '>':
                        if (*(cp+1)=='>') {
                           ++cp;
                           k = 1;
                        } else
                           k = 1;
                        break;
                   case '<':
                        k = 0;
                        break;
                   case '2':
                        if (*(cp+1)) == '>') {
                           ++cp;
                           if (*(cp+1) == '>') {
                              ++cp;
                              k = 5;
                           } else
                              k = 2;
                        }