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