commit d2e054346f03e66f031f78a50bf1caa87da2dc10
parent ce0cc5a352df27044d01148d7922bdb167cfa64e
Author: Matus Laslofi <matus@laslofi.sk>
Date: Mon, 1 May 2023 07:42:45 +0200
Declare snprintf to fix builds on macOS
For some reason on macOS, the functions `snprintf` and `vsnprintf` are
not in the X/Open 5 (ANSI C89) standard but rather in the X/Open
6 (ISO C99). A simplest solution seems to be to declaring the missing
functions before using them, which is what I did here. Another option
is to use the C99 standard with `#define _XOPEN_SOURCE 600`, which
seems to be an overkill for such a niche issue.
Quoting from the STANDARDS section in `man 3 snprintf` on macOS:
> ...the snprintf() and vsnprintf() functions conform to ISO/IEC
> 9899:1999 (“ISO C99”)...
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/devices/file.c b/src/devices/file.c
@@ -26,6 +26,10 @@
#define PATH_MAX 4096
#endif
+#ifdef __APPLE__
+int snprintf(char *, unsigned long, const char *, ...);
+#endif
+
#include "../uxn.h"
#include "file.h"