|
#define | isspace elinks_isspace |
|
#define | skip_space(S) do { while (isspace((unsigned char)*(S))) (S)++; } while (0) |
|
#define | skip_nonspace(S) do { while (*(S) && !isspace((unsigned char)*(S))) (S)++; } while (0) |
|
#define | isdigit(c) ((c) >= '0' && (c) <= '9') |
|
#define | isquote(c) ((c) == '"' || (c) == '\'') |
|
#define | isasciialpha(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) |
|
#define | isasciialnum(c) (isasciialpha(c) || isdigit(c)) |
|
#define | isident(c) (isasciialnum(c) || (c) == '_' || (c) == '-') |
|
#define | isscreensafe(c) ((c) >= ' ' && (c) != ASCII_DEL) |
| Char is safe to write to the terminal screen.
|
|
#define | isscreensafe_ucs(c) (((c) >= 0x20 && (c) <= 0x7E) || (c) >= 0xA0) |
| Like isscreensafe() but takes Unicode values and so can check for C1.
|
|
#define | DEBUG_STRING |
| String debugging using magic number, it may catch some errors.
|
|
#define | STRING_GRANULARITY 0xFF |
| The granularity used for the struct string based utilities.
|
|
#define | STRING_MAGIC 0x2E5BF271 |
|
#define | check_string_magic(x) assertm((x)->magic == STRING_MAGIC, "String magic check failed.") |
|
#define | set_string_magic(x) do { (x)->magic = STRING_MAGIC; } while (0) |
|
#define | NULL_STRING { STRING_MAGIC, {NULL}, 0 } |
|
#define | INIT_STRING(s, l) { STRING_MAGIC, {s}, l } |
|
#define | realloc_string(str, size) |
|
#define | add_bytes_to_string(string, bytes, length) add_bytes_to_string__(string, bytes, length) |
|
#define | debug_realloc_string(str, size) realloc_string(str, size) |
|
#define | empty_string_or_(str) ((str) ? (char *) (str) : (char *) "") |
| Returns an empty C string or str if different from NULL.
|
|
#define | null_or_stracpy(str) ((str) ? stracpy(str) : NULL) |
| Allocated copy if not NULL or returns NULL.
|
|
|
void | add_to_strn (char **str, const char *src) |
| Concatenates src to str.
|
|
char * | insert_in_string (char **dst, int pos, const char *seq, int seqlen) |
| Inserts seqlen chars from seq at position pos in the dst string.
|
|
char * | straconcat (const char *str,...) |
| Takes a list of strings where the last parameter must be (char *) NULL and concatenates them.
|
|
int | elinks_isspace (int c) |
|
struct string * | add_to_string (struct string *string, const char *source) |
|
struct string * | add_char_to_string (struct string *string, unsigned char character) |
|
struct string * | add_string_to_string (struct string *to, const struct string *from) |
|
struct string * | add_file_to_string (struct string *string, const char *filename) |
|
struct string * | add_crlf_to_string (struct string *string) |
|
static char * | squeezastring (struct string *string) |
|
static struct string * | add_bytes_to_string__ (struct string *string, const char *bytes, int length) |
|
void | free_string_list (struct string_list_item list *list) |
|
struct string * | add_to_ecmascript_string_list (struct ecmascript_string_list_item list *list, const char *string, int length, int element_offset) |
|
void | free_ecmascript_string_list (struct ecmascript_string_list_item list *list) |
|
void | el_string_replace (struct string *res, struct string *inp, struct string *what, struct string *repl) |
|
|
Note that, contrary to the utilities using the string struct, these functions are NOT granular, thus you can't simply reuse strings allocated by these in add_to_string()-style functions.
|
char * | memacpy (const char *src, int len) |
| Allocates NUL terminated string with len bytes from src.
|
|
char * | stracpy (const char *src) |
| Allocated NUL terminated string with the content of src.
|
|
|
#define | strlcmp(a, b, c, d) (errfile = __FILE__, errline = __LINE__, elinks_strlcmp(a,b,c,d)) |
| This routine compares string s1 of length n1 with string s2 of length n2.
|
|
#define | strlcasecmp(a, b, c, d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasecmp(a,b,c,d,0)) |
| Acts identically to strlcmp(), except for being case insensitive.
|
|
#define | c_strlcasecmp(a, b, c, d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasecmp(a,b,c,d,1)) |
|
#define | strlcasestr(a, b, c, d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasestr(a,b,c,d)) |
|
int | xstrcmp (const char *s1, const char *s2) |
| Compare two strings, handling correctly s1 or s2 being NULL.
|
|
char * | safe_strncpy (char *dst, const char *src, size_t len) |
| Copies at most len chars into dst.
|
|
int | elinks_strlcmp (const char *s1, size_t n1, const char *s2, size_t n2) |
|
int | elinks_strlcasecmp (const char *s1, size_t n1, const char *s2, size_t n2, const int locale_indep) |
|
char * | elinks_strlcasestr (const char *haystack, const int haystackl, const char *needle, const int needlel) |
|
int | c_strcasecmp (const char *s1, const char *s2) |
|
int | c_strncasecmp (const char *s1, const char *s2, size_t n) |
|
char * | c_strcasestr (const char *haystack, const char *needle) |
|
This routine compares string s1 of length n1 with string s2 of length n2.
This acts identically to strcmp() but for non-zero-terminated strings, rather than being similiar to strncmp(). That means, it fails if n1 != n2, thus you may use it for testing whether s2 matches full s1, not only its start (which can be a security hole, e.g. in the cookies domain checking).
n1 or n2 may be -1, which is same as strlen(s1 or s2) but possibly more effective (in the future ;-).
- Returns
- zero if the strings match or undefined non-zero value if they differ. (The non-zero return value is not same as for the standard strcmp() family.)