xref: /csrg-svn/usr.bin/f77/libU77/getcwd_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
423021Skre  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623021Skre  */
723021Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)getcwd_.c	5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223021Skre /*
133557Sdlw  * Get pathname of current working directory.
143557Sdlw  *
153557Sdlw  * calling sequence:
163557Sdlw  *	character*128 path
173557Sdlw  *	ierr = getcwd(path)
183557Sdlw  * where:
193557Sdlw  *	path will receive the pathname of the current working directory.
203557Sdlw  *	ierr will be 0 if successful, a system error code otherwise.
213557Sdlw  */
223557Sdlw 
2312143Sdlw #include <sys/param.h>
2412143Sdlw #ifndef	MAXPATHLEN
2512143Sdlw #define MAXPATHLEN	128
2612143Sdlw #endif
2712143Sdlw 
283557Sdlw extern int errno;
2910645Sdlw char	*getwd();
303557Sdlw 
313557Sdlw long
getcwd_(path,len)323557Sdlw getcwd_(path, len)
333557Sdlw char *path;
343579Sdlw long len;
353557Sdlw {
3610645Sdlw 	char	*p;
3712143Sdlw 	char	pathname[MAXPATHLEN];
383557Sdlw 
3910645Sdlw 	p = getwd(pathname);
4010645Sdlw 	b_char(pathname, path, len);
413557Sdlw 	if (p)
423557Sdlw 		return(0L);
4310645Sdlw 	else
4410645Sdlw 		return((long)errno);
453557Sdlw }
46