commit ed84beb94ed56dbc810ebc7323e2458c26287c09 from: Omar Polo date: Sun Jul 18 15:53:25 2021 UTC don't add trailing NUL byte plus some doc improvements and a missing return commit - de6548b97dff8ce3a011f93e007254cd9f01b8ec commit + ed84beb94ed56dbc810ebc7323e2458c26287c09 blob - 562a3e3df121754dc8801ec93bc8d12353d82770 blob + 0ae6f24d8ac4d26741ef8894b8152b46a69f5620 --- pagebundler.c +++ pagebundler.c @@ -17,7 +17,7 @@ /* * pagebundler converts the given file into a valid C program that can * be compiled. The generated code provides a variable that holds the - * original file. + * content of the original file and a _len variable with the size. * * Usage: pagebundler -f file -v varname > outfile */ @@ -62,6 +62,7 @@ main(int argc, char **argv) if ((f = fopen(file, "r")) == NULL) { fprintf(stderr, "%s: can't open %s: %s", argv[0], file, strerror(errno)); + return 1; } printf("const uint8_t %s[] = {\n", varname); @@ -81,8 +82,6 @@ main(int argc, char **argv) break; } - len++; - printf("\t0x00\n"); printf("}; /* %s */\n", varname); printf("size_t %s_len = %zu;\n", varname, len);