mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-08-03 12:47:01 -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]);
|
||||
if ((ext = strrchr(name, '.')))
|
||||
*ext = '\0';
|
||||
printf("static unsigned char %s[] = {\n", name);
|
||||
printf("static const unsigned char %s[] =\n{\n", name);
|
||||
free(name);
|
||||
strcpy(buf," ");
|
||||
while ((c=getc(fp))!=EOF)
|
||||
{
|
||||
sprintf(s,"%u,",(unsigned char) c);
|
||||
if (strlen(s)+strlen(buf) >= 80)
|
||||
sprintf(s,"0x%02X,",(unsigned char) c);
|
||||
if (strlen(s)+strlen(buf) > 2+8*5)
|
||||
puts(buf), strcpy(buf," ");
|
||||
strcat(buf,s);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user