changeset 333:74d5e95ee84a

uptools/libcoding: alphabetic address handling implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 03 Feb 2018 23:53:20 +0000
parents ea41b6001848
children f40530e2d48d
files uptools/libcoding/Makefile uptools/libcoding/alpha_addr.c
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/uptools/libcoding/Makefile	Sat Feb 03 22:57:45 2018 +0000
+++ b/uptools/libcoding/Makefile	Sat Feb 03 23:53:20 2018 +0000
@@ -1,7 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
-OBJS=	decode_helpers.o gsm7_decode.o gsm7_decode_tables.o gsm7_unpack.o \
-	hexdecode.o number_decode.o scaddr.o ucs2_decode.o
+OBJS=	alpha_addr.o decode_helpers.o gsm7_decode.o gsm7_decode_tables.o \
+	gsm7_unpack.o hexdecode.o number_decode.o scaddr.o ucs2_decode.o
 LIB=	libcoding.a
 
 all:	${LIB}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uptools/libcoding/alpha_addr.c	Sat Feb 03 23:53:20 2018 +0000
@@ -0,0 +1,21 @@
+/*
+ * This library module contains some bits that help working with
+ * alphabetic addresses.
+ */
+
+#include <sys/types.h>
+
+u_char alpha_septets_to_digits[12] = {0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20};
+
+alpha_addr_valid(ndigits, sepp)
+	unsigned ndigits, *sepp;
+{
+	unsigned n;
+
+	for (n = 1; n <= 11; n++)
+		if (alpha_septets_to_digits[n] == ndigits) {
+			*sepp = n;
+			return(1);
+		}
+	return(0);
+}