aboutsummaryrefslogtreecommitdiff
path: root/src/col80_modified/icet_to_col80.c
blob: aa07223533187096a13921253f68bef7afae5148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>

int main(int argc, char **argv) {
	int c, d, byte = 0;
	char out[8];

	do {
		c = getchar();
		if(byte == 16) {
			for(byte = 0; byte < 8; ++byte)
				putchar(out[byte]);

			byte = 0;
		}

		if(c != EOF) {
			if(byte < 8) {
				out[byte] = (c & 0xf0);
				++byte;
			} else if(byte < 16) {
				out[byte - 8] |= (c & 0x0f);
				++byte;
			}
		}
	} while(c != EOF);
}