root/Whitix/trunk/include/string.h

Revision 1668, 1.9 KB (checked in by mwhitworth, 3 years ago)

Merge in changes from keobject.

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#ifndef STRING_H
20#define STRING_H
21
22#include <stdarg.h>
23#include <typedefs.h>
24
25int strncpy(char* dest,char* src,int len);
26int strncmp(const char* s1,const char* s2,int num);
27int strlen(char* str);
28static inline int strcmp(const char* s1,const char* s2) {return strncmp(s1,s2,0xFFFFFFFF);}
29int strnicmp(const char* s1,const char* s2,int num);
30char* strcat(char* s1,const char* s2);
31char* strchr(char* string,int c);
32void* memcpy(void* dest,void* src,long size);
33
34#if 0
35static inline void* memcpy(void* dest,void* src,long size)
36{
37        return ((__builtin_constant_p(size) ? __builtin_memcpy(dest,src,size) : var_memcpy(dest,src,size)));
38}
39#endif
40
41void* memset(void* pointer, unsigned int size,char value);
42void* memsetw(void* pointer,int size /* in words */,WORD value);
43int memcmp(const void* s1, const void* s2, int n);
44#define ZeroMemory(p,sz) memset((char*)(p),(sz),0)
45
46int vsprintf(char* buf,const char* fmt, VaList args);
47int vsnprintf(char* buf, int size, const char* fmt, VaList args);
48int toupper(char c);
49
50static inline int isupper(char c)
51{
52        return (c >= 'A' && c <= 'Z');
53}
54
55static inline int tolower(char c)
56{
57        if (isupper(c))
58                c|=0x20;
59
60        return c;
61}
62
63char* vasprintf(const char* fmt, VaList args);
64
65#endif
Note: See TracBrowser for help on using the browser.