annotate libutil/extdigits.c @ 37:a065b4a62a8a

themwi-test-mtc: drain stdin when we receive input meant to request user disconnect
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 10 Jul 2022 00:32:38 -0800
parents b13acb024fc6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * The library function implemented in this module checks "extended"
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * number digits, i.e., checks whether or not a given character
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * makes a valid "extended" number digit.
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 is_valid_ext_digit(c)
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 {
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 switch (c) {
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 case '0':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 case '1':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 case '2':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 case '3':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 case '4':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 case '5':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 case '6':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 case '7':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 case '8':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 case '9':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 case '*':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 case '#':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 case 'a':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 case 'b':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 case 'c':
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 return(1);
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 default:
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 return(0);
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }
b13acb024fc6 libutil: add is_valid_ext_digit()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }