summaryrefslogtreecommitdiff
path: root/util/mkelfImage/util/bin-to-hex.c
blob: af87e3ac0cdda0a5589ff9bd640d25b21db5e75d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>

int main(int argc, char **argv)
{
	int c;
	int i;
	i = 0;
	while((c = getchar()) != EOF) {
		if ((i % 16) != 0) {
			putchar(' ');
		}
		printf("0x%02x,", c);
		i++;
		if ((i %16) == 0) {
			putchar('\n');
		}
	}
	putchar('\n');
	return 0;
}