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