annotate libutil/nibbles2asc.c @ 229:ed8cb3c0d312 default tip

new README, indicating repository move
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 18:26:13 +0000
parents 884b93362449
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
161
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements a function for turning a nibble array
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * into printable ASCII.
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 void
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 nibbles_to_ascii(nib, len, out)
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 u_char *nib;
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 unsigned len;
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 char *out;
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 unsigned n;
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 for (n = 0; n < len; n++)
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 *out++ = encode_hex_digit(*nib++);
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 *out = '\0';
884b93362449 libutil: nibbles_to_ascii() function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 }