home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.ibm.pc.programmer:547 comp.os.msdos.programmer:10364
- Newsgroups: comp.sys.ibm.pc.programmer,comp.os.msdos.programmer
- Path: sparky!uunet!interlan.InterLan.COM!rimail.interlan.com!klosp
- From: klosp@rimail.interlan.com (Patrick Klos)
- Subject: Re: Redirecting STDERR
- Message-ID: <klosp.25.720972094@rimail.interlan.com>
- Lines: 102
- Sender: news@Interlan.com
- Organization: Klos Technologies, Inc. (603) 424-0138
- References: <1d9g03INNq53@golem.wcc.govt.nz>
- Date: Thu, 5 Nov 1992 14:01:34 GMT
-
- In article <1d9g03INNq53@golem.wcc.govt.nz> dennis_c@kosmos.wcc.govt.nz writes:
- >From: dennis_c@kosmos.wcc.govt.nz
- >Subject: Redirecting STDERR
- >Date: 4 Nov 1992 21:40:19 GMT
- >I know this must have been asked 1000 times before, but I haven't been
- >able to find the answer. I would appreciate it if someone can just
- >point me to the relevant information.
- >
- >How can I redirect (or just suppress) output from a program that is
- >going to stderr rather than stdout?
- >
- >I have a program (no source code) that insists on writing liberal
- >amounts of information on what it's doing on the screen. Redirecting
- >stdout only gets rid of some of the verbosity. I know stderr can be
- >redirected if the program is called from within another program, but
- >I don't want to do that because space is at a premium.
- >
- >Ideally, I need a command that I could use from a batch file before
- >and after running the program that would send all stderr output to
- >somewhere other than the screen.
- >
- >Any help will be much appreciated.
- >
- >Chris Dennis dennis_c@kosmos.wcc.govt.nz
- >Wellington, New Zealand
-
- Here's a dirty little program that easily forces anything from STDERR to
- STDOUT. Maybe this will do the trick for you!
-
-
- Page 56,132
- Title FIXERR - Redirect STDERR to STDOUT
-
- CODE Segment Public 'Code'
-
- Assume CS:CODE,DS:CODE,ES:CODE,SS:CODE
-
- Org 00100H
-
- START Proc Near
- Lea SP,STACK_TOP ;
-
- Xor AX,AX ;
- Mov ES,AX ;
-
- Assume ES:Nothing
-
- Cli ;
- Mov AX,ES:[021H*4+0] ;
- Mov Word Ptr OLD_INT21+0,AX ;
- Mov AX,ES:[021H*4+2] ;
- Mov Word Ptr OLD_INT21+2,AX ;
-
- Mov AX,Offset CODE:INT21 ;
- Mov ES:[021H*4+0],AX ;
- Mov ES:[021H*4+2],CS ;
- Sti ;
-
- Mov AX,03100H ;T.S.R.
- Lea DX,CODE_END+15 ;
- Mov CL,4 ;
- Shr DX,CL ;
- Int 021H ;
- START Endp
-
- Assume CS:CODE,DS:Nothing,ES:Nothing,SS:Nothing
-
- OLD_INT21 Dd 0 ;
-
- INT21 Proc Far
- Cmp AH,040H ;
- Jne INT21z ;
- Cmp BX,2 ;
- Jne INT21z ;
- Dec BX ;
- INT21z: Jmp OLD_INT21 ;
- INT21 Endp
-
- Even
- CODE_END Label Word
- Dw 512 Dup (?) ;
- STACK_TOP Label Word
-
- CODE Ends
- End START
-
-
-
-
- Note that it's a .COM file. Build it like this:
-
-
- masm fixerr;
- link fixerr;
- exe2bin fixerr.exe fixerr.com
-
- Good luck!
- ========================================================================
- Patrick Klos Internet: klosp@rimail.interlan.com
- Klos Technologies, Inc. Compuserve: 71521,145
- (603) 424-0138
- ========================All opinions are my own!========================
-