public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Redirect the stderr GCC stream to file, executing from Ms-Dosshell
@ 1997-10-02  5:46 Chris Faylor
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Faylor @ 1997-10-02  5:46 UTC (permalink / raw)
  To: gnu-win32, mark

>>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@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Redirect the stderr GCC stream to file, executing from Ms-Dosshell
@ 1997-10-02  1:08 mark
  0 siblings, 0 replies; 7+ messages in thread
From: mark @ 1997-10-02  1:08 UTC (permalink / raw)
  To: gnu-win32, cgf

--- On Wed, 1 Oct 1997 15:17:27 GMT  Chris Faylor 
<cgf@bbc.com> wrote:

>In article 
<01BCCE53.F7289290@gater.krystalbank.msk.ru>,
>Sergey Okhapkin  <sos@prospect.com.ru> wrote:
>>Chris Faylor wrote:
>>> In article <199709301048.MAA00599@ammi.mclink.it>,
>>> Giandomenico De Sanctis <mc4420@mclink.it> wrote:
>>> >How to redirect the stderr stream to a file, 
running GCC from MS-Dos
>>> >command prompt, and not from Unix-like shell as 
bash??
>>> 
>>> gcc whatever 2>wherever
>>
>>This works with NT4.0 cmd.exe only, but not with 
95's command.com.
>
>Right.  Sorry to have not mentioned that.
>
>Other alternatives are:
>
>1) Use 4DOS ( http://www.jpsoft.com ), which allows 
'>&' for redirection.
>
>2) Write a small program to redirect stderr to stdout 
and run its
>   arguments.
>
>3) bash -c 'exec gcc whatever 2>wherever'
>-- 
> http://www.bbc.com/	cgf@bbc.com		
	"Strange how unreal
>VMS=>UNIX Solutions	Boston Business 
Computing	 the real can be."
>-
>For help on using this list (especially 
unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: 
"help".
>

-----------------End of Original 
Message-----------------

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.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: Redirect the stderr GCC stream to file, executing from Ms-Dosshell
@ 1997-10-01 12:32 John Cook
  0 siblings, 0 replies; 7+ messages in thread
From: John Cook @ 1997-10-01 12:32 UTC (permalink / raw)
  To: 'gnu-win32@cygnus.com'

This works in NT3.51 also.  I stumbled upon it 
accidentally when I was trying to redirect stdout 
of an executable with a final argument of '2' 
and redirected stderr instead!

--John

>----------
>From: 	Sergey Okhapkin[SMTP:sos@prospect.com.ru]
>Sent: 	Wednesday, October 01, 1997 12:22 AM
>To: 	gnu-win32@cygnus.com; 'cgf@bbc.com'
>Subject: 	RE: Redirect the stderr GCC stream to file, executing from
>Ms-Dosshell
>
>Chris Faylor wrote:
>> In article <199709301048.MAA00599@ammi.mclink.it>,
>> Giandomenico De Sanctis <mc4420@mclink.it> wrote:
>> >How to redirect the stderr stream to a file, running GCC from MS-Dos
>> >command prompt, and not from Unix-like shell as bash??
>> 
>> gcc whatever 2>wherever
>
>This works with NT4.0 cmd.exe only, but not with 95's command.com.
>
>-- 
>Sergey Okhapkin, http://www.lexa.ru/sos
>Moscow, Russia
>Looking for a job.
>
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: Redirect the stderr GCC stream to file, executing from Ms-Dosshell
@ 1997-09-30 23:23 Sergey Okhapkin
  1997-10-01  8:18 ` Chris Faylor
  1997-10-01 16:44 ` Rick Frink
  0 siblings, 2 replies; 7+ messages in thread
From: Sergey Okhapkin @ 1997-09-30 23:23 UTC (permalink / raw)
  To: gnu-win32, 'cgf@bbc.com'

Chris Faylor wrote:
> In article < 199709301048.MAA00599@ammi.mclink.it >,
> Giandomenico De Sanctis <mc4420@mclink.it> wrote:
> >How to redirect the stderr stream to a file, running GCC from MS-Dos
> >command prompt, and not from Unix-like shell as bash??
> 
> gcc whatever 2>wherever

This works with NT4.0 cmd.exe only, but not with 95's command.com.

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia
Looking for a job.


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1997-10-02  5:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-02  5:46 Redirect the stderr GCC stream to file, executing from Ms-Dosshell Chris Faylor
  -- strict thread matches above, loose matches on Subject: below --
1997-10-02  1:08 mark
1997-10-01 12:32 John Cook
1997-09-30 23:23 Sergey Okhapkin
1997-10-01  8:18 ` Chris Faylor
1997-10-02  5:57   ` Chris Faylor
1997-10-01 16:44 ` Rick Frink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).