Go to the documentation of this file.
11 #define ABANDON(why) { fprintf(stderr, "%s\n", why); exit(1); }
12 #define MAX_SIZE (256*1024)
15 static int loadhex(FILE *inf,
unsigned char *
buf)
19 while ((
c=getc(inf))!=
EOF)
28 if (fscanf(inf,
"%02x", &n) != 1)
32 if (fscanf(inf,
"%04x", &addr) != 1)
37 if (fscanf(inf,
"%02x", &linetype) != 1)
46 if (fscanf(inf,
"%02x", &
c) != 1)
56 if (fscanf(inf,
"%02x", &check) != 1)
74 if(argv[1] &&
strcmp(argv[1],
"-i")==0)
82 fprintf(stderr,
"hex2hex: [-i] filename\n");
86 l = loadhex(stdin,
buf);
88 printf(
"/*\n *\t Computer generated file. Do not edit.\n */\n");
89 printf(
"static int %s_len = %d;\n", varline, l);
90 printf(
"static unsigned char %s[] %s = {\n", varline,
id?
"__initdata":
"");
95 if (i && !(i % 16))
printf(
"\n");