bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] getpass.c and use of putc_unlocked


From: Paul Eggert
Subject: Re: [Bug-gnulib] getpass.c and use of putc_unlocked
Date: Mon, 01 Nov 2004 12:59:39 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> I know it is a horrible solution, but it seem to fit nicely with the
> rest of the file...

How about the following (untested) solution instead?  It's slightly
less horrible.

2004-11-01  Paul Eggert  <address@hidden>

        * lib/getpass.c (fflush_unlocked, flockfile, funlockfile, funlockfile,
        fputs_unlocked, putc_unlocked): Don't define if already declared.
        * m4/getpass.m4 (gl_PREREQ_GETPASS): Check for declarations of the
        above functions.

--- m4/getpass.m4       2004-08-09 16:54:10 -0700
+++ /tmp/getpass.m4     2004-11-01 12:57:46 -0800
@@ -1,5 +1,5 @@
-# getpass.m4 serial 4
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# getpass.m4 serial 5
+dnl Copyright (C) 2002-2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -34,5 +34,6 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU],
 # Prerequisites of lib/getpass.c.
 AC_DEFUN([gl_PREREQ_GETPASS], [
   AC_CHECK_HEADERS_ONCE(stdio_ext.h)
+  AC_CHECK_DECLS_ONCE([fflush flockfile fputs_unlocked funlockfile 
putc_unlocked])
   :
 ])
--- lib/getpass.c       2004-10-15 12:37:38 -0700
+++ /tmp/getpass.c      2004-11-01 12:30:22 -0800
@@ -58,16 +58,26 @@
 #elif USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #else
-# undef fflush_unlocked
-# define fflush_unlocked(x) fflush (x)
-# undef flockfile
-# define flockfile(x) ((void) 0)
-# undef funlockfile
-# define funlockfile(x) ((void) 0)
-# undef fputs_unlocked
-# define fputs_unlocked(str,stream) fputs (str, stream)
-# undef putc_unlocked
-# define putc_unlocked(c,stream) putc (c, stream)
+# if !HAVE_DECL_FFLUSH
+#  undef fflush_unlocked
+#  define fflush_unlocked(x) fflush (x)
+# endif
+# if !HAVE_DECL_FLOCKFILE
+#  undef flockfile
+#  define flockfile(x) ((void) 0)
+# endif
+# if !HAVE_DECL_FUNLOCKFILE
+#  undef funlockfile
+#  define funlockfile(x) ((void) 0)
+# endif
+# if !HAVE_DECL_FPUTS_UNLOCKED
+#  undef fputs_unlocked
+#  define fputs_unlocked(str,stream) fputs (str, stream)
+# endif
+# if !HAVE_DECL_PUTC_UNLOCKED
+#  undef putc_unlocked
+#  define putc_unlocked(c,stream) putc (c, stream)
+# endif
 #endif
 
 #if _LIBC




reply via email to

[Prev in Thread] Current Thread [Next in Thread]