solaris fixes

This commit is contained in:
Ron Pedde 2004-01-13 04:29:30 +00:00
parent 25b3dd0679
commit b24a3200d0
4 changed files with 51 additions and 2 deletions

View File

@ -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_HOWL, test x$rend_howl = xtrue)
AM_CONDITIONAL(COND_REND_POSIX, test x$rend_howl = xfalse) 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.... dnl Darwin's stupid cpp preprocessor....
echo Host type is $host echo Host type is $host
case $host in case $host in
*solaris*) *solaris*)
AM_CONDITIONAL(COND_NEED_STRCASESTR,true)
AM_CONDITIONAL(COND_NEED_STRSEP,true)
CPPFLAGS="$CPPFLAGS -DHAVE_SOCKLEN_T" CPPFLAGS="$CPPFLAGS -DHAVE_SOCKLEN_T"
LDFLAGS="$LDFLAGS -lnsl -lsocket";; LDFLAGS="$LDFLAGS -lnsl -lsocket";;
*linux*) *linux*)

View File

@ -6,6 +6,14 @@ AM_YFLAGS=-d
sbin_PROGRAMS = mt-daapd sbin_PROGRAMS = mt-daapd
if COND_NEED_STRCASESTR
STRCASESTR=strcasestr.c
endif
if COND_NEED_STRSEP
STRSEP=strsep.c
endif
if COND_REND_POSIX 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 RENDSRC=mdns/mDNS.c mdns/mDNSClientAPI.h mdns/mDNSDebug.h mdns/mDNSPosix.c mdns/mDNSUNP.c rend-posix.c mdns/mDNSPlatformFunctions.h
endif 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 \ 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 \ 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 \ 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 \ 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 \ 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
View 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
View 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);
}