Revision 57014123512633ab0c38a4fea4140bf156f6a3a0 authored by Linus Torvalds on 12 May 2008, 00:09:24 UTC, committed by Linus Torvalds on 12 May 2008, 00:09:24 UTC
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c: Convert some more new-style drivers to use module aliasing
  i2c: Match dummy devices by type
  i2c-sibyte: Mark i2c_sibyte_add_bus() as static
  i2c-sibyte: Correct a comment about frequency
  i2c: Improve the functionality documentation
  i2c: Improve smbus-protocol documentation
  i2c-piix4: Blacklist two mainboards
  i2c-piix4: Increase the intitial delay for the ServerWorks CSB5
  i2c-mpc: Compare to NO_IRQ instead of zero
2 parent s c3921ab + ae42908
Raw File
bin2c.c
/*
 * Unloved program to convert a binary on stdin to a C include on stdout
 *
 * Jan 1999 Matt Mackall <mpm@selenic.com>
 *
 * This software may be used and distributed according to the terms
 * of the GNU General Public License, incorporated herein by reference.
 */

#include <stdio.h>

int main(int argc, char *argv[])
{
	int ch, total=0;

	if (argc > 1)
		printf("const char %s[] %s=\n",
			argv[1], argc > 2 ? argv[2] : "");

	do {
		printf("\t\"");
		while ((ch = getchar()) != EOF)
		{
			total++;
			printf("\\x%02x",ch);
			if (total % 16 == 0)
				break;
		}
		printf("\"\n");
	} while (ch != EOF);

	if (argc > 1)
		printf("\t;\n\nconst int %s_size = %d;\n", argv[1], total);

	return 0;
}
back to top