Linux 4.14.171
[linux/fpc-iii.git] / sound / oss / bin2hex.c
blob26c04ce04d71866ed6fc737247e8840bf206f31b
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdlib.h>
6 int main( int argc, const char * argv [] )
8 const char * varname;
9 int i = 0;
10 int c;
11 int id = 0;
13 if(argv[1] && strcmp(argv[1],"-i")==0)
15 argv++;
16 argc--;
17 id=1;
20 if(argc==1)
22 fprintf(stderr, "bin2hex: [-i] firmware\n");
23 exit(1);
26 varname = argv[1];
27 printf( "/* automatically generated by bin2hex */\n" );
28 printf( "static unsigned char %s [] %s =\n{\n", varname , id?"__initdata":"");
30 while ( ( c = getchar( ) ) != EOF )
32 if ( i != 0 && i % 10 == 0 )
33 printf( "\n" );
34 printf( "0x%02lx,", c & 0xFFl );
35 i++;
38 printf( "};\nstatic int %sLen = %d;\n", varname, i );
39 return 0;