xref: /original-bsd/usr.bin/f77/libU77/getcwd_.c (revision 92d3de31)
1 /*
2 char id_getcwd[] = "@(#)getcwd_.c	1.5";
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 
13 #include <sys/param.h>
14 #ifndef	MAXPATHLEN
15 #define MAXPATHLEN	128
16 #endif
17 
18 extern int errno;
19 char	*getwd();
20 
21 long
22 getcwd_(path, len)
23 char *path;
24 long len;
25 {
26 	char	*p;
27 	char	pathname[MAXPATHLEN];
28 
29 	p = getwd(pathname);
30 	b_char(pathname, path, len);
31 	if (p)
32 		return(0L);
33 	else
34 		return((long)errno);
35 }
36