home *** CD-ROM | disk | FTP | other *** search
- /*
- This module was created because of the need for error
- output when flist is 'run' or 'runback'ed.
- Because stderr is no a longer valid DOS filehandle, If flist
- detects an error and try's to output an error message to stderr,
- and we are running as a background task, the ouput to stderr will
- crash the machine. This is not user friendly. My solution is to
- open my own filehandle to stderr as a file in RAM:. While this
- may not be the best solution, it will work in all cases that the
- ramdrive exists. If the ram: device is not available, then the output
- goes to NIL:.
-
- Drawbacks:
- You can never tell when you are run in the background, so you
- have to ALWAYS send output to this file.
-
- Written completely - I stole no code before it's time, by
- Stephen (Raz) Berry 1/2/89
-
- */
-
- #include <stdio.h>
-
- Redirecterror(stderror)
- struct FileHandle *stderror;
- {
- struct FileHandle *newerror,*newout,*newin;
-
- newerror = freopen("RAM:flist.errors","a",stderr);
- newin = freopen("CON:0/0/1/1/DummyIO","a",stdin);
- newout = freopen("RAM:flist.out","a",stdout);
-
- if (newerror == NULL)
- newerror = freopen("NIL:","a",stderr);
-
- if (newin == NULL)
- newin = freopen("NIL:","a",stdin);
-
- if (newout == NULL)
- newout = freopen("NIL:","a",stdout);
- }
-