From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28306 invoked by alias); 26 Oct 2008 18:17:34 -0000 Received: (qmail 28296 invoked by uid 22791); 26 Oct 2008 18:17:33 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 26 Oct 2008 18:16:58 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 73AA32A9654; Sun, 26 Oct 2008 14:16:56 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id e1Td-JDpr4lU; Sun, 26 Oct 2008 14:16:56 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3E5892A9629; Sun, 26 Oct 2008 14:16:56 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id E7359E7ACD; Sun, 26 Oct 2008 11:16:53 -0700 (PDT) Date: Sun, 26 Oct 2008 18:17:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA/RFC] new setting against auto-answer? (because "input not from terminal") Message-ID: <20081026181653.GB3617@adacore.com> References: <20081025010445.GC29038@adacore.com> <20081025154528.GE29998@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00649.txt.bz2 > > > #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