comparison libnumutil/nanp_valid.c @ 0:159dd90eeafe

beginning, libnumutil compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 12 Dec 2023 23:52:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:159dd90eeafe
1 /*
2 * Utility functions for NANP number validation.
3 */
4
5 #include <stdbool.h>
6
7 #include <themwi/nanp/number_utils.h>
8
9 bool is_nanp_valid_prefix(const char *s)
10 {
11 /* validate NPA part */
12 if (s[0] < '2')
13 return false;
14 if (s[1] == '1' && s[2] == '1')
15 return false;
16 /* validate exchange part */
17 if (s[3] < '2')
18 return false;
19 if (s[4] == '1' && s[5] == '1')
20 return false;
21 /* all checks passed */
22 return true;
23 }