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