X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fcf.c;fp=lib%2Fcf.c;h=f5defd7e37b10a02e1daea4aec0256befadcec81;hb=f9a65eb249034b28f604dce099deb1a622d373cf;hp=ba63999eba44303f36905866281335dbce7159c7;hpb=518c678c21a99f4b148f3cb1f40afe8b51577082;p=ashd.git diff --git a/lib/cf.c b/lib/cf.c index ba63999..f5defd7 100644 --- a/lib/cf.c +++ b/lib/cf.c @@ -233,22 +233,27 @@ void freecfparser(struct cfstate *s) char *findstdconf(char *name) { - char *path, *p, *p2, *t; + char *home, *path, *p, *p2, *t; - if((path = getenv("PATH")) == NULL) - return(NULL); - path = sstrdup(path); - for(p = strtok(path, ":"); p != NULL; p = strtok(NULL, ":")) { - if((p2 = strrchr(p, '/')) == NULL) - continue; - *p2 = 0; - if(!access(t = sprintf2("%s/etc/%s", p, name), R_OK)) { - free(path); + if((home = getenv("HOME")) != NULL) { + if(!access(t = sprintf2("%s/.ashd/etc/%s", home, name), R_OK)) return(t); - } free(t); } - free(path); + if((path = getenv("PATH")) != NULL) { + path = sstrdup(path); + for(p = strtok(path, ":"); p != NULL; p = strtok(NULL, ":")) { + if((p2 = strrchr(p, '/')) == NULL) + continue; + *p2 = 0; + if(!access(t = sprintf2("%s/etc/%s", p, name), R_OK)) { + free(path); + return(t); + } + free(t); + } + free(path); + } return(NULL); }