annotate libcoding/hexout.c @ 23:e56bb9f09ff1

sms-encode-text: port over -e option from fcup-smsend
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 02 Sep 2023 19:22:05 +0000
parents 13518c86b73c
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 }