Jove bug

Keith Packard keith at mit-vax.LCS.MIT.EDU
Thu May 19 01:35:28 AEST 1988


In article <4022 at killer.UUCP> elg at killer.UUCP (Eric Green) writes:
<System: AT&T 3b2, running Sys V.3
<Software: Jove 4.9, as recently posted to comp.unix.sources
<problem: The PWD environment variable is read to find out what
<the current working directory is. Unfortunately, the version of csh
<that I am using does not maintain the PWD environment variable. Since csh was

Here's a more reasonable solution -- a replacement for getCWD that
make's sure it knows where it is.

This is actually from version 4.7 of Jove -- I'm currently negotiating
with jonathan about incorporating some of the changes I've made back
into the regular distribution, but haven't started looking at what will
be needed to merge with 4.9.  

		keith packard
		keith at expo.lcs.mit.edu

getCWD()
{
	char	*cwd;
#ifdef IPROCS
#ifdef SYSVR2
	extern char	*getcwd();
#else
	extern char	*getwd();
#endif
	char	pathname[FILESIZE];
#endif
	struct stat	dots, cwds;

	if ((cwd = getenv("PWD")) || (cwd = getenv ("CWD"))) {
		if (stat (".", &dots) == -1 || stat (cwd, &cwds) == -1 ||
		    cwds.st_ino != dots.st_ino || cwds.st_dev != dots.st_dev)
			cwd = 0;
	}
	if (cwd == 0)
#ifdef IPROCS
# ifdef SYSVR2
		cwd = getcwd(pathname, sizeof (pathname));
# else
		cwd = getwd(pathname);
# endif
#else
		cwd = getwd();
#endif

	setCWD(cwd);
}	



More information about the Comp.sources.bugs mailing list