aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/atob.c
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2025-01-14 16:06:02 -0600
committerWilliam Harrington <kb0iic@berzerkula.org>2025-01-14 16:06:02 -0600
commit0cc9b20c15460213e488bf5e70963b941482f628 (patch)
treebb0143245583ec846630f39bfa2258dba640ccd7 /sdk/other/atob.c
parent0e084ade5069756d487b5c948c48b777e37c00c9 (diff)
Add source.
Diffstat (limited to 'sdk/other/atob.c')
-rw-r--r--sdk/other/atob.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/sdk/other/atob.c b/sdk/other/atob.c
new file mode 100644
index 0000000..1535f7a
--- /dev/null
+++ b/sdk/other/atob.c
@@ -0,0 +1,47 @@
+/*
+ * Convert ASCII text into binary value.
+ * $Id: atob.c 1.2 Wed, 19 Mar 1997 12:44:53 -0500 dyfet $
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and use, see product license.
+ *
+ * Functions:
+ * atob() - convert null terminated ASCII string to boolean value.
+ */
+
+#include <other/strcvt.h>
+
+/*
+ * Convert null terminated ASCII string to boolean value.
+ *
+ * Abstract:
+ * The input string can be numeric; such as "0" or "1", or alpha;
+ * such as "T" for true, "F" for false, or "Y" or "N". Only the
+ * first character of the string is examined. Upper/lower case is
+ * ignored.
+ *
+ * Parameters:
+ * str - null terminated ASCII string.
+ *
+ * Returns:
+ * logical value of input string.
+ *
+ * Exceptions:
+ * Any unrecognized string value, or a NULL string, return FALSE.
+ */
+
+bool atob(const char *str)
+{
+ if(!str)
+ return FALSE;
+
+ switch(*str)
+ {
+ case '0':
+ case 'f':
+ case 'F':
+ case 'n':
+ case 'N':
+ return FALSE;
+ }
+ return TRUE;
+}