Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!letni!ataritx!atari!apratt From: apratt@atari.UUCP (Allan Pratt) Newsgroups: comp.sys.atari.st Subject: Re: saving GCC errors (includes source!) Keywords: question, save GCC compile errors Message-ID: <2784@atari.UUCP> Date: 17 Dec 90 22:46:47 GMT References: <18949@netcom.UUCP> Organization: Atari Corp., Sunnyvale CA Lines: 113 rcb@netcom.UUCP (Roy Bixler) writes: >I am using GNU C inside of Gulam 1.04.05 ... >re-direct the standard error output to a file.. Here's a program that does what you're after. It compiles under MWC, GCC, and Alcyon C. It works best under Gulam because Gulam implements shell_p, a way for a child of Gulam to say "here, Gulam, please execute this command line for me." It may not be the best 'c' you've seen, but it works. (Interesting note: the MWC executable is 3622+690+188=4500 bytes text+data+BSS (almost all text; real small), the Alcyon C executable is 6834+1434+9124=17392 bytes (half is GEM binding BSS), and the GCC executable is 19592+904+3812=24308 bytes (just big). The GCC "system" call from Bammi's library is by far the most complex; I don't know what else makes it so much larger. I tried to use "minimal.h" for the GCC version but it didn't work: system() must use something from main.c.) ============================== rd2.c ============================== /* * perform a system() call, but first, redirect handle 2 to a file. * See the umsg string for usage. * Written by Allan Pratt of Atari Corp., Dec. 17, 1990 and placed * in the public domain without any warranty, expressed or implied. * Your mileage may vary. */ #include void usage(); int main(argc,argv) int argc; char *argv[]; { int oh2; int nh2; long err, akp_system(); int i; char buf[1024]; if (argc < 3) usage(); oh2 = Fdup(2); nh2 = Fcreate(argv[1],0); Fforce(2,nh2); strcpy(buf,argv[2]); for (i=3; i