xref: /csrg-svn/usr.bin/f77/libU77/getcwd_.c (revision 23021)
13557Sdlw /*
2*23021Skre  * Copyright (c) 1980 Regents of the University of California.
3*23021Skre  * All rights reserved.  The Berkeley software License Agreement
4*23021Skre  * specifies the terms and conditions for redistribution.
5*23021Skre  *
6*23021Skre  *	@(#)getcwd_.c	5.1	06/07/85
7*23021Skre  */
8*23021Skre 
9*23021Skre /*
103557Sdlw  * Get pathname of current working directory.
113557Sdlw  *
123557Sdlw  * calling sequence:
133557Sdlw  *	character*128 path
143557Sdlw  *	ierr = getcwd(path)
153557Sdlw  * where:
163557Sdlw  *	path will receive the pathname of the current working directory.
173557Sdlw  *	ierr will be 0 if successful, a system error code otherwise.
183557Sdlw  */
193557Sdlw 
2012143Sdlw #include <sys/param.h>
2112143Sdlw #ifndef	MAXPATHLEN
2212143Sdlw #define MAXPATHLEN	128
2312143Sdlw #endif
2412143Sdlw 
253557Sdlw extern int errno;
2610645Sdlw char	*getwd();
273557Sdlw 
283557Sdlw long
293557Sdlw getcwd_(path, len)
303557Sdlw char *path;
313579Sdlw long len;
323557Sdlw {
3310645Sdlw 	char	*p;
3412143Sdlw 	char	pathname[MAXPATHLEN];
353557Sdlw 
3610645Sdlw 	p = getwd(pathname);
3710645Sdlw 	b_char(pathname, path, len);
383557Sdlw 	if (p)
393557Sdlw 		return(0L);
4010645Sdlw 	else
4110645Sdlw 		return((long)errno);
423557Sdlw }
43