changeset 20:b13acb024fc6

libutil: add is_valid_ext_digit()
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 26 Jun 2022 23:35:19 -0800
parents 40e5097437fa
children cc0e1c6e33c3
files libutil/Makefile libutil/extdigits.c
diffstat 2 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libutil/Makefile	Sun Jun 26 22:38:42 2022 -0800
+++ b/libutil/Makefile	Sun Jun 26 23:35:19 2022 -0800
@@ -1,6 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
-OBJS=	imsi_entry.o mncc_utils.o nanp_valid.o numstring.o sockinit.o
+OBJS=	extdigits.o imsi_entry.o mncc_utils.o nanp_valid.o numstring.o \
+	sockinit.o
 LIB=	libutil.a
 
 all:	${LIB}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libutil/extdigits.c	Sun Jun 26 23:35:19 2022 -0800
@@ -0,0 +1,29 @@
+/*
+ * The library function implemented in this module checks "extended"
+ * number digits, i.e., checks whether or not a given character
+ * makes a valid "extended" number digit.
+ */
+
+is_valid_ext_digit(c)
+{
+	switch (c) {
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	case '*':
+	case '#':
+	case 'a':
+	case 'b':
+	case 'c':
+		return(1);
+	default:
+		return(0);
+	}
+}