Added debug messages.
[reactos.git] / reactos / lib / msvcrt / stdlib / senv.c
1 #include <windows.h>
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/string.h>
4
5 #define NDEBUG
6 #include <msvcrt/msvcrtdbg.h>
7
8 void _searchenv(const char *file,const char *var,char *path )
9 {
10 char *env = getenv(var);
11 char *x;
12 char *y;
13 char *FilePart;
14
15 DPRINT("_searchenv()\n");
16 x = strchr(env,'=');
17 if ( x != NULL ) {
18 *x = 0;
19 x++;
20 }
21 y = strchr(env,';');
22 while ( y != NULL ) {
23 *y = 0;
24 if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
25 return;
26 }
27 x = y+1;
28 y = strchr(env,';');
29 }
30 return;
31 }
32
33 void _wsearchenv(const wchar_t *file,const wchar_t *var,wchar_t *path)
34 {
35 wchar_t *env = _wgetenv(var);
36 wchar_t *x;
37 wchar_t *y;
38 wchar_t *FilePart;
39
40 DPRINT("_searchenw()\n");
41 x = wcschr(env,L'=');
42 if ( x != NULL ) {
43 *x = 0;
44 x++;
45 }
46 y = wcschr(env,L';');
47 while ( y != NULL ) {
48 *y = 0;
49 if ( SearchPathW(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
50 return;
51 }
52 x = y+1;
53 y = wcschr(env,L';');
54 }
55 return;
56 }