This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about cygwin process behaviour and bash interactive mode


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]