summaryrefslogtreecommitdiffstats
path: root/src/lib/ctype.C
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2013-09-23 14:55:10 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-10-07 10:02:28 -0500
commitb8d7070d329b3a6577ae6c11ae7b1afb27db7a22 (patch)
tree0e93546356b039af78869b5edc86d8d4d1ff08a9 /src/lib/ctype.C
parent4dc8e90ef55cb15b6a36a8d27ae43a6b2261521b (diff)
downloadtalos-hostboot-b8d7070d329b3a6577ae6c11ae7b1afb27db7a22.tar.gz
talos-hostboot-b8d7070d329b3a6577ae6c11ae7b1afb27db7a22.zip
Make sprintf-class functions comply with standard.
Change-Id: I6a04179bb2c339668450bcbcf608ebef477c5bfe Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6399 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/lib/ctype.C')
-rw-r--r--src/lib/ctype.C46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/lib/ctype.C b/src/lib/ctype.C
index 8ae144a5d..e937102bf 100644
--- a/src/lib/ctype.C
+++ b/src/lib/ctype.C
@@ -31,3 +31,49 @@ int toupper(int ch)
return ch;
}
+int isdigit(int c)
+{
+ return ((c >= '0') && (c <= '9'));
+}
+
+int islower(int c)
+{
+ return ((c >= 'a') && (c <= 'z'));
+}
+
+int isupper(int c)
+{
+ return ((c >= 'A') && (c <= 'Z'));
+}
+
+int isalpha(int c)
+{
+ return islower(c) || isupper(c);
+}
+
+int isalnum(int c)
+{
+ return isdigit(c) || isalpha(c);
+}
+
+int ispunct(int c)
+{
+ // Look at an ASCII table...
+ return ((c >= '!') && (c <= '/')) ||
+ ((c >= ':') && (c <= '@')) ||
+ ((c >= '[') && (c <= '`')) ||
+ ((c >= '{') && (c <= '~'));
+}
+
+int isspace(int c)
+{
+ // There are other space characters, like tabs, but I don't think we
+ // need to support them.
+ return (c == ' ');
+}
+
+int isprint(int c)
+{
+ return isalnum(c) || ispunct(c) || isspace(c);
+}
+
OpenPOWER on IntegriCloud