haiku/src/tools/misc/bin2asm.c
Ingo Weinhold c7b36669c2 Moved bin2h and bin2asm to src/tools/misc (no longer added to the
build). We don't really need them any longer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-26 23:34:05 +00:00

43 lines
620 B
C

/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#include <stdio.h>
#include <stdlib.h>
#define NUM_COLUMNS 16
int main(int argc, char **argv)
{
FILE *infp = stdin;
char c;
int column = 0;
int start = 1;
while(!feof(infp)) {
int err;
err = fread(&c, sizeof(c), 1, infp);
if(err != 1)
break;
if((column % NUM_COLUMNS) == 0) {
if(!start) {
printf("\n");
} else {
start = 0;
}
printf(".byte\t");
} else {
printf(",");
}
printf("0x%02x", ((int)c) & 0xff);
column++;
}
printf("\n");
return 0;
}