Merge changes from gnulib. This was prompted because the CVS

snapshot of Bison didn't build on Solaris 7 due to strnlen problems.
This commit is contained in:
Paul Eggert
2003-03-12 23:08:11 +00:00
parent 4f8a9f6dba
commit f61aad9399
33 changed files with 719 additions and 294 deletions

View File

@@ -35,6 +35,7 @@ EXTRA_DIST = malloc.c realloc.c strnlen.c
libbison_a_SOURCES = \
gettext.h \
argmatch.c argmatch.h \
basename.c dirname.h dirname.c \
get-errno.h get-errno.c \
getopt.h getopt.c getopt1.c \

View File

@@ -31,24 +31,7 @@
# include <stdlib.h>
#endif
#if HAVE_STDBOOL_H
# include <stdbool.h>
#else
# ifndef __bool_true_false_are_defined
# if ! HAVE__BOOL
# ifdef __cplusplus
typedef bool _Bool;
# else
typedef unsigned char _Bool;
# endif
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
# endif
#endif
#include <stdbool.h>
#include <stdio.h>
#ifndef HAVE_DECL_FREE

View File

@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2000-2002 Free Software Foundation, Inc.
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
@@ -21,15 +21,6 @@
# include <config.h>
#endif
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). This must be
included before "mbswidth.h", because UnixWare 7.1.1 <wchar.h>
declares its own mbswidth and we want mbswidth.h's "#define
mbswidth gnu_mbswidth" to take effect after <wchar.h> is
included. */
#if HAVE_WCHAR_H
# include <wchar.h>
#endif
/* Specification. */
#include "mbswidth.h"
@@ -41,6 +32,11 @@
/* Get isprint(). */
#include <ctype.h>
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
#if HAVE_WCHAR_H
# include <wchar.h>
#endif
/* Get iswprint(), iswcntrl(). */
#if HAVE_WCTYPE_H
# include <wctype.h>

47
lib/stdbool.h.in Normal file
View File

@@ -0,0 +1,47 @@
/* Copyright (C) 2001-2002 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
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 _STDBOOL_H
#define _STDBOOL_H
/* ISO C 99 <stdbool.h> for platforms that lack it. */
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#ifdef __BEOS__
# undef false
# undef true
#endif
/* For the sake of symbolic names in gdb, define _Bool as an enum type. */
#ifndef __cplusplus
# if !@HAVE__BOOL@
typedef enum { false = 0, true = 1 } _Bool;
# endif
#else
typedef bool _Bool;
#endif
#define bool _Bool
/* The other macros must be usable in preprocessor directives. */
#define false 0
#define true 1
#define __bool_true_false_are_defined 1
#endif /* _STDBOOL_H */