2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
+ * Makefile.am (libfetish_a_SOURCES): Add getpass.h.
+ * getpass.h: New file.
+ * .cpp-disable: Add it.
+ * getpass.c [!_LIBC]: Include it.
+
+ * obstack.h (obstack_empty_p):
+ Don't assume that chunk->contents is suitably aligned.
+ * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
+ Likewise. Problem reported by Benno in
+ <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>.
+
* chown.c (rpl_chown): Work even if the file is writeable but not
readable. This could be improved further but it'd take some work.
* fts.c (diropen): New function.
full-write.c full-write.h \
getline.h \
getpagesize.h \
+ getpass.h \
gettime.c \
gettext.h \
getugroups.c \
# include <config.h>
#endif
+#if !_LIBC
+# include "getpass.h"
+#endif
+
#if _LIBC
# define HAVE_STDIO_EXT_H 1
#endif
--- /dev/null
+/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Simon Josefsson <jas@extundo.com>, 2004.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef GETPASS_H
+# define GETPASS_H
+
+/* Get getpass declaration, if available. */
+# include <unistd.h>
+
+# if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS
+/* Read a password of arbitrary length from /dev/tty or stdin. */
+char *getpass (const char *prompt);
+
+# endif
+
+#endif /* GETPASS_H */
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
+ h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
+ alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = chunk->contents;
+ h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
+ alignment - 1);
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* If the object just copied was the only data in OLD_CHUNK,
free that chunk and remove it from the chain.
But not if that chunk might contain an empty object. */
- if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
+ if (! h->maybe_empty_object
+ && (h->object_base
+ == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
+ h->alignment_mask)))
{
new_chunk->prev = old_chunk->prev;
CALL_FREEFUN (h, old_chunk);
# define obstack_empty_p(OBSTACK) \
__extension__ \
({ struct obstack const *__o = (OBSTACK); \
- (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
+ (__o->chunk->prev == 0 \
+ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
+ __o->chunk->contents, \
+ __o->alignment_mask)); })
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
(unsigned) ((h)->chunk_limit - (h)->next_free)
# define obstack_empty_p(h) \
- ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
+ ((h)->chunk->prev == 0 \
+ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
+ (h)->chunk->contents, \
+ (h)->alignment_mask))
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
* sha1.m4: Renamed from sha.m4.
(gl_SHA1): Renamed from gl_SHA. All uses changed.
+2004-08-08 Simon Josefsson <jas@extundo.com>
+
+ * getpass.m4 (gl_FUNC_GETPASS, gl_FUNC_GETPASS_GNU):
+ Check getpass declaration.
+
2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
* canonicalize.m4, getcwd-path-max.m4, strdup.m4: Merge from gnulib.
[AC_CACHE_CHECK(
[for working $1 fnmatch],
[$2],
- [# Some versions of Solaris, SCO, and the GNU C Library
- # have a broken or incompatible fnmatch.
- # So we run a test program. If we are cross-compiling, take no chance.
- # Thanks to John Oleynick, François Pinard, and Paul Eggert for this test.
+ [dnl Some versions of Solaris, SCO, and the GNU C Library
+ dnl have a broken or incompatible fnmatch.
+ dnl So we run a test program. If we are cross-compiling, take no chance.
+ dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this test.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[
-# getpass.m4 serial 3
+# getpass.m4 serial 4
dnl Copyright (C) 2002-2003 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
AC_DEFUN([gl_FUNC_GETPASS],
[
AC_REPLACE_FUNCS(getpass)
+ AC_CHECK_DECLS_ONCE(getpass)
if test $ac_cv_func_getpass = no; then
gl_PREREQ_GETPASS
fi
# arbitrary length (not just 8 bytes as on HP-UX).
AC_DEFUN([gl_FUNC_GETPASS_GNU],
[
+ AC_CHECK_DECLS_ONCE(getpass)
dnl TODO: Detect when GNU getpass() is already found in glibc.
AC_LIBOBJ(getpass)
gl_PREREQ_GETPASS