From 1f28583cc41fb610f5e6d23d202dab40f7de483b Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 1 Mar 2025 14:06:06 +0000 Subject: [PATCH] Add support for OpenBSD --- util.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index 5429048..ba49b07 100644 --- a/util.c +++ b/util.c @@ -33,8 +33,12 @@ #include #include #ifdef WITH_TOURS +#ifdef __OpenBSD__ +# include +#else # include #endif +#endif #include "udata.h" #ifndef LINESIZE @@ -672,10 +676,26 @@ char *uuid4() { static char uustr[37]; uuid_t uu; +#ifdef __OpenBSD__ + uint32_t status; + char *temp_uustr; + uuid_create(&uu, &status); + if (status != uuid_s_ok) { + printf("could not create uuid\n"); + return (uustr); + } + + uuid_to_string(&uu, &temp_uustr, &status); + if (status != uuid_s_ok) { + printf("could not stringify uuid\n"); + return (uustr); + } + strlcpy(uustr, temp_uustr, 37); +#else uuid_generate(uu); uuid_unparse_lower(uu, uustr); - +#endif return (uustr); }