Line | |
---|
1 | /* Copyright Vladimir Prus 2002. Distributed under the Boost */ |
---|
2 | /* Software License, Version 1.0. (See accompanying */ |
---|
3 | /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ |
---|
4 | |
---|
5 | #include "jam.h" |
---|
6 | #include "lists.h" |
---|
7 | #include "newstr.h" |
---|
8 | #include "pathsys.h" |
---|
9 | |
---|
10 | #include <limits.h> |
---|
11 | |
---|
12 | /* MinGW on windows declares PATH_MAX in limits.h */ |
---|
13 | #if defined(NT) && ! defined(__GNUC__) |
---|
14 | #include <direct.h> |
---|
15 | #define PATH_MAX _MAX_PATH |
---|
16 | #else |
---|
17 | #include <limits.h> |
---|
18 | #include <unistd.h> |
---|
19 | #if defined(__COMO__) |
---|
20 | #include <linux/limits.h> |
---|
21 | #endif |
---|
22 | #endif |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | LIST* |
---|
27 | pwd(void) |
---|
28 | { |
---|
29 | char buffer[PATH_MAX]; |
---|
30 | if (getcwd(buffer, sizeof(buffer)) == NULL) |
---|
31 | { |
---|
32 | perror("can not get current directory"); |
---|
33 | return L0; |
---|
34 | } |
---|
35 | else |
---|
36 | { |
---|
37 | #ifdef NT |
---|
38 | return list_new(L0, short_path_to_long_path(buffer)); |
---|
39 | #else |
---|
40 | return list_new(L0, newstr(buffer)); |
---|
41 | #endif |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.