4
* Open Hack'Ware BIOS: subset of POSIX string definitions
6
* Copyright (c) 2004-2005 Jocelyn Mayer
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License V2
10
* as published by the Free Software Foundation
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#if !defined (__OHW_STRING_H__)
23
#define __OHW_STRING_H__
25
/* size_t is declared here */
28
void *memcpy (void *dest, const void *src, size_t n);
29
void *memccpy (void *dest, const void *src, int c, size_t n);
30
void *mempcpy (void *dest, const void *src, size_t n);
31
void *memmove (void *dest, const void *src, size_t n);
32
void *memcmove (void *dest, const void *src, int c, size_t n);
33
void *mempmove (void *dest, const void *src, size_t n);
34
void *memset (void *s, int c, size_t n);
35
int memcmp (const void *s1, const void *s2, size_t n);
36
void *memchr (const void *s, int c, size_t n);
37
void *rawmemchr (const void *s, int c);
38
void *memrchr (const void *s, int c, size_t n);
39
void *memmem (const void *haystack, size_t haystacklen,
40
const void *needle, size_t neddlelen);
41
void *strcpy (char *dest, const char *src);
42
void *strncpy (char *dest, const char *src, size_t n);
43
char *strdup (const char *s);
44
char *strndup (const char *s, size_t n);
45
void *stpcpy (char *dest, const char *src);
46
void *stpncpy (char *dest, const char *src, size_t n);
47
char *strcat (char *dest, const char *src);
48
char *strncat (char *dest, const char *src, size_t n);
49
int strcmp (const char *s1, const char *s2);
50
int strcasecmp (const char *s1, const char *s2);
51
int strncmp (const char *s1, const char *s2, size_t n);
52
int strncasecmp (const char *s1, const char *s2, size_t n);
53
char *strchr (const char *s, int c);
54
char *strchrnul (const char *s, int c);
55
char *strrchr (const char *s, int c);
56
char *strstr (const char *haystack, const char *needle);
57
char *strcasestr (const char *haystack, const char *needle);
59
size_t strspn (const char *s, const char *accept);
60
size_t strcspn (const char *s, const char *reject);
61
char *strpbrk (const char *s, const char *accept);
62
char *strtok (char *s, const char *delim);
63
char *strtok_r (char *s, const char *delim, char **ptrptr);
64
char *strsep (char **stringp, const char *delim);
66
char *basename (char *path);
67
char *dirname (char *path);
68
size_t strlen (const char *s);
69
size_t strnlen (const char *s, size_t maxlen);
72
static inline int ffs (int value)
76
__asm__ __volatile__ ("cntlzw %0, %1" : "=r" (tmp) : "r" (value));
82
static inline int ffs (int value)
84
return __builtin_ffs(value);
88
int ffsll (long long i);
90
#endif /* !defined (__OHW_STRING_H__) */