Initial release, version 0.0.0.
[gsasl.git] / lib / hexdump.c
blob1714d274c49deb49428d897a51dcb78f9b95b791
1 /* hexdump.c hexdump buffer
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of libgsasl.
6 * Libgsasl is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libgsasl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with libgsasl; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "internal.h"
24 /**
25 * gsasl_hexdump:
26 * @fh: file handle
27 * @buffer: input byte array
28 * @len: size of input byte array
30 * Print a byte array to given file handle, mostly for debugging purposes.
31 **/
32 void
33 gsasl_hexdump (FILE *fh, const char *buffer, size_t len)
35 int i;
37 for (i=0; i < len; i++)
39 fprintf(fh, _("%d: hex %02X dec %d ascii %c\n"),
40 i, buffer[i], buffer[i], buffer[i]);