3 #include <linux/kernel.h> 4 #include <linux/string.h> 24 length = strtoll(str, &p, 10);
51 if (strcmp(p,
"b") != 0)
54 if (strcmp(p,
"B") != 0)
107 for (p = argv; *p; p++) {
130 char **argv = calloc(argc + 1,
sizeof(*argv));
150 t = strndup(p, str-p);
169 bool complement =
false, ret =
true;
178 while (*pat && *pat !=
']') {
179 if (*pat ==
'-' && *(pat + 1) !=
']') {
180 if (*(pat - 1) <= c && c <= *(pat + 1))
182 if (*(pat - 1) > *(pat + 1))
185 }
else if (*pat++ == c)
193 while (*pat && *pat !=
']')
198 return complement ? !ret : ret;
208 while (*str && *pat && *pat !=
'*') {
224 }
else if (*pat ==
'[')
230 else if (*pat ==
'\\')
235 }
else if (*str != *pat)
250 return !*str && !*pat;
299 while (--i1 >= 0 && --i2 >= 0) {
300 if (s1[i1] != s2[i2])
301 return s1[i1] - s2[i2];
318 while ((p = strchr(p, from)) != NULL)
347 size_t size = strlen(s);
354 while (end >= s &&
isspace(*end))
369 size_t size = nints * 28 + 1;
370 size_t i, printed = 0;
371 char *expr =
malloc(size);
374 const char *or_and =
"||", *eq_neq =
"==";
382 for (i = 0; i < nints; ++i) {
384 goto out_err_overflow;
387 printed += scnprintf(e + printed, size - printed,
" %s ", or_and);
388 printed += scnprintf(e + printed, size - printed,
389 "%s %s %d", var, eq_neq, ints[i]);
406 ptr = strpbrk(str, stopset);
408 (ptr == str + 1 && *(ptr - 1) !=
'\\'))
411 }
while (ptr && *(ptr - 1) ==
'\\' && *(ptr - 2) !=
'\\');
419 char *s, *d, *p, *ret = strdup(str);
424 d = strchr(ret,
'\\');
434 p = strchr(s + 1,
'\\');
436 memmove(d, s, p - s);
440 memmove(d, s, strlen(s) + 1);
void argv_free(char **argv)
bool strglobmatch(const char *str, const char *pat)
s64 perf_atoll(const char *str)
static const char * skip_sep(const char *cp)
static bool __match_charclass(const char *pat, char c, const char **npat)
static int str(yyscan_t scanner, int token)
char * strxfrchar(char *s, char from, char to)
static bool __match_glob(const char *str, const char *pat, bool ignore_space, bool case_ins)
char * strpbrk_esc(char *str, const char *stopset)
static int count_argc(const char *str)
static const char * skip_arg(const char *cp)
bool strglobmatch_nocase(const char *str, const char *pat)
int strtailcmp(const char *s1, const char *s2)
bool strlazymatch(const char *str, const char *pat)
char * asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints)
char * strdup_esc(const char *str)
char ** argv_split(const char *str, int *argcp)