patch-2.1.76 linux/drivers/sound/bin2hex.c

Next file: linux/drivers/sound/configure.c
Previous file: linux/drivers/sound/Readme.cards
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.75/linux/drivers/sound/bin2hex.c linux/drivers/sound/bin2hex.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+int main( int argc, const char * argv [] )
+{
+    const char * varname = argv[1];
+    int i = 0;
+    int c;
+
+    printf( "/* automatically generated by bin2hex */\n" );
+    printf( "static unsigned char %s [] =\n{\n", varname );
+
+    while ( ( c = getchar( ) ) != EOF )
+    {
+	if ( i != 0 && i % 10 == 0 )
+	    printf( "\n" );
+	printf( "0x%02lx,", c & 0xFFl );
+	i++;
+    }
+
+    printf( "};\n#define %sLen %d\n", varname, i );
+    return 0;
+}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov