| 1 | /* This file is Free Software. It was written for secnet. |
| 2 | * |
| 3 | * Authored 2013 Ian Jackson |
| 4 | * |
| 5 | * You may redistribute this file freely - the copyrightholders and |
| 6 | * authors declare that they wish these files to be in the public |
| 7 | * domain; or alternatively (at your option) that you may deal with |
| 8 | * them according to the `CC0 1.0 Universal' licence. |
| 9 | * |
| 10 | * You may redistribute secnet as a whole and/or modify it under the |
| 11 | * terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 3, or (at your option) any |
| 13 | * later version. |
| 14 | * |
| 15 | * This software is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this software; if not, see |
| 22 | * https://www.gnu.org/licenses/gpl.html. |
| 23 | */ |
| 24 | |
| 25 | #ifndef HEXDEBUG_H |
| 26 | #define HEXDEBUG_H |
| 27 | |
| 28 | #include <stdio.h> |
| 29 | #include <sys/types.h> |
| 30 | |
| 31 | static inline void hexdebug(FILE *file, const void *buffer, size_t len) |
| 32 | { |
| 33 | const uint8_t *array=buffer; |
| 34 | size_t i; |
| 35 | for (i=0; i<len; i++) |
| 36 | fprintf(file,"%02x",array[i]); |
| 37 | } |
| 38 | |
| 39 | #endif /*HEXDEBUG_H*/ |