From 75c74abf9249f6aee6dc22c4dbc345c4840181aa Mon Sep 17 00:00:00 2001 From: Malfurious Date: Mon, 21 Dec 2020 00:57:45 -0500 Subject: Create tools directory Signed-off-by: Malfurious --- tools/hexbin.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/hexbin.c (limited to 'tools/hexbin.c') diff --git a/tools/hexbin.c b/tools/hexbin.c new file mode 100644 index 0000000..9356fff --- /dev/null +++ b/tools/hexbin.c @@ -0,0 +1,24 @@ +/* + * hexbin.c + * + * This program takes no arguments, it simply interprets its input as hex + * and outputs bytes. + */ + +#include +#include + +int main() +{ + uint8_t b; + + while (1) + { + scanf("%hhx", &b); + if (feof(stdin)) + break; + fwrite(&b, 1, 1, stdout); + } + + return 0; +} -- cgit v1.2.3