summaryrefslogtreecommitdiffstats
path: root/tools/hexbin.c
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2020-12-21 00:57:45 -0500
committerMalfurious <m@lfurio.us>2020-12-21 00:57:45 -0500
commit75c74abf9249f6aee6dc22c4dbc345c4840181aa (patch)
treed85c28e6b1cc5335218571914ef5e1807cf58737 /tools/hexbin.c
parent0c452f6508a2e14b22aa3abc93497ee6078a49f8 (diff)
downloadlib-des-gnux-75c74abf9249f6aee6dc22c4dbc345c4840181aa.tar.gz
lib-des-gnux-75c74abf9249f6aee6dc22c4dbc345c4840181aa.zip
Create tools directory
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'tools/hexbin.c')
-rw-r--r--tools/hexbin.c24
1 files changed, 24 insertions, 0 deletions
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 <stdio.h>
+#include <stdint.h>
+
+int main()
+{
+ uint8_t b;
+
+ while (1)
+ {
+ scanf("%hhx", &b);
+ if (feof(stdin))
+ break;
+ fwrite(&b, 1, 1, stdout);
+ }
+
+ return 0;
+}