FreeCalypso > hg > sms-coding-utils
annotate libcoding/hexout.c @ 32:829e082793d0
new README
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 Jun 2024 19:42:25 +0000 |
parents | 13518c86b73c |
children |
rev | line source |
---|---|
1
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * The function implemented in this module emits hex bytes to a stdio output. |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 emit_hex_out(buf, buflen, outf) |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 u_char *buf; |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 unsigned buflen; |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 FILE *outf; |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 { |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 unsigned n; |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 for (n = 0; n < buflen; n++) |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 fprintf(outf, "%02X", buf[n]); |
13518c86b73c
libcoding: add hexout.c, implementing emit_hex_out()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 } |