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