2014-05-14 22:10:34 -04:00
|
|
|
/*
|
2014-05-16 08:22:25 -04:00
|
|
|
* r3_str.h
|
2014-06-27 01:24:40 -04:00
|
|
|
* Copyright (C) 2014 c9s <yoanlin93@gmail.com>
|
2014-05-14 22:10:34 -04:00
|
|
|
*
|
|
|
|
* Distributed under terms of the MIT license.
|
|
|
|
*/
|
2015-11-17 05:27:25 -05:00
|
|
|
#ifndef R3_STR_H
|
|
|
|
#define R3_STR_H
|
2014-05-14 22:10:34 -04:00
|
|
|
|
2015-08-27 01:58:36 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2014-05-15 10:57:13 -04:00
|
|
|
|
2014-06-03 08:50:19 -04:00
|
|
|
char * r3_slug_compile(const char * str, int len);
|
2014-05-15 11:46:49 -04:00
|
|
|
|
2014-06-03 08:50:19 -04:00
|
|
|
char * r3_slug_find_pattern(const char *s1, int *len);
|
2014-05-18 06:58:31 -04:00
|
|
|
|
2015-08-26 10:00:23 -04:00
|
|
|
char * r3_slug_find_name(const char *s1, int *len);
|
|
|
|
|
2014-06-03 08:50:19 -04:00
|
|
|
char * r3_slug_find_placeholder(const char *s1, int *len);
|
2014-05-18 06:58:31 -04:00
|
|
|
|
2015-08-26 10:00:23 -04:00
|
|
|
int r3_slug_count(const char * needle, int len, char **errstr);
|
|
|
|
|
2014-06-03 08:50:19 -04:00
|
|
|
char * r3_inside_slug(const char * needle, int needle_len, char *offset, char **errstr);
|
2014-05-15 00:53:48 -04:00
|
|
|
|
2014-05-31 14:58:03 -04:00
|
|
|
void str_repeat(char *s, const char *c, int len);
|
2014-05-15 06:02:10 -04:00
|
|
|
|
|
|
|
void print_indent(int level);
|
|
|
|
|
2014-06-18 08:47:06 -04:00
|
|
|
|
|
|
|
#if _GNU_SOURCE || POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 || __DARWIN_C_LEVEL >= 200809L
|
2014-06-26 12:05:24 -04:00
|
|
|
#ifndef HAVE_STRNDUP
|
2014-06-18 08:47:06 -04:00
|
|
|
#define HAVE_STRNDUP
|
|
|
|
#endif
|
2014-06-26 12:05:24 -04:00
|
|
|
#endif
|
2014-06-18 08:47:06 -04:00
|
|
|
|
|
|
|
#if _SVID_SOURCE || _BSD_SOURCE \
|
|
|
|
|| _XOPEN_SOURCE >= 500 \
|
|
|
|
|| _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED \
|
|
|
|
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L \
|
|
|
|
|| __DARWIN_C_LEVEL >= 200809L
|
2014-06-26 12:05:24 -04:00
|
|
|
#ifndef HAVE_STRDUP
|
2014-06-18 08:47:06 -04:00
|
|
|
#define HAVE_STRDUP
|
|
|
|
#endif
|
2014-06-26 12:05:24 -04:00
|
|
|
#endif
|
2014-06-18 08:47:06 -04:00
|
|
|
|
2014-05-16 19:26:47 -04:00
|
|
|
#ifndef HAVE_STRDUP
|
|
|
|
char *strdup(const char *s);
|
|
|
|
#endif
|
2014-05-16 12:35:56 -04:00
|
|
|
|
2014-05-16 19:26:47 -04:00
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
char *strndup(const char *s, int n);
|
|
|
|
#endif
|
2014-05-16 12:35:56 -04:00
|
|
|
|
2015-08-27 01:58:36 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-05-15 08:38:07 -04:00
|
|
|
|
2015-11-17 05:27:25 -05:00
|
|
|
#endif /* !R3_STR_H */
|