blob: 1535f7ad26c047465939db340ea09b9dd973fb40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
}
|