Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site garfield.UUCP Path: utzoo!utcsrgv!garfield!wolf From: wolf@garfield.UUCP (Wolfgang Thomeier) Newsgroups: net.lang.c Subject: Re: <180@sdcsla.UUCP> (help on $cdpath) Message-ID: <741@garfield.UUCP> Date: Mon, 5-Dec-83 10:31:24 EST Article-I.D.: garfield.741 Posted: Mon Dec 5 10:31:24 1983 Date-Received: Mon, 5-Dec-83 15:44:59 EST Organization: Memorial Univ. of Nfld., St. John's, Canada Lines: 51 I am posting this to the net at the request of a friend of mine. Please mail any responses to this to me and I will forward it through the proper channels. ----------------------------------------------------------------- With reference to cdpath you might try one of the following ..... This is not the actual login shells variable but it will give the cdpath of a csh that you start up. main() { int topipe[2]; char temp[256]; pipe( topipe ); if ( fork() == 0 ) { dup2( topipe[1], 1); close( topipe[0] ); close( topipe[1] ); execl("/bin/csh","pwd","-c","echo $cdpath"); } close( topipe[1] ); read( topipe[0], temp, sizeof(temp) ); close( topipe[0] ); printf("%s", temp); } ---------------------------------------------------------------- OR ---------------------------------------------------------------- #include main() { FILE *pwd,*popen(); char temp[256]; pwd = popen("csh -c 'echo $cdpath' ", "r"); fread( temp, sizeof( temp ), 1, pwd ); printf("%s\n", temp ); } ---------------------------------------------------------------- End of forwarded article UUCP: {allegra, ihnp4, utcsrgv}!garfield!wolf In real life: Wolfgang Thomeier Memorial University of Newfoundland St. John's, NF