From dfc9c64ead7f24d51ed1a232e4b3ecafa8384f2e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Nov 2003 12:06:07 +0000 Subject: * "Fix expression" -> "Nix expression". * More refactoring. --- src/bin2c/Makefile.am | 3 +++ src/bin2c/bin2c.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/bin2c/Makefile.am create mode 100644 src/bin2c/bin2c.c (limited to 'src/bin2c') diff --git a/src/bin2c/Makefile.am b/src/bin2c/Makefile.am new file mode 100644 index 000000000000..bdd58808a159 --- /dev/null +++ b/src/bin2c/Makefile.am @@ -0,0 +1,3 @@ +noinst_PROGRAMS = bin2c + +bin2c_SOURCES = bin2c.c diff --git a/src/bin2c/bin2c.c b/src/bin2c/bin2c.c new file mode 100644 index 000000000000..18bf81d69e25 --- /dev/null +++ b/src/bin2c/bin2c.c @@ -0,0 +1,23 @@ +#include +#include +#include + +void print(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + if (vprintf(format, ap) < 0) abort(); + va_end(ap); +} + +int main(int argc, char * * argv) +{ + int c; + if (argc != 2) abort(); + print("static unsigned char %s[] = {", argv[1]); + while ((c = getchar()) != EOF) { + print("0x%02x, ", (unsigned char) c); + } + print("};\n"); + return 0; +} -- cgit 1.4.1