This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA/RFC] new setting against auto-answer? (because "input not from terminal")


> > >   #define ISATTY(fd) (isatty(fd) && lseek(fd,SEEK_CUR,0) == -1)
> > > 
> > > and then use ISATTY instead of isatty?
> > 
> > That wouldn't work, unfortunately, because the problem is that isatty 
> > returns zero.
> 
> What does lseek return with the above arguments?

Here are some results:

   lseek (fd, 0, SEEK_CUR) -> 0
   lseek (fd, -1, SEEK_CUR) -> 0
   lseek (fd, 1, SEEK_CUR) -> 1

The results are identical regardless of whether GDB is started 
in interactive mode or in batch mode (commands fed through a pipe).

-- 
Joel


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