summaryrefslogtreecommitdiffstats
path: root/tools/hexbin.c
diff options
context:
space:
mode:
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;
+}