diff libutil/nibbles2asc.c @ 8:34bbb0585cab

libutil: import from previous fc-pcsc-tools version
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 05:42:37 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libutil/nibbles2asc.c	Sun Mar 14 05:42:37 2021 +0000
@@ -0,0 +1,19 @@
+/*
+ * This module implements a function for turning a nibble array
+ * into printable ASCII.
+ */
+
+#include <sys/types.h>
+
+void
+nibbles_to_ascii(nib, len, out)
+	u_char *nib;
+	unsigned len;
+	char *out;
+{
+	unsigned n;
+
+	for (n = 0; n < len; n++)
+		*out++ = encode_hex_digit(*nib++);
+	*out = '\0';
+}