2 * linux/tools/lib/string.c
4 * Copied from linux/lib/string.c, where it is:
6 * Copyright (C) 1991, 1992 Linus Torvalds
8 * More specifically, the first copied function was strtobool, which
11 * d0f1fed29e6e ("Add a strtobool function matching semantics of existing in kernel equivalents")
12 * Author: Jonathan Cameron <jic23@cam.ac.uk>
18 #include <linux/string.h>
21 * memdup - duplicate region of memory
23 * @src: memory region to duplicate
24 * @len: memory region length
26 void *memdup(const void *src, size_t len)
28 void *p = malloc(len);
37 * strtobool - convert common user inputs into boolean values
41 * This routine returns 0 iff the first character is one of 'Yy1Nn0'.
42 * Otherwise it will return -EINVAL. Value pointed to by res is
43 * updated upon finding a match.
45 int strtobool(const char *s, bool *res)