Article View: news.software.readers
Article #263768Re: [bystand] Version 0.7.0 released
From: Michael Bäuerle
Date: Fri, 22 Nov 2019 16:50
Date: Fri, 22 Nov 2019 16:50
93 lines
4144 bytes
4144 bytes
news@zzo38computer.org.invalid wrote:
>
> Version 0.7.0 of bystand has now been released.
> [...]
> Please write a follow-up article to this one if you have comments,
> complaints, questions, feature requests, bug reports, etc. You can also
> post tickets on the Fossil repository if you prefer that.
Looks like the code expects a GNU operating system. It defines:
|
| #define _GNU_SOURCE
and uses some nonstandard GNU extensions that prevent compilation on
non-GNU systems. For NetBSD I have used the following patch:
------------------------------------------------------------------------
diff -ruN bystand-0.7.0/Makefile bystand-0.7.0_netbsd/Makefile
--- bystand-0.7.0/Makefile 2019-07-19 12:56:00.000000000 +0200
+++ bystand-0.7.0_netbsd/Makefile 2019-11-22 17:39:10.000000000 +0100
@@ -1,12 +1,12 @@
# Make file for bystand
# Important: Ensure you are using a recent version of SQLite.
-OBJS= bystand.o
+OBJS= bystand.o gnu_compat.o
# Link executable against shared sqlite library
# -s is omitted, see install rule
bystand: $(OBJS)
- $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) -lsqlite3 -ldl -lpthread
+ $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) -lsqlite3
# Install exeutable to ~/bin
# Symbol table is stripped after installation (similar to -s)
diff -ruN bystand-0.7.0/bystand.c bystand-0.7.0_netbsd/bystand.c
--- bystand-0.7.0/bystand.c 2019-10-13 23:43:00.000000000 +0200
+++ bystand-0.7.0_netbsd/bystand.c 2019-11-22 16:34:38.000000000 +0100
@@ -14,9 +14,12 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <sys/wait.h> // For WEXITSTATUS macro
#include <time.h>
#include <unistd.h>
+#include "gnu_compat.h" // For non-GNU systems like NetBSD
+
#ifndef MSG_MORE
#define MSG_MORE 0
#endif
diff -ruN bystand-0.7.0/gnu_compat.c bystand-0.7.0_netbsd/gnu_compat.c
--- bystand-0.7.0/gnu_compat.c 1970-01-01 01:00:00.000000000 +0100
+++ bystand-0.7.0_netbsd/gnu_compat.c 2019-11-22 17:36:55.000000000 +0100
@@ -0,0 +1,26 @@
+/*
+ * bystand uses at least the following nonstandard functions:
+ * - strchrnul() [GNU extension, in GNU libc >=2.1.1]
+ */
+#include <signal.h>
+#include <string.h>
+#include "gnu_compat.h"
+
+
+/*
+ * From the GNU libc manual page:
+ * The strchrnul() function is like strchr() except that if c is not found in s,
+ * then it returns a pointer to the null byte at the end of s, rather than NULL.
+ */
+char *strchrnul(const char *s, int c)
+{
+ char *r;
+
+ r = strchr(s, c);
+ if (NULL == r)
+ {
+ r = (char*) &s[strlen(s)];
+ }
+
+ return r;
+}
diff -ruN bystand-0.7.0/gnu_compat.h bystand-0.7.0_netbsd/gnu_compat.h
--- bystand-0.7.0/gnu_compat.h 1970-01-01 01:00:00.000000000 +0100
+++ bystand-0.7.0_netbsd/gnu_compat.h 2019-11-22 17:36:43.000000000 +0100
@@ -0,0 +1,8 @@
+/*
+ * bystand uses at least the following nonstandard datatypes:
+ * - sighandler_t [GNU extension]
+ */
+
+typedef void (*sighandler_t) (int);
+
+char *strchrnul(const char *s, int c);
------------------------------------------------------------------------
Technical Details
Message-ID:
<AABd2BG/bGYAAApR.A1.flnews@WStation5.stz-e.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<1571035688.bystand@zzo38computer.org>Show Full Headers
Complete Article Headers
Message-ID: <AABd2BG/bGYAAApR.A1.flnews@WStation5.stz-e.de> Subject: Re: [bystand] Version 0.7.0 released Date: Fri, 22 Nov 2019 16:50:07 +0000 From: Michael Bäuerle <michael.baeuerle@stz-e.de> References: <1571035688.bystand@zzo38computer.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Cancel-Lock: sha1:68bO8iTnk0IECrGPVRY3ZDjTcZo= sha256:+sKuMS7Mh3/Dubyi/JYknIMvLNErNnKd5g1YsAEZhlM= sha1:Y2y8kAuOCCIaWvS+UpAOingEyMY= User-Agent: flnews/0.17pre21 (for NetBSD) X-Trace: individual.net h6Uon4nWwzNTQx1QyUv0cwCFq0j0muqv3b+HgKQtW9QoWSHQ1B Newsgroups: news.software.readers X-Orig-Path: not-for-mail Injection-Date: Fri, 22 Nov 2019 16:50:07 -0000 X-Received-Body-Crc: 3386724362 Mime-Version: 1.0 Lines: 93 Reply-To: Michael Bäuerle <michael.baeuerle@gmx.net> X-Received-Bytes: 4069