xref: /original-bsd/usr.bin/f77/libU77/getcwd_.c (revision 53fb7652)
1 /*-
2  * Copyright (c) 1980 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)getcwd_.c	5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11 
12 /*
13  * Get pathname of current working directory.
14  *
15  * calling sequence:
16  *	character*128 path
17  *	ierr = getcwd(path)
18  * where:
19  *	path will receive the pathname of the current working directory.
20  *	ierr will be 0 if successful, a system error code otherwise.
21  */
22 
23 #include <sys/param.h>
24 #ifndef	MAXPATHLEN
25 #define MAXPATHLEN	128
26 #endif
27 
28 extern int errno;
29 char	*getwd();
30 
31 long
32 getcwd_(path, len)
33 char *path;
34 long len;
35 {
36 	char	*p;
37 	char	pathname[MAXPATHLEN];
38 
39 	p = getwd(pathname);
40 	b_char(pathname, path, len);
41 	if (p)
42 		return(0L);
43 	else
44 		return((long)errno);
45 }
46