summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-09 13:16:36 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-09 13:16:36 -0500
commitd5db102efee64cc7f594b740bc131bc01e4973d5 (patch)
tree26b8a97a96bd4fbb9a0a20bbf0922c433b246a0f
parent253a32e2f9ff1cbb8edbe7c79834a678daebeb93 (diff)
merge XOPEN functions
-rw-r--r--src/ctype/_tolower.c6
-rw-r--r--src/ctype/_toupper.c6
-rw-r--r--src/ctype/isascii.c26
-rw-r--r--src/ctype/toascii.c24
4 files changed, 62 insertions, 0 deletions
diff --git a/src/ctype/_tolower.c b/src/ctype/_tolower.c
new file mode 100644
index 00000000..dc3ad0ae
--- /dev/null
+++ b/src/ctype/_tolower.c
@@ -0,0 +1,6 @@
+#include <ctype.h>
+#define _tolower(c) tolower(c)
+
+/*
+XOPEN(4)
+*/
diff --git a/src/ctype/_toupper.c b/src/ctype/_toupper.c
new file mode 100644
index 00000000..d1cdc9b4
--- /dev/null
+++ b/src/ctype/_toupper.c
@@ -0,0 +1,6 @@
+#include <ctype.h>
+#define _toupper(c) toupper(c)
+
+/*
+XOPEN(4)
+*/
diff --git a/src/ctype/isascii.c b/src/ctype/isascii.c
new file mode 100644
index 00000000..30fc5a1f
--- /dev/null
+++ b/src/ctype/isascii.c
@@ -0,0 +1,26 @@
+#include <ctype.h>
+
+/** test whether a character is in the ASCII range **/
+int isascii(int c)
+{
+ if (0 <= c && c <= 0177) {
+ return 1;
+ }
+ return 0;
+}
+
+/***
+The fn(isascii) function tests whether arg(c) is a 7-bit US-ASCII character.
+***/
+
+/* RETURN(NZ): arg(c) is between 0 and octal 0177 inclusive */
+/* RETURN(0): arg(c) is outside of the ASCII range */
+
+/* UNDEFINED: - */
+/* UNSPECIFIED: - */
+/* IMPLEMENTATION: - */
+/* LOCALE: - */
+
+/*
+XOPEN(4)
+*/
diff --git a/src/ctype/toascii.c b/src/ctype/toascii.c
new file mode 100644
index 00000000..80b599df
--- /dev/null
+++ b/src/ctype/toascii.c
@@ -0,0 +1,24 @@
+#include <ctype.h>
+
+/** convert a character to 7-bit ASCII **/
+int toascii(int c)
+{
+ return (c & 0x7f);
+}
+
+#endif
+
+/***
+The fn(toascii) function converts arg(c) to 7-bit ASCII.
+***/
+
+/* RETURN: arg(c) & 0x7f */
+
+/* UNDEFINED: - */
+/* UNSPECIFIED: - */
+/* IMPLEMENTATION: - */
+/* LOCALE: - */
+
+/*
+XOPEN(4)
+*/