1/* 2** Copyright 2001, Travis Geiselbrecht. All rights reserved. 3** Distributed under the terms of the NewOS License. 4*/ 5#include <stdio.h> 6#include <stdlib.h> 7 8#define NUM_COLUMNS 16 9 10int main(int argc, char **argv) 11{ 12 FILE *infp = stdin; 13 char c; 14 int column = 0; 15 int start = 1; 16 17 while(!feof(infp)) { 18 int err; 19 err = fread(&c, sizeof(c), 1, infp); 20 if(err != 1) 21 break; 22 23 if((column % NUM_COLUMNS) == 0) { 24 if(!start) { 25 printf("\n"); 26 } else { 27 start = 0; 28 } 29 printf(".byte\t"); 30 } else { 31 printf(","); 32 } 33 34 printf("0x%02x", ((int)c) & 0xff); 35 36 column++; 37 } 38 printf("\n"); 39 40 return 0; 41} 42 43