annotate libcoding/hexout.c @ 1:13518c86b73c

libcoding: add hexout.c, implementing emit_hex_out()
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 02:06:14 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }