mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-03 01:46:02 -05:00
solaris fixes
This commit is contained in:
parent
25b3dd0679
commit
b24a3200d0
@ -28,10 +28,15 @@ AC_ARG_ENABLE(howl,[ --enable-howl Use the howl mDNS library],
|
||||
AM_CONDITIONAL(COND_REND_HOWL, test x$rend_howl = xtrue)
|
||||
AM_CONDITIONAL(COND_REND_POSIX, test x$rend_howl = xfalse)
|
||||
|
||||
AM_CONDITIONAL(COND_NEED_STRCASESTR,false)
|
||||
AM_CONDITIONAL(COND_NEED_STRSEP,false)
|
||||
|
||||
dnl Darwin's stupid cpp preprocessor....
|
||||
echo Host type is $host
|
||||
case $host in
|
||||
*solaris*)
|
||||
AM_CONDITIONAL(COND_NEED_STRCASESTR,true)
|
||||
AM_CONDITIONAL(COND_NEED_STRSEP,true)
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_SOCKLEN_T"
|
||||
LDFLAGS="$LDFLAGS -lnsl -lsocket";;
|
||||
*linux*)
|
||||
|
@ -6,6 +6,14 @@ AM_YFLAGS=-d
|
||||
|
||||
sbin_PROGRAMS = mt-daapd
|
||||
|
||||
if COND_NEED_STRCASESTR
|
||||
STRCASESTR=strcasestr.c
|
||||
endif
|
||||
|
||||
if COND_NEED_STRSEP
|
||||
STRSEP=strsep.c
|
||||
endif
|
||||
|
||||
if COND_REND_POSIX
|
||||
RENDSRC=mdns/mDNS.c mdns/mDNSClientAPI.h mdns/mDNSDebug.h mdns/mDNSPosix.c mdns/mDNSUNP.c rend-posix.c mdns/mDNSPlatformFunctions.h
|
||||
endif
|
||||
@ -22,10 +30,11 @@ mt_daapd_SOURCES = main.c daapd.h rend.h uici.c uici.h webserver.c \
|
||||
webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \
|
||||
daap-proto.c daap-proto.h daap.c daap.h db-memory.c db-memory.h \
|
||||
mp3-scanner.h mp3-scanner.c playlist.c playlist.h \
|
||||
lexer.l parser.y $(RENDSRC)
|
||||
lexer.l parser.y $(RENDSRC) $(STRCASESTR) $(STRSEP)
|
||||
|
||||
EXTRA_DIST = mdns/mDNS.c mdns/mDNSClientAPI.h mdns/mDNSDebug.h mdns/mDNSPosix.c \
|
||||
mdns/mDNSUNP.c mdns/mDNSPlatformFunctions.h mdns/mDNSPosix.h mdns/mDNSUNP.h \
|
||||
rend-howl.c rend-posix.c rend-osx.c
|
||||
rend-howl.c rend-posix.c rend-osx.c strcasestr.c strsep.c
|
||||
|
||||
|
||||
|
||||
|
22
src/strcasestr.c
Normal file
22
src/strcasestr.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <string.h>
|
||||
|
||||
/* case-independent string matching, similar to strstr but
|
||||
* matching */
|
||||
char * strcasestr(char* haystack, char* needle) {
|
||||
int i;
|
||||
int nlength = strlen (needle);
|
||||
int hlength = strlen (haystack);
|
||||
|
||||
if (nlength > hlength) return NULL;
|
||||
if (hlength <= 0) return NULL;
|
||||
if (nlength <= 0) return haystack;
|
||||
/* hlength and nlength > 0, nlength <= hlength */
|
||||
for (i = 0; i <= (hlength - nlength); i++) {
|
||||
if (strncasecmp (haystack + i, needle, nlength) == 0) {
|
||||
return haystack + i;
|
||||
}
|
||||
}
|
||||
/* substring not found */
|
||||
return NULL;
|
||||
}
|
||||
|
13
src/strsep.c
Normal file
13
src/strsep.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* Compliments of Jay Freeman <saurik@saurik.com> */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
char *strsep(char **stringp, const char *delim) {
|
||||
char *ret = *stringp;
|
||||
if (ret == NULL) return(NULL); /* grrr */
|
||||
if ((*stringp = strpbrk(*stringp, delim)) != NULL) {
|
||||
*((*stringp)++) = '\0';
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user