Skip to content

Commit

Permalink
Make orch(1) buildable on NetBSD as well
Browse files Browse the repository at this point in the history
It uses GCC 7.5.0 by default, which complains enough about conversion issues
that aren't an issue in practice.  Otherwise, much the same as OpenBSD.

Signed-off-by: Kyle Evans <[email protected]>
  • Loading branch information
kevans91 committed Jan 19, 2024
1 parent 01248a7 commit dba5bc6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ SRCS= orch.c \
.if defined(.MAKE.OS) && ${.MAKE.OS} == "Linux"
CFLAGS+= -D_GNU_SOURCE
.endif
.if defined(.MAKE.OS) && ${.MAKE.OS} == "NetBSD"
CWARNFLAGS+= -Wno-conversion -Wno-maybe-uninitialized
.endif

SRCS+= orch_compat.c

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ requests and Issues are open on GitHub.
orch(1) strives to be portable. Currently supported platforms:
- FreeBSD
- OpenBSD
- NetBSD
- macOS
- Linux (tested on Ubuntu only)
6 changes: 5 additions & 1 deletion orch.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#define POSIX_OPENPT_FLAGS (O_RDWR | O_NOCTTY | O_CLOEXEC)
#endif

#ifndef __dead2
#define __dead2 __attribute__((noreturn))
#endif

extern char **environ;

static void orch_exec(int argc, const char *argv[], int cmdsock);
Expand All @@ -31,7 +35,7 @@ static void orch_usept(pid_t sess, int termctl);
static void orch_wait(int cmdsock);
static void orch_release(int cmdsock);

static void
static void __dead2
usage(const char *name, int error)
{
FILE *f;
Expand Down
3 changes: 2 additions & 1 deletion orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ int luaopen_orch(lua_State *);
size_t strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize);
size_t strlcat(char * __restrict dst, const char * __restrict src, size_t dsize);
#endif
#if defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__)
#if defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || \
defined(__NetBSD__)
int tcsetsid(int tty, int sess);
#endif
3 changes: 2 additions & 1 deletion orch_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ strlcat(char * __restrict dst, const char * __restrict src, size_t dsize)
return(dlen + (src - osrc)); /* count does not include NUL */
}
#endif /* __linux__ */
#if defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__)
#if defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || \
defined(__NetBSD__)
/* Not associated with the above... incredibly simple. */

int
Expand Down

0 comments on commit dba5bc6

Please sign in to comment.