Re: [Freedos-user] TEE truncates file

2005-04-09 Thread Jim Hall
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=6595alloc_id=14396op=click
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


[Freedos-user] TEE truncates file

2005-03-01 Thread Jose Antonio Senna
 I have been using Tee to display and save output of a SMTP/POP client
named TCPMAIL. One example of command line is:
C:\!NET\TCPMAIL.EXE /q /d [EMAIL PROTECTED]  |C:\UTLS\TEE .\MAIL.LST
and noticed that it truncates the file (that is,some lines - perhaps 10 - that
appear last on screen are not saved to file) This does not depend on filename
nor on the tcpmail switches I use.
If I use standard DOS redirection ( or ),it saves OK the output (but then
I get no screen output,of course).
 Did anybody notice a similar problem ?
Regards
JAS



---
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=6595alloc_id=14396op=click
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user