Commit | Line | Data |
---|---|---|
dd052957 | 1 | /* |
161423a6 RE |
2 | * Copyright (c) 1980 Regents of the University of California. |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
95f51977 | 6 | * @(#)getcwd_.c 5.1 6/7/85 |
161423a6 RE |
7 | */ |
8 | ||
9 | /* | |
dd052957 DW |
10 | * Get pathname of current working directory. |
11 | * | |
12 | * calling sequence: | |
13 | * character*128 path | |
14 | * ierr = getcwd(path) | |
15 | * where: | |
16 | * path will receive the pathname of the current working directory. | |
17 | * ierr will be 0 if successful, a system error code otherwise. | |
18 | */ | |
19 | ||
05ec41e3 DW |
20 | #include <sys/param.h> |
21 | #ifndef MAXPATHLEN | |
22 | #define MAXPATHLEN 128 | |
23 | #endif | |
24 | ||
dd052957 | 25 | extern int errno; |
28a346e8 | 26 | char *getwd(); |
dd052957 DW |
27 | |
28 | long | |
29 | getcwd_(path, len) | |
30 | char *path; | |
431aa77e | 31 | long len; |
dd052957 | 32 | { |
28a346e8 | 33 | char *p; |
05ec41e3 | 34 | char pathname[MAXPATHLEN]; |
dd052957 | 35 | |
28a346e8 DW |
36 | p = getwd(pathname); |
37 | b_char(pathname, path, len); | |
dd052957 | 38 | if (p) |
dd052957 | 39 | return(0L); |
28a346e8 DW |
40 | else |
41 | return((long)errno); | |
dd052957 | 42 | } |