update for HEAD-2003091401
[reactos.git] / lib / crtdll / 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       strcpy(path, drive);
15       strcat(path, ":");
16     } else {
17         (*path)=0;
18     }
19
20     if (dir != NULL) {
21       strcat(path, dir);
22       dir_len = strlen(dir);
23       if (dir_len && *(dir + dir_len - 1) != '\\')
24         strcat(path, "\\");
25     }
26
27     if (fname != NULL) {
28       strcat(path, fname);
29         if (ext != NULL && *ext != 0) {
30           if (*ext != '.')
31             strcat(path, ".");
32         strcat(path, ext);
33         }
34     }
35 }