Added code for nonstandard function strsep()
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
fdd7b566ec
commit
0635ddd8f7
@ -16,6 +16,7 @@
|
|||||||
#define HAVE_SETBIT 1
|
#define HAVE_SETBIT 1
|
||||||
#define HAVE_STRCASESTR 1
|
#define HAVE_STRCASESTR 1
|
||||||
#define HAVE_STRCHRNUL 1
|
#define HAVE_STRCHRNUL 1
|
||||||
|
#define HAVE_STRSEP 1
|
||||||
#define HAVE_STRSIGNAL 1
|
#define HAVE_STRSIGNAL 1
|
||||||
#define HAVE_VASPRINTF 1
|
#define HAVE_VASPRINTF 1
|
||||||
|
|
||||||
@ -353,6 +354,7 @@ typedef unsigned smalluint;
|
|||||||
# undef HAVE_SETBIT
|
# undef HAVE_SETBIT
|
||||||
# undef HAVE_STRCASESTR
|
# undef HAVE_STRCASESTR
|
||||||
# undef HAVE_STRCHRNUL
|
# undef HAVE_STRCHRNUL
|
||||||
|
# undef HAVE_STRSEP
|
||||||
# undef HAVE_STRSIGNAL
|
# undef HAVE_STRSIGNAL
|
||||||
# undef HAVE_VASPRINTF
|
# undef HAVE_VASPRINTF
|
||||||
#endif
|
#endif
|
||||||
@ -391,6 +393,10 @@ extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
|
|||||||
extern char *strchrnul(const char *s, int c) FAST_FUNC;
|
extern char *strchrnul(const char *s, int c) FAST_FUNC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRSEP
|
||||||
|
extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRSIGNAL
|
#ifndef HAVE_STRSIGNAL
|
||||||
/* Not exactly the same: instead of "Stopped" it shows "STOP" etc */
|
/* Not exactly the same: instead of "Stopped" it shows "STOP" etc */
|
||||||
# define strsignal(sig) get_signame(sig)
|
# define strsignal(sig) get_signame(sig)
|
||||||
|
@ -107,3 +107,30 @@ char* FAST_FUNC strcasestr(const char *s, const char *pattern)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRSEP
|
||||||
|
/* Copyright (C) 2004 Free Software Foundation, Inc. */
|
||||||
|
char* FAST_FUNC strsep(char **stringp, const char *delim)
|
||||||
|
{
|
||||||
|
char *start = *stringp;
|
||||||
|
char *ptr;
|
||||||
|
|
||||||
|
if (!start)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!*delim)
|
||||||
|
ptr = start + strlen(start);
|
||||||
|
else {
|
||||||
|
ptr = strpbrk(start, delim);
|
||||||
|
if (!ptr) {
|
||||||
|
*stringp = NULL;
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ptr = '\0';
|
||||||
|
*stringp = ptr + 1;
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user