1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 23:07:17 +00:00

make mkdata more portable, fixes #35

This commit is contained in:
Andrew Karpow 2014-10-19 16:45:49 +02:00
parent 5fd723c1db
commit 87fdd34f87

View File

@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <error.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@ -59,15 +59,15 @@ int main(int argc, char *argv[])
FILE *fd; FILE *fd;
if(argc <= 1) if(argc <= 1)
error(EXIT_FAILURE, 0, "Usage: ./%s <this_file> <file1> [file2, ...] > embedded_data.c", argv[0]); err(EXIT_FAILURE, "Usage: ./%s <this_file> <file1> [file2, ...] > embedded_data.c", argv[0]);
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
{ {
printf("static const unsigned char v%d[] = {", i);
fd = fopen(argv[i], "r"); fd = fopen(argv[i], "r");
if(!fd) if(!fd)
error(EXIT_FAILURE, errno, "Failed open file %s", argv[i]); err(EXIT_FAILURE, "%s", argv[i]);
printf("static const unsigned char v%d[] = {", i);
j = 0; j = 0;
while((buf = fgetc(fd)) != EOF) while((buf = fgetc(fd)) != EOF)