mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-08 12:09:43 -04:00
tweaks to toolsrc/bin2c
This commit is contained in:
parent
0daf278ce4
commit
3fc2346bdd
@ -22,13 +22,13 @@ int main(int argc,char **argv)
|
|||||||
name = strdup(argv[1]);
|
name = strdup(argv[1]);
|
||||||
if ((ext = strrchr(name, '.')))
|
if ((ext = strrchr(name, '.')))
|
||||||
*ext = '\0';
|
*ext = '\0';
|
||||||
printf("static unsigned char %s[] = {\n", name);
|
printf("static const unsigned char %s[] =\n{\n", name);
|
||||||
free(name);
|
free(name);
|
||||||
strcpy(buf," ");
|
strcpy(buf," ");
|
||||||
while ((c=getc(fp))!=EOF)
|
while ((c=getc(fp))!=EOF)
|
||||||
{
|
{
|
||||||
sprintf(s,"%u,",(unsigned char) c);
|
sprintf(s,"0x%02X,",(unsigned char) c);
|
||||||
if (strlen(s)+strlen(buf) >= 80)
|
if (strlen(s)+strlen(buf) > 2+8*5)
|
||||||
puts(buf), strcpy(buf," ");
|
puts(buf), strcpy(buf," ");
|
||||||
strcat(buf,s);
|
strcat(buf,s);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user