Article View: net.micro.atari16
Article #2649Re: Redirection & chaining
From: Jwahar R. Bammi
Date: Sat, 01 Nov 1986 20:32
Date: Sat, 01 Nov 1986 20:32
44 lines
2429 bytes
2429 bytes
In article <12250715809.8.G.BRI@DEEP-THOUGHT.MIT.EDU> G.BRI%DEEP-THOUGHT@EDDIE.MIT.EDU (Brian Totty) writes:
>
> Could someone tell me if it is possible to redirect standard output
> to a file, and then chain to a program with its output dumped to the
> file. What I want to do, is make a GEM shell for the Alcyon C compiler
> along with build capabilities, to have a nice GEM c development
> package. I would like to have a way of grabbing any output from
> the program to check for errors, etc.
>
> Code samples to do the redirection would be great. Is there any
> way that this will work? Do programs return error codes to the calling
> program? Thanks.
>
The following code will redirect stdout to a file called 'foo'
dup = Fdup(0);
handle = Fopen("foo", 1); if handle < -5 ERROR;
Fforce(0, handle);
The following code executes another program and returns its exit
status
status = Pexec(0, "program.prg", tail, (char *)NULL);
where :-
program.prg : should be the complete pathname, including extention.
tail :
tail[0] = length of command tail;
tail[1...len] = Command tail (args) '\0' terminated
(char *)NULL for the environment means that the child process
inherits the environment of the parent. if you want
to pass an environment, it is of the form string of
strings, where each string if of the form "VAR=VALUE"
The child process inherits all the open handles of the parent, so
if you had redirected stdout in the parent, it will be redirected
in the child too.
** BUG ALERT **
Alcyon C (v4.14 and the earlier version) always returns success (0)
status, even if there were compilation errors.
--
usenet: .....!decvax!cwruecmp!bammi jwahar r. bammi
csnet: bammi@case
arpa: bammi%case@csnet-relay
compuServe: 71515,155
Technical Details
Message-ID:
<1653@cwruecmp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!clyde!cbatt!cwruecmp!bammiReferences:
<12250715809.8.G.BRI@DEEP-THOUGHT.MIT.EDU>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!clyde!cbatt!cwruecmp!bammi From: bammi@cwruecmp.UUCP (Jwahar R. Bammi) Newsgroups: net.micro.atari16 Subject: Re: Redirection & chaining Message-ID: <1653@cwruecmp.UUCP> Date: Sat, 1-Nov-86 15:32:13 EST Article-I.D.: cwruecmp.1653 Posted: Sat Nov 1 15:32:13 1986 Date-Received: Mon, 3-Nov-86 22:15:55 EST References: <12250715809.8.G.BRI@DEEP-THOUGHT.MIT.EDU> Reply-To: bammi@cwruecmp.UUCP (Jwahar R. Bammi) Organization: CWRU Dept. of Computer Engineering, Cleveland OH Lines: 44