[net.general] help on $cdpath

warner (12/22/82)

	I am trying to access the login shell's variable
$cdpath ... without success. The relevant code fragment is below.
I'v tried about every combination of ("csh -t echo $cdpath) etc.
with all the combinations of ' " and ` that I can think of. No luck.
I can call my program with $cdpath as an argument but I don't want
to. Any suggestions besides giving up programming.
Ken Warner  ...ucb!sdcsvax!sdcsla:warner or net.followup 
--------------------------------------------------------------------
	FILE *pwd, *popen();
	char cdpath[128],curdir[128];
	if ((pwd = popen("echo $cdpath","r")) == NULL)
	{
		printf("can't open pwd\n");
		exit(1);
	}
	fgets(cdpath,128,pwd);
	pclose(pwd);
	cdpath[strlen(cdpath) - 1] = '\0';
	printf("cdpath = %s\n",cdpath);
	exit(1);