changeset 361:ae2556e256a4

uptools/libcoding: implemented function for generating hex strings
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Mar 2018 23:11:51 +0000
parents 68c8cf672ecd
children 89fe66cb60f6
files uptools/libcoding/Makefile uptools/libcoding/hexencode.c
diffstat 2 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/uptools/libcoding/Makefile	Sun Mar 04 06:24:36 2018 +0000
+++ b/uptools/libcoding/Makefile	Sun Mar 04 23:11:51 2018 +0000
@@ -2,8 +2,9 @@
 CFLAGS=	-O2
 OBJS=	alpha_addr.o decode_helpers.o grokdcs.o gsm7_decode.o \
 	gsm7_decode_tables.o gsm7_encode.o gsm7_encode_table.o gsm7_pack.o \
-	gsm7_unpack.o gsmtime.o hexdecode.o hexdump.o number_decode.o \
-	number_encode.o scaddr.o sms_submit.o ucs2_decode.o utf8_decode.o
+	gsm7_unpack.o gsmtime.o hexdecode.o hexdump.o hexencode.o \
+	number_decode.o number_encode.o scaddr.o sms_submit.o ucs2_decode.o \
+	utf8_decode.o
 LIB=	libcoding.a
 
 all:	${LIB}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uptools/libcoding/hexencode.c	Sun Mar 04 23:11:51 2018 +0000
@@ -0,0 +1,21 @@
+/*
+ * This module contains the function for generating hex strings.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+
+make_hex_string(inbuf, len, outbuf)
+	u_char *inbuf;
+	unsigned len;
+	char *outbuf;
+{
+	char *dp = outbuf;
+	unsigned n;
+
+	for (n = 0; n < len; n++) {
+		sprintf(dp, "%02X", inbuf[n]);
+		dp += 2;
+	}
+	*dp = '\0';
+}