xref: /original-bsd/usr.bin/f77/libU77/getcwd_.c (revision 2301fdfb)
1 /*
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  *
6  *	@(#)getcwd_.c	5.1	06/07/85
7  */
8 
9 /*
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 
20 #include <sys/param.h>
21 #ifndef	MAXPATHLEN
22 #define MAXPATHLEN	128
23 #endif
24 
25 extern int errno;
26 char	*getwd();
27 
28 long
29 getcwd_(path, len)
30 char *path;
31 long len;
32 {
33 	char	*p;
34 	char	pathname[MAXPATHLEN];
35 
36 	p = getwd(pathname);
37 	b_char(pathname, path, len);
38 	if (p)
39 		return(0L);
40 	else
41 		return((long)errno);
42 }
43