Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openhackware / src / libc / include / string.h
1 /*
2  * <string.h>
3  *
4  * Open Hack'Ware BIOS: subset of POSIX string definitions
5  * 
6  * Copyright (c) 2004-2005 Jocelyn Mayer
7  * 
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
11  *
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.
16  *
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
20  */
21
22 #if !defined (__OHW_STRING_H__)
23 #define __OHW_STRING_H__
24
25 /* size_t is declared here */
26 #include <stddef.h>
27
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);
58 #if 0 // TODO
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);
65 #endif // TODO
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);
70
71 #if 0
72 static inline int ffs (int value)
73 {
74     int tmp;
75     
76     __asm__ __volatile__ ("cntlzw %0, %1" : "=r" (tmp) : "r" (value));
77     
78     return 32 - tmp;
79 }
80 #endif
81
82 static inline int ffs (int value)
83 {
84     return __builtin_ffs(value);
85 }
86
87 int ffsl (long i);
88 int ffsll (long long i);
89
90 #endif /* !defined (__OHW_STRING_H__) */