update for HEAD-2003091401
[reactos.git] / lib / msvcrt / stdlib / wmakpath.c
1 /* $Id$
2  */
3 #include <msvcrt/stdlib.h>
4 #include <msvcrt/string.h>
5
6
7 /*
8  * @implemented
9  */
10 void _wmakepath(wchar_t* path, const wchar_t* drive, const wchar_t* dir, const wchar_t* fname, const wchar_t* ext)
11 {
12     int dir_len;
13
14     if ((drive != NULL) && (*drive)) {
15         path[0] = *drive;
16         path[1] = L':';
17         path[2] = 0;
18     } else {
19         (*path) = 0;
20     }
21
22     if (dir != NULL) {
23         wcscat(path, dir);
24         dir_len = wcslen(dir);
25         if (dir_len && *(dir + dir_len - 1) != L'\\')
26             wcscat(path, L"\\");
27     }
28
29     if (fname != NULL) {
30         wcscat(path, fname);
31         if (ext != NULL && *ext != 0) {
32             if (*ext != L'.')
33                 wcscat(path, L".");
34             wcscat(path, ext);
35         }
36     }
37 }