delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/12/20:57:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Daniel Miller <dan AT imi-test DOT com>
Subject: RE: Bash: when is WinXP not WinXP??
Date: Wed, 13 Oct 2004 00:57:19 +0000 (UTC)
Organization: Cathartes Aura
Lines: 38
Message-ID: <Xns9580B6A784B22dancarddupercom@80.91.229.5>
References: <Xns958070E64AD1Adancarddupercom AT 80 DOT 91 DOT 229 DOT 5> <NUTMEGd8PXibjXt5tX800000407 AT NUTMEG DOT CAM DOT ARTIMI DOT COM>
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: adsl-68-123-127-203.dsl.snfc21.pacbell.net
User-Agent: Xnews/06.08.25
X-IsSubscribed: yes

"Dave Korn" <dk AT artimi DOT com> wrote in
news:NUTMEGd8PXibjXt5tX800000407 AT NUTMEG DOT CAM DOT ARTIMI DOT COM: 

>> -----Original Message-----
>> From: cygwin-owner On Behalf Of Daniel Miller
>> Sent: 12 October 2004 19:06
> 
>> under Bash.  Under WXPPro/Bash it worked fine.  However, under Home 
>> edition, my utility apparently thinks its output is being 
>> redirected, so it tries to generate the output as html code 
>> (to preserve colors), which of course generates tons of garbage.
> 
>   Then your code has a bug.  Whatever technique it is using to decide
>   if it 
> is being redirected is wrong.  In fact, I'd go so far as to say that
> changing your output format if you think you're being redirected is
> wrong full stop.  Let the output format be under control of a
> command-line switch. If someone is going to decide to redirect the
> output, they can decide to give the option for html output as well.
> 
Well, the code that's causing me to think I'm redirected is:

   hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
   PERR(hStdOut != INVALID_HANDLE_VALUE, "GetStdHandle");
   bSuccess = GetConsoleScreenBufferInfo(hStdOut, &sinfo) ;
   if (bSuccess == false) {
    	 //  this returned "The handle is invalid"
      fprintf(stderr, "gcsbi error: %s\n", get_system_message()) ;
      exit(1) ;
      redirected = 1 ;
      return ; 
   }

So even if I did as you suggest above, I would still have to terminate my 
program when GetConsoleScreenBufferInfo failed... Now *why* is that 
function failing on hStdOut, which was not itself invalid (since 
GetStdHandle succeeded)... ??  And again, why only on the Home machine, 
not on the Pro machine??


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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