Added binary and unicode file i/o support to msvcrt.
[reactos.git] / reactos / lib / msvcrt / stdlib / wmakpath.c
1 /* $Id: wmakpath.c,v 1.1 2002/11/24 18:42:25 robd Exp $
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 }