Use src/ not lib/ as root of source in example Makefile.am code.
[gnulib.git] / lib / getpass.c
index 5b39b6d..1aac4b7 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006 Free Software
-   Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
 #  include <stdio_ext.h>
 # endif
 #else
-# define __fsetlocking(stream, type)   /* empty */
+# define __fsetlocking(stream, type)    /* empty */
 #endif
 
 #if HAVE_TERMIOS_H
 # include <termios.h>
 #endif
 
-#include "getline.h"
-
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #else
@@ -142,22 +139,22 @@ getpass (const char *prompt)
      == fileno (out).  The POSIX restrictions are tricky and change
      from POSIX version to POSIX version, so play it safe and invoke
      fseek even if in != out.  */
-  fseek (out, 0, SEEK_CUR);
+  fseeko (out, 0, SEEK_CUR);
 
   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)