change BSD ifndefs to __OpenBSD__ and remove unnecessary ifdefs

I'm not sure if any operating system other than OpenBSD
has strlcpy/strlcat. May need to use a configure script
for this later on.
This commit is contained in:
Jeremy Baxter 2023-12-23 16:33:38 +13:00
parent 03b3631fa9
commit cae9985747
5 changed files with 8 additions and 10 deletions

2
lcl.c
View file

@ -9,7 +9,7 @@
#include <unistd.h> #include <unistd.h>
#include <libgen.h> #include <libgen.h>
#include <errno.h> #include <errno.h>
#ifdef BSD #ifdef __OpenBSD__
# include <string.h> # include <string.h>
#endif #endif

2
lfs.c
View file

@ -12,9 +12,7 @@
#include <libgen.h> #include <libgen.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef BSD
#include <string.h> #include <string.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <lua.h> #include <lua.h>

View file

@ -1,6 +1,6 @@
/*** /***
* Processes, signals, and * Processes, signals, and signal handlers.
* signal handlers. *
* @module process * @module process
*/ */
@ -9,7 +9,7 @@
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#ifdef BSD #ifdef __OpenBSD__
# include <string.h> # include <string.h>
#endif #endif

2
util.c
View file

@ -37,7 +37,7 @@ lfailm(lua_State *L, const char *mesg)
* lib/libc/string/strlcat.c and * lib/libc/string/strlcat.c and
* lib/libc/string/strlcpy.c respectively * lib/libc/string/strlcpy.c respectively
*/ */
#ifndef BSD #ifndef __OpenBSD__
/* /*
* Appends src to string dst of size dsize (unlike strncat, dsize is the * Appends src to string dst of size dsize (unlike strncat, dsize is the

4
util.h
View file

@ -2,13 +2,13 @@
#define _UTIL_H_ #define _UTIL_H_
#include <string.h> #include <stddef.h>
#include <lua.h> #include <lua.h>
int lfail(lua_State *); int lfail(lua_State *);
int lfailm(lua_State *, const char *); int lfailm(lua_State *, const char *);
#ifndef BSD #ifndef __OpenBSD__
size_t strlcat(char *, const char *, size_t); size_t strlcat(char *, const char *, size_t);
size_t strlcpy(char *, const char *, size_t); size_t strlcpy(char *, const char *, size_t);
#endif #endif