2 * MSVCRT string functions
4 * Copyright 1996,1998 Marcus Meissner
5 * Copyright 1996 Jukka Iivonen
6 * Copyright 1997,2000 Uwe Bonnes
7 * Copyright 2000 Jon Griffiths
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define _ISOC99_SOURCE
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
33 /*********************************************************************
37 char* CDECL _strdup(const char* str)
41 char * ret = MSVCRT_malloc(strlen(str)+1);
42 if (ret) strcpy( ret, str );
48 /*********************************************************************
51 char* CDECL _strnset(char* str, int value, MSVCRT_size_t len)
59 /*********************************************************************
62 char* CDECL _strrev(char* str)
68 for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
78 /*********************************************************************
81 char* CDECL _strset(char* str, int value)
90 /*********************************************************************
93 char * CDECL MSVCRT_strtok( char *str, const char *delim )
95 thread_data_t *data = msvcrt_get_thread_data();
99 if (!(str = data->strtok_next)) return NULL;
101 while (*str && strchr( delim, *str )) str++;
102 if (!*str) return NULL;
104 while (*str && !strchr( delim, *str )) str++;
105 if (*str) *str++ = 0;
106 data->strtok_next = str;
111 /*********************************************************************
114 void CDECL MSVCRT__swab(char* src, char* dst, int len)
118 len = (unsigned)len >> 1;
130 /*********************************************************************
133 double CDECL MSVCRT_atof( const char *str )
138 /*********************************************************************
141 double CDECL MSVCRT_strtod( const char *str, char **end )
143 return strtod( str, end );
146 /*********************************************************************
149 int CDECL MSVCRT_strcoll( const char* str1, const char* str2 )
151 /* FIXME: handle Windows locale */
152 return strcoll( str1, str2 );
155 /*********************************************************************
158 MSVCRT_size_t CDECL MSVCRT_strxfrm( char *dest, const char *src, MSVCRT_size_t len )
160 /* FIXME: handle Windows locale */
161 return strxfrm( dest, src, len );
164 /*********************************************************************
165 * _stricoll (MSVCRT.@)
167 int CDECL MSVCRT__stricoll( const char* str1, const char* str2 )
169 /* FIXME: handle collates */
170 TRACE("str1 %s str2 %s\n", debugstr_a(str1), debugstr_a(str2));
171 return lstrcmpiA( str1, str2 );
174 /********************************************************************
175 * _atoldbl (MSVCRT.@)
177 int CDECL MSVCRT__atoldbl(MSVCRT__LDOUBLE *value, const char *str)
179 /* FIXME needs error checking for huge/small values */
181 TRACE("str %s value %p\n",str,value);
182 value->x = strtold(str,0);
184 FIXME("stub, str %s value %p\n",str,value);
189 /********************************************************************
190 * __STRINGTOLD (MSVCRT.@)
192 int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, int flags )
195 FIXME("%p %p %s %x partial stub\n", value, endptr, str, flags );
196 value->x = strtold(str,endptr);
198 FIXME("%p %p %s %x stub\n", value, endptr, str, flags );