FreeCalypso > hg > fc-pcsc-tools
annotate libutil/nibbles2asc.c @ 173:e70964adcbba
fc-simtool readef extended to fully dump all files
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 02 Mar 2021 03:33:41 +0000 |
parents | 884b93362449 |
children |
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 } |