delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/14/14:01:28

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Sat, 14 Sep 2002 14:01:31 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Question about cygwin process behaviour and bash interactive mode
Message-ID: <20020914180131.GB12553@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <LPEHIHGCJOAIPFLADJAHKELHCMAA DOT chris AT atomice DOT net> <Pine DOT GSO DOT 4 DOT 44 DOT 0209141335040 DOT 21486-100000 AT slinky DOT cs DOT nyu DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.44.0209141335040.21486-100000@slinky.cs.nyu.edu>
User-Agent: Mutt/1.4i

On Sat, Sep 14, 2002 at 01:52:42PM -0400, Igor Pechtchanski wrote:
>Quoting from isatty source (newlib/libc/posix/isatty.c:12):
>
>  if (fstat (fd, &buf) < 0)
>    return 0;
>  if (S_ISCHR (buf.st_mode))
>    return 1;
>  return 0;
>
>So, isatty() simply checks if the file descriptor given is a character
>device or not.  I'm not sure quite how this works with windows programs
>started from bash.

Just a clarification:  The 'isatty' that cygwin exports comes from
winsup/syscalls.cc:

  extern "C" int
  isatty (int fd)
  {
    int res;
    sigframe thisframe (mainthread);

    cygheap_fdget cfd (fd);
    if (cfd < 0)
      res = 0;
    else
      res = cfd->is_tty ();
    syscall_printf ("%d = isatty (%d)", res, fd);
    return res;
  }

It specifically checks if the fd in question is a tty.

I have no comments for the rest of the discussion but I wanted to make
this point clear.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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