From 811c77140bd195992042d3f99fd186fe628519ff Mon Sep 17 00:00:00 2001
From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Sun, 12 Dec 2010 08:51:20 -0500
Subject: Tests for nl_types catalog funcriuons, cbrt(3), ceil(3).

---
 deheader         |  5 +++++
 test/acos.c      |  2 +-
 test/atan.c      |  2 +-
 test/catclose.c  | 15 +++++++++++++++
 test/catgets.c   | 15 +++++++++++++++
 test/catopen.c   | 15 +++++++++++++++
 test/cbrt.c      | 15 +++++++++++++++
 test/ceil.c      | 15 +++++++++++++++
 test/regress.chk | 17 ++++++++++++++++-
 9 files changed, 98 insertions(+), 3 deletions(-)
 create mode 100644 test/catclose.c
 create mode 100644 test/catgets.c
 create mode 100644 test/catopen.c
 create mode 100644 test/cbrt.c
 create mode 100644 test/ceil.c

diff --git a/deheader b/deheader
index 56f3e57..f641a4c 100755
--- a/deheader
+++ b/deheader
@@ -59,6 +59,11 @@ requirements = map(lambda (r, h): (re.compile(r), h), (
     (r"\Wbtowc\s*\(",     ["<stdio.h>", "<wchar.h>"]),
     (r"\Wbzero\s*\(",     ["<string.h>"]),
     (r"\Wcalloc\s*\(",    ["<stdlib.h>"]),
+    (r"\Wcatclose\s*\(",  ["<nl_types.h>"]),
+    (r"\Wcatgets\s*\(",   ["<nl_types.h>"]),
+    (r"\Wcatopen\s*\(",   ["<nl_types.h>"]),
+    (r"\Wcbrt\s*\(",      ["<math.h>"]),
+    (r"\Wceil\s*\(",      ["<math.h>"]),
     (r"\Wumask\s*\(",     ["<sys/stat.h>", "<sys/types.h>"]),
     # Dependencies observed on systems other than the Linux this was
     # developed under.
diff --git a/test/acos.c b/test/acos.c
index 4360c72..bc8d64f 100644
--- a/test/acos.c
+++ b/test/acos.c
@@ -1,4 +1,4 @@
-/* acos() requires <stdlib.h> */
+/* acos() requires <math.h> */
 
 /*
  * Items: acos(
diff --git a/test/atan.c b/test/atan.c
index 56c2dc8..ce96f21 100644
--- a/test/atan.c
+++ b/test/atan.c
@@ -1,4 +1,4 @@
-/* atan() requires <stdlib.h> */
+/* atan() requires <math.h> */
 
 /*
  * Items: atan(
diff --git a/test/catclose.c b/test/catclose.c
new file mode 100644
index 0000000..f0ad008
--- /dev/null
+++ b/test/catclose.c
@@ -0,0 +1,15 @@
+/* catclose(3) needs <nl_types.h> */
+
+/*
+ * Items: catclose(
+ * Requires: <nl_types.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <nl_types.h>
+
+main(int arg, char **argv)
+{
+    (void) catclose(0);
+}
diff --git a/test/catgets.c b/test/catgets.c
new file mode 100644
index 0000000..43ecca3
--- /dev/null
+++ b/test/catgets.c
@@ -0,0 +1,15 @@
+/* catgets(3) needs <nl_types.h> */
+
+/*
+ * Items: catgets(
+ * Requires: <nl_types.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <nl_types.h>
+
+main(int arg, char **argv)
+{
+    (void) catgets(0, 0, 0, "foobar");
+}
diff --git a/test/catopen.c b/test/catopen.c
new file mode 100644
index 0000000..9a03c55
--- /dev/null
+++ b/test/catopen.c
@@ -0,0 +1,15 @@
+/* catopen(3) needs <nl_types.h> */
+
+/*
+ * Items: catopen(
+ * Requires: <nl_types.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <nl_types.h>
+
+main(int arg, char **argv)
+{
+    (void) catopen("foobar", 0);
+}
diff --git a/test/cbrt.c b/test/cbrt.c
new file mode 100644
index 0000000..7beb7ca
--- /dev/null
+++ b/test/cbrt.c
@@ -0,0 +1,15 @@
+/* cbrt() requires <math.h> */
+
+/*
+ * Items: cbrt(
+ * Requires: <stdlib.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <math.h>
+
+main(int arg, char **argv)
+{
+    cbrt(23.0);
+}
diff --git a/test/ceil.c b/test/ceil.c
new file mode 100644
index 0000000..2a8de42
--- /dev/null
+++ b/test/ceil.c
@@ -0,0 +1,15 @@
+/* ceil() requires <math.h> */
+
+/*
+ * Items: ceil(
+ * Requires: <stdlib.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <math.h>
+
+main(int arg, char **argv)
+{
+    ceil(23.0);
+}
diff --git a/test/regress.chk b/test/regress.chk
index 19bb434..c3042c4 100644
--- a/test/regress.chk
+++ b/test/regress.chk
@@ -16,6 +16,8 @@ deheader: ./a64l.c has requires <stdlib.h> from \Wa64l\s*\(
 deheader: ./a64l.c includes <stdlib.h>
 deheader: ./bcmp.c has requires <string.h> from \Wbcmp\s*\(
 deheader: ./bcmp.c includes <string.h>
+deheader: ./ceil.c has requires <math.h> from \Wceil\s*\(
+deheader: ./ceil.c includes <math.h>
 deheader: ./bcopy.c includes <string.h>
 deheader: ./atexit.c includes <stdlib.h>
 deheader: ./btowc.c has requires <stdio.h>,<wchar.h> from \Wbtowc\s*\(
@@ -51,20 +53,32 @@ deheader: ./bsort.c includes <stdio.h>
 deheader: ignoring <stdio.h> (conditional inclusion)
 deheader: ./bsort.c includes <stdlib.h>
 deheader: ./bsort.c includes <string.h>
+deheader: ./catgets.c has requires <nl_types.h> from \Wcatgets\s*\(
+deheader: ./catgets.c includes <nl_types.h>
+deheader: ./cbrt.c has requires <math.h> from \Wcbrt\s*\(
+deheader: ./cbrt.c includes <math.h>
 deheader: ./advance.c has requires <regexp.h> from \Wadvance\s*\(
 deheader: ./advance.c includes <regexp.h>
+deheader: ./catopen.c has requires <nl_types.h> from \Wcatopen\s*\(
+deheader: ./catopen.c includes <nl_types.h>
 deheader: ./atan2.c has requires <math.h> from \Watan2\s*\(
 deheader: ./atan2.c includes <math.h>
+deheader: ./catclose.c has requires <nl_types.h> from \Wcatclose\s*\(
+deheader: ./catclose.c includes <nl_types.h>
 deheader: in ./atan2.c, retaining required '#include <math.h>\n'
 deheader: ./asin.c without <math.h> succeeded.
 deheader: remove <math.h> from ./asin.c
 deheader: in ./acos.c, retaining required '#include <math.h>\n'
+deheader: in ./catopen.c, retaining required '#include <nl_types.h>\n'
 deheader: in ./brk.c, retaining required '#include <unistd.h>\n'
 deheader: ./string.c without <string.h> succeeded.
 deheader: remove <string.h> from ./string.c
 deheader: ./bsort.c without <string.h> succeeded.
 deheader: in ./bsort.c, retaining required '#include <stdlib.h>\n'
 deheader: remove <string.h> from ./bsort.c
+deheader: in ./catclose.c, retaining required '#include <nl_types.h>\n'
+deheader: in ./cbrt.c, retaining required '#include <math.h>\n'
+deheader: in ./ceil.c, retaining required '#include <math.h>\n'
 deheader: in ./bsd_signal.c, retaining required '#include <signal.h>\n'
 deheader: ./abs.c without <stdlib.h> succeeded.
 deheader: remove <stdlib.h> from ./abs.c
@@ -96,7 +110,8 @@ deheader: in ./access.c, retaining required '#include <unistd.h>\n'
 deheader: in ./btowc.c, retaining required '#include <wchar.h>\n'
 deheader: in ./btowc.c, retaining required '#include <stdio.h>\n'
 deheader: in ./acosh.c, retaining required '#include <math.h>\n'
+deheader: in ./catgets.c, retaining required '#include <nl_types.h>\n'
 deheader: in ./bcmp.c, retaining required '#include <string.h>\n'
 deheader: in ./a64l.c, retaining required '#include <stdlib.h>\n'
 deheader: in ./advance.c, retaining required '#include <regexp.h>\n'
-deheader: saw 31 files, 34 includes, 10 removed
+deheader: saw 36 files, 39 includes, 10 removed
-- 
cgit v1.2.3-70-g09d2