Export the wine server functions from ntdll.
[wine] / dlls / ntdll / string.c
1 /*
2  * NTDLL string functions
3  *
4  * Copyright 2000 Alexandre Julliard
5  */
6
7 #include "config.h"
8
9 #include <ctype.h>
10 #include <string.h>
11
12 #include "windef.h"
13
14 /*********************************************************************
15  *                  _memicmp   (NTDLL)
16  */
17 INT __cdecl _memicmp( LPCSTR s1, LPCSTR s2, DWORD len )
18 {
19     int ret = 0;
20     while (len--)
21     {
22         if ((ret = tolower(*s1) - tolower(*s2))) break;
23         s1++;
24         s2++;
25     }
26     return ret;
27 }
28
29 /*********************************************************************
30  *                  _strupr   (NTDLL)
31  */
32 LPSTR __cdecl _strupr( LPSTR str )
33 {
34     LPSTR ret = str;
35     for ( ; *str; str++) *str = toupper(*str);
36     return ret;
37 }
38
39 /*********************************************************************
40  *                  _strlwr   (NTDLL)
41  *
42  * convert a string in place to lowercase 
43  */
44 LPSTR __cdecl _strlwr( LPSTR str )
45 {
46     LPSTR ret = str;
47     for ( ; *str; str++) *str = tolower(*str);
48     return ret;
49 }
50
51
52 /*********************************************************************
53  *                  _ultoa   (NTDLL)
54  */
55 LPSTR  __cdecl _ultoa( unsigned long x, LPSTR buf, INT radix )
56 {
57     char buffer[32], *p;
58
59     p = buffer + sizeof(buffer);
60     *--p = 0;
61     do
62     {
63         int rem = x % radix;
64         *--p = (rem <= 9) ? rem + '0' : rem + 'a' - 10;
65         x /= radix;
66     } while (x);
67     strcpy( buf, p + 1 );
68     return buf;
69 }
70
71
72 /*********************************************************************
73  *                  _ltoa   (NTDLL)
74  */
75 LPSTR  __cdecl _ltoa( long x, LPSTR buf, INT radix )
76 {
77     LPSTR p = buf;
78     if (x < 0)
79     {
80         *p++ = '-';
81         x = -x;
82     }
83     _ultoa( x, p, radix );
84     return buf;
85 }
86
87
88 /*********************************************************************
89  *                  _itoa           (NTDLL)
90  */
91 LPSTR  __cdecl _itoa( int x, LPSTR buf, INT radix )
92 {
93     return _ltoa( x, buf, radix );
94 }