fix missing stripostfix, and add stricmp (although one should use strcasecmp).
This commit is contained in:
@@ -214,6 +214,7 @@
|
||||
#undef HAVE_SETBUF
|
||||
#undef HAVE_SETITIMER
|
||||
#undef HAVE_SETLINEBUF
|
||||
#undef HAVE_SETLOCALE
|
||||
#undef HAVE_SHMAT
|
||||
#undef HAVE_SIGACTION
|
||||
#undef HAVE_SIGGETMASK
|
||||
@@ -227,6 +228,7 @@
|
||||
#undef HAVE_STAT
|
||||
#undef HAVE_STRCHR
|
||||
#undef HAVE_STRERROR
|
||||
#undef HAVE_STRICMP
|
||||
#undef HAVE_STRNCAT
|
||||
#undef HAVE_STRNCPY
|
||||
#undef HAVE_STRTOD
|
||||
|
@@ -1485,7 +1485,7 @@ AC_CHECK_FUNCS(rename rint rl_set_prompt sbrk select)
|
||||
AC_CHECK_FUNCS(setbuf setitimer setlinebuf sigaction)
|
||||
AC_CHECK_FUNCS(siggetmask siginterrupt)
|
||||
AC_CHECK_FUNCS(signal sigprocmask socket stat)
|
||||
AC_CHECK_FUNCS(strchr strerror strncat strncpy strtod)
|
||||
AC_CHECK_FUNCS(strchr strerror stricmp strncat strncpy strtod)
|
||||
AC_CHECK_FUNCS(time times tmpnam usleep vsnprintf)
|
||||
|
||||
AC_CHECK_FUNC(regexec, [NO_BUILTIN_REGEXP="#"], [NO_BUILTIN_REGEXP=""])
|
||||
|
@@ -52,10 +52,12 @@ C_SOURCES=$(srcdir)/pl-buffer.c $(srcdir)/pl-ctype.c \
|
||||
$(srcdir)/pl-stream.c $(srcdir)/pl-string.c \
|
||||
$(srcdir)/pl-table.c \
|
||||
$(srcdir)/pl-text.c \
|
||||
$(srcdir)/pl-utils.c \
|
||||
$(srcdir)/pl-yap.c @ENABLE_WINCONSOLE@ $(srcdir)/popen.c $(srcdir)/uxnt/uxnt.c
|
||||
OBJS=pl-buffer.o pl-ctype.o pl-error.o pl-feature.o \
|
||||
pl-file.o pl-files.o pl-os.o pl-privitf.o \
|
||||
pl-stream.o pl-string.o pl-table.o pl-text.o pl-utf8.o \
|
||||
pl-stream.o pl-string.o pl-table.o \
|
||||
pl-text.o pl-utils.o pl-utf8.o \
|
||||
pl-yap.o @ENABLE_WINCONSOLE@ uxnt.o
|
||||
SOBJS=plstream@SHLIB_SUFFIX@
|
||||
|
||||
|
@@ -80,3 +80,7 @@ extern const char _PL_char_types[]; /* array of character types */
|
||||
|
||||
#define toLowerW(c) ((unsigned)(c) <= 'Z' ? (c) + 'a' - 'A' : towlower(c))
|
||||
#define makeLowerW(c) ((c) >= 'A' && (c) <= 'Z' ? toLower(c) : towlower(c))
|
||||
|
||||
#ifndef HAVE_STRICMP
|
||||
int stricmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
|
@@ -573,6 +573,9 @@ int Unsetenv(char *name);
|
||||
int System(char *cmd);
|
||||
bool expandVars(const char *pattern, char *expanded, int maxlen);
|
||||
|
||||
/**** stuff from pl-utils.c ****/
|
||||
bool stripostfix(char *s, char *e);
|
||||
|
||||
/**** SWI stuff (emulated in pl-yap.c) ****/
|
||||
extern int writeAtomToStream(IOSTREAM *so, atom_t at);
|
||||
extern int valueExpression(term_t t, Number r ARG_LD);
|
||||
|
25
packages/PLStream/pl-utils.c
Normal file
25
packages/PLStream/pl-utils.c
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "pl-incl.h"
|
||||
#include "pl-ctype.h"
|
||||
|
||||
#ifndef HAVE_STRICMP
|
||||
int
|
||||
stricmp(const char *s1, const char *s2)
|
||||
{ while(*s1 && makeLower(*s1) == makeLower(*s2))
|
||||
s1++, s2++;
|
||||
|
||||
return makeLower(*s1) - makeLower(*s2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
stripostfix(char *s, char *e)
|
||||
{ int ls = strlen(s);
|
||||
int le = strlen(e);
|
||||
|
||||
if ( ls >= le )
|
||||
return stricmp(&s[ls-le], e) == 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Submodule packages/chr updated: f6a7900761...c325e4564b
Submodule packages/jpl updated: eb6d27251c...a2d2f03107
Reference in New Issue
Block a user