summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-07-28 08:35:37 +0000
committerJim Meyering <jim@meyering.net>2003-07-28 08:35:37 +0000
commitaf9317571ff7452dc1f7ffea5dbab6b9f0bcc36f (patch)
treead0d3181aa3c294e2dcd8dfc43c220dd1e3b2c3d /lib
parent042a04f8b3ae527bcc5fbc9b9036dd830fd0a956 (diff)
downloadcoreutils-af9317571ff7452dc1f7ffea5dbab6b9f0bcc36f.tar.xz
Renamed from stdbool.hin.
Diffstat (limited to 'lib')
-rw-r--r--lib/.cvsignore1
-rw-r--r--lib/stdbool_.h51
2 files changed, 51 insertions, 1 deletions
diff --git a/lib/.cvsignore b/lib/.cvsignore
index e57a62d43..3d2ec05a7 100644
--- a/lib/.cvsignore
+++ b/lib/.cvsignore
@@ -11,5 +11,4 @@ safe-lstat.h
safe-stat.c
safe-stat.h
stat.c
-stdbool_.h
unlocked-io.h
diff --git a/lib/stdbool_.h b/lib/stdbool_.h
new file mode 100644
index 000000000..d0cb70d54
--- /dev/null
+++ b/lib/stdbool_.h
@@ -0,0 +1,51 @@
+/* Copyright (C) 2001-2003 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 true and false as
+ enum constants. However, do not define _Bool as the enum type,
+ since the enum type might be compatible with unsigned int, whereas
+ _Bool must promote to int. */
+#ifndef __cplusplus
+# if !@HAVE__BOOL@
+enum { false = 0, true = 1 };
+typedef signed char _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 */