From 15583a79c4e92c691c0a260b821a0f5702488526 Mon Sep 17 00:00:00 2001 From: Johns Date: Mon, 9 Jul 2012 17:17:16 +0200 Subject: [PATCH] FreeBSD compatibility fix. --- codec.c | 4 ++++ softhddev.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/codec.c b/codec.c index 7dca837..369eb6f 100644 --- a/codec.c +++ b/codec.c @@ -39,7 +39,11 @@ #include #include +#ifdef __FreeBSD__ +#include +#else #include +#endif #include #include diff --git a/softhddev.c b/softhddev.c index 7860198..788049d 100644 --- a/softhddev.c +++ b/softhddev.c @@ -22,6 +22,9 @@ #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include @@ -2309,6 +2312,13 @@ int ProcessArgs(int argc, char *const argv[]) // // Parse arguments. // +#ifdef __FreeBSD__ + if (!strcmp(*argv, "softhddevice")) { + ++argv; + --argc; + } +#endif + for (;;) { switch (getopt(argc, argv, "-a:c:d:fg:p:sv:w:xD")) { case 'a': // audio device for pcm @@ -2396,7 +2406,11 @@ int ProcessArgs(int argc, char *const argv[]) #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 @@ -2442,7 +2456,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;