opnsense-ports/multimedia/vdr-plugin-softhddevice/files/patch-softhddev.c
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

49 lines
1.2 KiB
C

--- a/softhddev.c
+++ b/softhddev.c
@@ -22,6 +22,9 @@
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
#include <fcntl.h>
#include <stdio.h>
@@ -2212,6 +2215,11 @@ int ProcessArgs(int argc, char *const ar
//
// Parse arguments.
//
+#ifdef __FreeBSD__
+ if (!strcmp(*argv, "softhddevice"))
+ ++argv, --argc;
+#endif
+
for (;;) {
switch (getopt(argc, argv, "-a:c:d:fg:p:sv:w:x")) {
case 'a': // audio device for pcm
@@ -2294,7 +2302,11 @@ int ProcessArgs(int argc, char *const ar
#define XSERVER_MAX_ARGS 512 ///< how many arguments support
+#ifndef __FreeBSD__
static const char *X11Server = "/usr/bin/X"; ///< default x11 server
+#else
+static const char *X11Server = LOCALBASE "/bin/X"; ///< default x11 server
+#endif
static const char *X11ServerArguments; ///< default command arguments
static pid_t X11ServerPid; ///< x11 server pid
@@ -2338,7 +2350,12 @@ static void StartXServer(void)
if ((sval = X11ServerArguments)) {
char *s;
+#ifndef __FreeBSD__
s = buf = strdupa(sval);
+#else
+ s = buf = alloca(strlen(sval) + 1);
+ strcpy(buf, sval);
+#endif
while ((sval = strsep(&s, " \t"))) {
args[argn++] = sval;