home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!uvaarpa!adastra!mbs
- From: mbs@adastra.cvl.va.us (Michael B. Smith)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Console file handlers from within a Shell started program
- Distribution: world
- Message-ID: <mbs.0wou@adastra.cvl.va.us>
- References: <1992Aug11.080104.3354@syma.sussex.ac.uk> <1b7ea705.ARN22d0@prolix.pub.uu.oz.au> <14545@borg.cs.unc.edu> <1992Aug18.095812.27466@syma.sussex.ac.uk>
- X-NewsSoftware: GRn 1.16f (beta) by Mike Schwartz & Michael B. Smith
- Date: 28 Aug 92 17:28:03 EDT
- Organization: Private UUCP Node
- Lines: 47
-
- In article <1992Aug18.095812.27466@syma.sussex.ac.uk> mpue2@syma.sussex.ac.uk (James E. Talbut) writes:
- > method (that I think is better than any of the suggestions) but I have
- > also found the DOS 2.0 has stderr.
- >
- > Do any of the shells for the ami' actually use it?
- > With redirection?
-
- No, they don't use it because it isn't completely supported. There is a field
- in the Process structure for a standard error file, but AmigaDOS doesn't use
- it on V37.
-
- If you are going to try to use it, then code defensively, eg:
-
- struct Process *myproc = (struct Process *) FindTask (NULL);
- BPTR std_input = myproc->pr_CIS; // Input()
- BPTR std_output = myproc->pr_COS; // Output()
- BPTR std_error = myproc->pr_CES;
- int close_err = 0;
- int clear_err = 0;
-
- if (!std_error) {
- clear_err = 1;
- #if 0
- // if you want it to be the same as stdout
- std_error = std_output;
- #else
- // if you want it to be console output
- std_error = Open ("CONSOLE:", MODE_OLDFILE);
- close_err = 1;
- #endif
- myproc->pr_CES = std_error;
- }
- ...
- ...stuff...
- ...
- if (close_err) {
- Close (std_err);
- close_err = 0;
- }
- if (clear_err) {
- myproc->pr_CES = NULL;
- std_error = NULL;
- clear_err = 0;
- }
- --
- // Michael B. Smith
- \X/ mbs@adastra.cvl.va.us -or- uunet.uu.net!virginia.edu!adastra!mbs
-