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:
parent
5fd723c1db
commit
87fdd34f87
@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <error.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -59,15 +59,15 @@ int main(int argc, char *argv[])
|
||||
FILE *fd;
|
||||
|
||||
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++)
|
||||
{
|
||||
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]);
|
||||
|
||||
printf("static const unsigned char v%d[] = {", i);
|
||||
|
||||
j = 0;
|
||||
while((buf = fgetc(fd)) != EOF)
|
||||
|
Loading…
Reference in New Issue
Block a user