help on $cdpath
utzoo!decvax!harpo!floyd!cmcl2!philabs!sdcsvax!phonlab!sdcsla!warner
utzoo!decvax!harpo!floyd!cmcl2!philabs!sdcsvax!phonlab!sdcsla!warner
Tue Dec 21 16:16:57 AEST 1982
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);
More information about the Comp.lang.c
mailing list