Blame view
sound/oss/bin2hex.c
791 Bytes
81f7e3824 Initial Release, ... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <string.h> #include <stdlib.h> int main( int argc, const char * argv [] ) { const char * varname; int i = 0; int c; int id = 0; if(argv[1] && strcmp(argv[1],"-i")==0) { argv++; argc--; id=1; } if(argc==1) { fprintf(stderr, "bin2hex: [-i] firmware "); exit(1); } varname = argv[1]; printf( "/* automatically generated by bin2hex */ " ); printf( "static unsigned char %s [] %s = { ", varname , id?"__initdata":""); while ( ( c = getchar( ) ) != EOF ) { if ( i != 0 && i % 10 == 0 ) printf( " " ); printf( "0x%02lx,", c & 0xFFl ); i++; } printf( "}; static int %sLen = %d; ", varname, i ); return 0; } |