delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/02/06:04:19

From: cgf AT bbc DOT com (Chris Faylor)
Subject: Re: Redirect the stderr GCC stream to file, executing from Ms-Dosshell
2 Oct 1997 06:04:19 -0700 :
Message-ID: <199710021245.IAA00665.cygnus.gnu-win32@hardy.bbc.com>
To: gnu-win32 AT cygnus DOT com, mark AT solcom DOT co DOT uk

>>2) Write a small program to redirect stderr to stdout and run its
>>arguments.
>
>Can you give me a quick hint what the small program mentioned in point
>no.  2 would look like.  How would I invoke this to re-direct the
>output of GCC to a file.

Create a file called 'stderr.c':

int
main(int argc, char **argv)
{
  dup2(1, 2);
  argv++;
  execvp(*argv, argv);
  perror(*argv);
  exit(1);
}

Compile this:

gcc -o stderr -g stderr.c

The program stderr will redirect all error output to the same place as
stdout:

stderr gcc -c stderr.c > gcc.out

This will probably only work with cygwin.dll programs, though.

cgf
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019