https://github.com/torvalds/linux
Revision 6371e82307237dede71f884ad8e8e11faa75e8be authored by Linus Torvalds on 14 December 2010, 21:32:19 UTC, committed by Linus Torvalds on 14 December 2010, 21:32:19 UTC
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp:
  amd64_edac: Fix interleaving check
  EDAC: Correct MiB_TO_PAGES() macro
  EDAC: Fix workqueue-related crashes
2 parent s c3606c6 + e726f3c
Raw File
Tip revision: 6371e82307237dede71f884ad8e8e11faa75e8be authored by Linus Torvalds on 14 December 2010, 21:32:19 UTC
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp
Tip revision: 6371e82
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