home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / ibm / pc / programm / 547 < prev    next >
Encoding:
Internet Message Format  |  1992-11-05  |  3.6 KB

  1. Xref: sparky comp.sys.ibm.pc.programmer:547 comp.os.msdos.programmer:10364
  2. Newsgroups: comp.sys.ibm.pc.programmer,comp.os.msdos.programmer
  3. Path: sparky!uunet!interlan.InterLan.COM!rimail.interlan.com!klosp
  4. From: klosp@rimail.interlan.com (Patrick Klos)
  5. Subject: Re: Redirecting STDERR
  6. Message-ID: <klosp.25.720972094@rimail.interlan.com>
  7. Lines: 102
  8. Sender: news@Interlan.com
  9. Organization: Klos Technologies, Inc. (603) 424-0138
  10. References: <1d9g03INNq53@golem.wcc.govt.nz>
  11. Date: Thu, 5 Nov 1992 14:01:34 GMT
  12.  
  13. In article <1d9g03INNq53@golem.wcc.govt.nz> dennis_c@kosmos.wcc.govt.nz writes:
  14. >From: dennis_c@kosmos.wcc.govt.nz
  15. >Subject: Redirecting STDERR
  16. >Date: 4 Nov 1992 21:40:19 GMT
  17. >I know this must have been asked 1000 times before, but I haven't been
  18. >able to find the answer.  I would appreciate it if someone can just
  19. >point me to the relevant information.
  20. >
  21. >How can I redirect (or just suppress) output from a program that is
  22. >going to stderr rather than stdout?
  23. >
  24. >I have a program (no source code) that insists on writing liberal
  25. >amounts of information on what it's doing on the screen.  Redirecting
  26. >stdout only gets rid of some of the verbosity.  I know stderr can be
  27. >redirected if the program is called from within another program, but
  28. >I don't want to do that because space is at a premium.
  29. >
  30. >Ideally, I need a command that I could use from a batch file before
  31. >and after running the program that would send all stderr output to
  32. >somewhere other than the screen.
  33. >
  34. >Any help will be much appreciated.
  35. >
  36. >Chris Dennis                     dennis_c@kosmos.wcc.govt.nz
  37. >Wellington, New Zealand
  38.  
  39. Here's a dirty little program that easily forces anything from STDERR to 
  40. STDOUT.  Maybe this will do the trick for you!
  41.  
  42.  
  43.         Page    56,132
  44.         Title   FIXERR - Redirect STDERR to STDOUT
  45.  
  46. CODE    Segment Public  'Code'
  47.  
  48.         Assume  CS:CODE,DS:CODE,ES:CODE,SS:CODE
  49.  
  50.         Org     00100H
  51.  
  52. START   Proc    Near
  53.         Lea     SP,STACK_TOP            ;
  54.  
  55.         Xor     AX,AX                   ;
  56.         Mov     ES,AX                   ;
  57.  
  58.         Assume  ES:Nothing
  59.  
  60.         Cli                             ;
  61.         Mov     AX,ES:[021H*4+0]        ;
  62.         Mov     Word Ptr OLD_INT21+0,AX ;
  63.         Mov     AX,ES:[021H*4+2]        ;
  64.         Mov     Word Ptr OLD_INT21+2,AX ;
  65.  
  66.         Mov     AX,Offset CODE:INT21    ;
  67.         Mov     ES:[021H*4+0],AX        ;
  68.         Mov     ES:[021H*4+2],CS        ;
  69.         Sti                             ;
  70.  
  71.         Mov     AX,03100H               ;T.S.R.
  72.         Lea     DX,CODE_END+15          ;
  73.         Mov     CL,4                    ;
  74.         Shr     DX,CL                   ;
  75.         Int     021H                    ;
  76. START   Endp
  77.  
  78.         Assume  CS:CODE,DS:Nothing,ES:Nothing,SS:Nothing
  79.  
  80. OLD_INT21 Dd    0                       ;
  81.  
  82. INT21   Proc    Far
  83.         Cmp     AH,040H                 ;
  84.         Jne     INT21z                  ;
  85.         Cmp     BX,2                    ;
  86.         Jne     INT21z                  ;
  87.         Dec     BX                      ;
  88. INT21z: Jmp     OLD_INT21               ;
  89. INT21   Endp
  90.  
  91.         Even
  92. CODE_END Label Word
  93.         Dw      512 Dup (?)             ;
  94. STACK_TOP Label Word
  95.  
  96. CODE    Ends
  97.         End     START
  98.  
  99.  
  100.  
  101.  
  102. Note that it's a .COM file.  Build it like this:
  103.  
  104.     
  105.     masm fixerr;
  106.     link fixerr;
  107.     exe2bin fixerr.exe fixerr.com
  108.  
  109. Good luck!
  110. ========================================================================
  111.         Patrick Klos                 Internet: klosp@rimail.interlan.com
  112.         Klos Technologies, Inc.      Compuserve: 71521,145
  113.         (603) 424-0138
  114. ========================All opinions are my own!========================
  115.