Thread View: net.micro.atari16
3 messages
3 total messages
Started by Brian Totty
Wed, 29 Oct 1986 18:31
Redirection & chaining
Author: Brian Totty
Date: Wed, 29 Oct 1986 18:31
Date: Wed, 29 Oct 1986 18:31
18 lines
1204 bytes
1204 bytes
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. --- Bri ARPA: g.bri@deep-thought.mit.edu UUCP: ...!eddie!bri -------
Re: Redirection & chaining
Author: 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
Re: Redirection & chaining
Author: D'arc Angel
Date: Sun, 02 Nov 1986 14:18
Date: Sun, 02 Nov 1986 14:18
23 lines
1417 bytes
1417 bytes
>
> 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
you want to use the Fdup and Pexec calls, but may i recommend the
Beckemeyer Micro Cshell to you, its not very expensive and will
allow you to do pipes, redirect output etc., but wait there's
more... it comes with a cc.prg that does exactly what you are
looking to do
--
----
These are days for the locust to eat
- Winston Churchill
Name: James M. Turner
Mail: Imagen Corp. 2650 San Tomas Expressway, P.O. Box 58101
Santa Clara, CA 95052-8101
AT&T: (408) 986-9400
UUCP: ...{decvax,ucbvax}!decwrl!imagen!turner
CompuServe: 76327,1575
GEnie : D-ARCANGEL
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads