path names in header files
Charles Shub
cdash at boulder.Colorado.EDU
Thu Mar 3 07:17:52 AEST 1988
several days ago, I posted a question about pathnames being immune
to one being relocated to another directory. Several solutions were posed
via mail and this composite of the ideas seems to work well. It doesn't
clutter up the environment with lots of path name variables and is minimal
overhead:
#define RELPATH a/b/c /* path from your home directory */
if (!(home = getenv("HOME")))
syserr("HOME not defined");
if (!(abs = malloc((unsigned) (strlen(RELPATH) + strlen(home) + 2))))
syserr("could not get path storage");
open(strcat(strcat(strcpy(abs,home),"/"),RELPATH),FLAGS,MODE);
--
cdash aka cdash at boulder.colorado.edu aka ...hao!boulder!cdash
aka ...nbires!boulder!cdash aka (303) 593-3492
More information about the Comp.unix.questions
mailing list