Commit | Line | Data |
---|---|---|
dd052957 | 1 | /* |
05ec41e3 | 2 | char id_getcwd[] = "@(#)getcwd_.c 1.5"; |
dd052957 DW |
3 | * Get pathname of current working directory. |
4 | * | |
5 | * calling sequence: | |
6 | * character*128 path | |
7 | * ierr = getcwd(path) | |
8 | * where: | |
9 | * path will receive the pathname of the current working directory. | |
10 | * ierr will be 0 if successful, a system error code otherwise. | |
11 | */ | |
12 | ||
05ec41e3 DW |
13 | #include <sys/param.h> |
14 | #ifndef MAXPATHLEN | |
15 | #define MAXPATHLEN 128 | |
16 | #endif | |
17 | ||
dd052957 | 18 | extern int errno; |
28a346e8 | 19 | char *getwd(); |
dd052957 DW |
20 | |
21 | long | |
22 | getcwd_(path, len) | |
23 | char *path; | |
431aa77e | 24 | long len; |
dd052957 | 25 | { |
28a346e8 | 26 | char *p; |
05ec41e3 | 27 | char pathname[MAXPATHLEN]; |
dd052957 | 28 | |
28a346e8 DW |
29 | p = getwd(pathname); |
30 | b_char(pathname, path, len); | |
dd052957 | 31 | if (p) |
dd052957 | 32 | return(0L); |
28a346e8 DW |
33 | else |
34 | return((long)errno); | |
dd052957 | 35 | } |