1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 06:11:46 +02:00

* "Fix expression" -> "Nix expression".

* More refactoring.
This commit is contained in:
Eelco Dolstra 2003-11-18 12:06:07 +00:00
parent b1117ef29d
commit dfc9c64ead
14 changed files with 27 additions and 32 deletions

3
src/bin2c/Makefile.am Normal file
View file

@ -0,0 +1,3 @@
noinst_PROGRAMS = bin2c
bin2c_SOURCES = bin2c.c

23
src/bin2c/bin2c.c Normal file
View file

@ -0,0 +1,23 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
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;
}