From: Andrew Karpow Date: Sun, 19 Oct 2014 14:45:49 +0000 (+0200) Subject: make mkdata more portable, fixes #35 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=87fdd34f87d2058bfc56aaa917790a643837cdf0;p=ympd.git make mkdata more portable, fixes #35 --- diff --git a/htdocs/mkdata.c b/htdocs/mkdata.c index 4fbefd0..d22c8e7 100644 --- a/htdocs/mkdata.c +++ b/htdocs/mkdata.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -59,17 +59,17 @@ int main(int argc, char *argv[]) FILE *fd; if(argc <= 1) - error(EXIT_FAILURE, 0, "Usage: ./%s [file2, ...] > embedded_data.c", argv[0]); + err(EXIT_FAILURE, "Usage: ./%s [file2, ...] > embedded_data.c", argv[0]); for(i = 1; i < argc; i++) { - printf("static const unsigned char v%d[] = {", i); - fd = fopen(argv[i], "r"); if(!fd) - error(EXIT_FAILURE, errno, "Failed open file %s", argv[i]); + err(EXIT_FAILURE, "%s", argv[i]); - j = 0; + printf("static const unsigned char v%d[] = {", i); + + j = 0; while((buf = fgetc(fd)) != EOF) { if(!(j % 12))