delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/04/04/02:23:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,TO_NO_BRKTS_PCNT
X-Spam-Check-By: sourceware.org
Date: Wed, 4 Apr 2012 08:23:05 +0200
From: Denis Excoffier <cygwin AT Denis-Excoffier DOT org>
To: cygwin AT cygwin DOT com
Subject: getpass and /dev/tty
Message-ID: <20120404062329.GA3700@qp9482>
MIME-Version: 1.0
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Hello!

Would it be possible that getpass() first reads on /dev/tty before
defaulting to stdin?

% uname -a
CYGWIN_NT-5.1 edited 1.7.12(0.260/5/3) 2012-04-03 10:24 i686 Cygwin
% ls /dev/tt*
/dev/tty  /dev/ttyS0  /dev/ttyS2  /dev/ttyS3
% cat foo.c
#include <stdio.h>
#include <unistd.h>

int main () {
  fprintf (stderr, "Press <Return> to continue . . .\n");
  getpass ("");
  return 0;
};
% gcc -O -o ./foo foo.c
% ./foo
Press <Return> to continue . . .
[here you press Return]

% ./foo < /dev/null
Press <Return> to continue . . .

%

[for the second run of ./foo, you cannot press Return]



Regards,

Denis Excoffier.

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

- Raw text -


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