X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetpass.c;h=226be155b19ec9807ee02ed1df966e83990c0ddc;hb=2df78ba2ce9441243a0e3aa5fa5f5e869af23c51;hp=4ae233305d756461a1dd9efee7ab4c305b875d5c;hpb=9aa4a0e39ea568b5481f100645106e1ac1d46883;p=gnulib.git diff --git a/lib/getpass.c b/lib/getpass.c index 4ae233305..226be155b 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006, 2007 Free Software - Foundation, Inc. +/* Copyright (C) 1992-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -34,15 +33,13 @@ # include # endif #else -# define __fsetlocking(stream, type) /* empty */ +# define __fsetlocking(stream, type) /* empty */ #endif #if HAVE_TERMIOS_H # include #endif -#include "getline.h" - #if USE_UNLOCKED_IO # include "unlocked-io.h" #else @@ -147,17 +144,17 @@ getpass (const char *prompt) if (buf != NULL) { if (nread < 0) - buf[0] = '\0'; + buf[0] = '\0'; else if (buf[nread - 1] == '\n') - { - /* Remove the newline. */ - buf[nread - 1] = '\0'; - if (tty_changed) - { - /* Write the newline that was not echoed. */ - putc_unlocked ('\n', out); - } - } + { + /* Remove the newline. */ + buf[nread - 1] = '\0'; + if (tty_changed) + { + /* Write the newline that was not echoed. */ + putc_unlocked ('\n', out); + } + } } /* Restore the original setting. */ @@ -206,20 +203,20 @@ getpass (const char *prompt) { c = _getch (); if (c == '\r') - { - getpassbuf[i] = '\0'; - break; - } + { + getpassbuf[i] = '\0'; + break; + } else if (i < PASS_MAX) - { - getpassbuf[i++] = c; - } + { + getpassbuf[i++] = c; + } if (i >= PASS_MAX) - { - getpassbuf[i] = '\0'; - break; - } + { + getpassbuf[i] = '\0'; + break; + } } if (prompt)