diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/generate-sysroot.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/generate-sysroot.c b/tools/generate-sysroot.c index 4400fcd..e6d93f8 100644 --- a/tools/generate-sysroot.c +++ b/tools/generate-sysroot.c @@ -1,10 +1,12 @@ -#include <limits.h> #include <stdarg.h> #include <stdbool.h> #include <stddef.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> +#define PW_PATH_MAX 1024 + static inline void check(bool cond, char const *msg) { if (!cond) { perror(msg); @@ -22,10 +24,10 @@ static void fprintfx(FILE *f, char const *fmt, ...) { static void fclosex(FILE *f) { check(!fclose(f), "fclose"); } -static void joinpath(char buffer[static PATH_MAX], char const *dir, +static void joinpath(char buffer[static PW_PATH_MAX], char const *dir, char const *file) { - size_t n = snprintf(buffer, PATH_MAX, "%s/%s", dir, file); - check(n < PATH_MAX, "joinpath"); + size_t n = snprintf(buffer, PW_PATH_MAX, "%s/%s", dir, file); + check(n < PW_PATH_MAX, "joinpath"); } struct sysroot_output { @@ -35,7 +37,7 @@ struct sysroot_output { static void open_sysroot_output(struct sysroot_output *out, char const *outdir) { - char path[PATH_MAX]; + char path[PW_PATH_MAX]; joinpath(path, outdir, "sysroot.h"); out->h = fopen(path, "w"); @@ -125,7 +127,7 @@ int main(int argc, char *argv[argc + 1]) { {"unknown_p8_png", "unknown.p8.png"}, }; for (size_t i = 0; i < sizeof entries / sizeof entries[0]; i++) { - char file[PATH_MAX]; + char file[PW_PATH_MAX]; joinpath(file, sysroot, entries[i].file); write_sysroot_data(&out, entries[i].name, file); } |
