Jose Antonio Senna wrote:
I tested TEE with commands like DIR C: |TEE CDIR
MEM /d /f /x |TEE MAP
and it always truncates the files,that is,some lines that appear last on
screen do not appear in the file. I think this rules out the possibility
of screen output being a mix of stdout and stderr.
Can it be that TEE makes some copy mistake ?
This happens under kernel 2035, kwc38616 and also under DrDOS.
Regards
JAS



Just getting back to this ... a month late. My bad.

Ugh, I just looked at my TEE 1.0 source code, and it's fugly. Sorry about that. But at least it's easy to follow:

After TEE find the output file name, it calls outtee() like this:

outtee (stdin, pFile, stdout);

Where 'pFile' is the file that you want to save a copy of stdin to.


I don't know why I write outtee() as a standalone function, cause it's so short and simple. I wrote this when I was a student. Anyway, the outtee() function just does this (brackets added for readability):


  while ((ch = fgetc (pIn)) != EOF) {
    if ((fputc (ch, pSave) == EOF) || (fputc (ch, pOut) == EOF)) {
      return (FALSE);
    }
  }
  return (TRUE);

That is, outtee() will keep reading a character at a time from stdin (passed as 'pIn') until it reaches EOF. As it reads, it saves a copy of the input to 'pSave' and prints a copy to 'pOut' (this is written as saving a copy of the character to two output streams.) If there's an I/O error while writing to 'pSave' (i.e. disk full) or if there's some problem writing to stdout, then it quits.


I/O buffering could get in the way of this, I suppose.


-jh



--
I'm sorry my president's an idiot. I didn't vote for him.


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to