home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11559 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  3.1 KB

  1. Path: sparky!uunet!gatech!gatech!wa4mei!nanovx!mycro!scott
  2. From: scott@mycro.UUCP (Scott C. Sadow)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Normal MSDOS multitasking!
  5. Message-ID: <1992Dec19.112545@mycro.UUCP>
  6. Date: 19 Dec 92 16:25:45 GMT
  7. References: <DAVIS.92Dec16172346@pacific.mps.ohio-state.edu> <1ghb1vINNccb@ub.d.umn.edu> <9212142475@fcshome.UUCP>
  8. Lines: 64
  9.  
  10. In article <DAVIS.92Dec16172346@pacific.mps.ohio-state.edu>, news@pacific.mps.ohio-state.edu writes:
  11. >Hi,
  12. >
  13. >    I'd like to see a tee program which will do something like:
  14. >
  15. >C:\> make | tee > out
  16. >
  17. >The tee programs that I have seen are worthless in this regard because MSDOS
  18. >does not multitask.  So what about:
  19. >
  20. >C:\> tee make out
  21. >
  22. >Here tee runs make sending the output to both stdout and to the file out.  To
  23. >do this, tee would have to hook the appropriate DOS int 21 write string to
  24. >stdout call.  This seems doable but I have not seen it done.
  25. >
  26.  
  27.  
  28. Here is the program I use. Syntax is simple. On any command that pipes the
  29. output (stdout) to a file, put "TEE" at the beginning of the line. i.e.
  30. "TEE MAKE > OUT". This is the same as "MAKE > OUT", but whatever "MAKE"
  31. sends to stdout is displayed on the screen. You can also use
  32. "TEE <cmd> | MORE", because "|" really sends stdout to a file. Note: some
  33. programs buffer the output, so you will see a burst of data, perhaps 512
  34. bytes, every so often.
  35.  
  36. This program works by running "COMMAND.COM /C <arg>". It traps DOS
  37. interrupts 02H (PutChar), 06H (Direct Console I/O) 09H (PrintString) and
  38. 40H (WriteFile). If stdout is a file, then TEE uses bios routines to
  39. output the character(s) to the screen, and then calls the normal DOS
  40. routine to complete the call. For WriteFile, TEE sees if the file handle
  41. is stdout.
  42.  
  43.  
  44. begin 400 tee.exe
  45. M35K0 0(    @    __\9 $    "W    /@    $ ^S!J<@              
  46. M                                                            
  47. M                                                            
  48. M                                                            
  49. M                                                            
  50. M                                                            
  51. M                                                            
  52. M                                                            
  53. M                                                            
  54. M                                                            
  55. M                                                            
  56. M                      " _ )T%(#\!G0C@/P)="J _$!T1"[_+J4 Z%X 
  57. M=?904[0.NP, BL+-$%M8Z^> ^O]TXNA% '7=Z^7H/@!UUE!35K0.NP, B_**
  58. M!$8\)'0$S1#K]5Y;6.N\@_L!=;?H&@!ULE!345:T#KL# (ORB@1&S1#B^5Y9
  59. M6UCKFE!34K@ 1+L! )PN_QZE /;"@%I;6,,RP+1+S2&P(2[%%J4 M"7-(;1,
  60. MS2$                       "A+  NHZD +HP>K0"X@  NHZL +HP>L0"X
  61. M7  NHZ\ +HP>M0"X;  NH[, B]R#PP_!ZP2,T /8C-@KV+1*S2%RGBZ+-JL 
  62. MB@PR[8/! H $ P/QB_Z#QP/]\Z2P(*JP0ZJP+ZJP(;0US2$NC :G "Z)'J4 
  63. ML"&,RH[:N@  M"7-(2Z.!JD ,_^,P4F.V8L. P#!X02X0T_\)CL%=!(F.P5T
  64. M!D?B^.DX_R: ??\ =?,F@7T"35-UZR:!?010177C)H%]!D,]==N#QPB,PH[:
  65. MB]>,RX[#NZD Z0#_                                            
  66. ?                                            
  67.  
  68. end
  69.  
  70.  
  71.    Scott C. Sadow
  72.    scott@mycro.UUCP
  73.    ...gatech!nanovx!mycro!scott
  74.