summaryrefslogtreecommitdiffstats
path: root/tools/hexbin.c
blob: 9356fff52afa0aef563d9f41f6eea48e861b37cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}