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-01  8:18 ` Chris Faylor
@ 1997-10-02  5:57   ` Chris Faylor
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Faylor @ 1997-10-02  5:57 UTC (permalink / raw)
  To: gnu-win32

In article < EHDp53.37t@bbc.com >, 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.

Just to follow up on my own points:  The command I gave originally
does work on NT 3.51.  That's all I'm running here.

Someone asked for the small program.  This is it:

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.

In a vain attempt to hold off on future messages, I'd like to point out
that I know that it is possible to make this into a much more sophisticated
program which takes an argument signifying a file for the stderr output.
It is possible to augment this program to shine your shoes and walk the dog.
There are undoubtedly much more sophisticated programs out there which
will do exactly what is required and do it intuitively without even the
necessity of typing the command at all.

Personally, I would again strongly suggest that anyone who can't use
bash for this should consider 4DOS.  It is a wonderful command line
shell which provides you all sorts of advanced capabilities lacking in
command.com or cmd.exe.

	http://www.jpsoft.com
-- 
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".

^ 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-09-30 23:23 Sergey Okhapkin
  1997-10-01  8:18 ` Chris Faylor
@ 1997-10-01 16:44 ` Rick Frink
  1 sibling, 0 replies; 7+ messages in thread
From: Rick Frink @ 1997-10-01 16:44 UTC (permalink / raw)
  To: gnu-win32; +Cc: rfrink

Hello,

  A related question, I think.  Once I have an executable, in the NT 4.0
environment, is it possible to redirect stdout ?  The problem that I've
run into is that I am executing a command from the NT PerfMon, but it
insists upon flashing a DOS window on screen...I even put my executable
in an NT CMD batch file, but it does not help.
Any clues ?
Thanks, in advance.

Rick Frink



At 10:22 AM 10/1/97 +0300, you 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.
>
>-- 
>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-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-02  5:57   ` Chris Faylor
  1997-10-01 16:44 ` Rick Frink
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Faylor @ 1997-10-01  8:18 UTC (permalink / raw)
  To: gnu-win32

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".

^ 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).