update for HEAD-2003091401
[reactos.git] / lib / msvcrt / direct / chdrive.c
1 #include <windows.h>
2 #include <msvcrt/ctype.h>
3 #include <msvcrt/direct.h>
4 #include <msvcrt/stdlib.h>
5
6
7 int cur_drive = 0;
8
9
10 /*
11  * @implemented
12  */
13 int _chdrive(int drive)
14 {
15     char d[3];
16
17     if (!( drive >= 1 && drive <= 26))
18         return -1;
19     if (cur_drive != drive) {
20         cur_drive = drive;
21         d[0] = toupper(cur_drive + '@');
22         d[1] = ':';
23         d[2] = 0;
24         SetCurrentDirectoryA(d);
25     }
26     return 0;
27 }