diff options
Diffstat (limited to 'local.c')
-rw-r--r-- | local.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: local.c,v 1.22 2003/01/17 16:57:20 ukai Exp $ */ +/* $Id: local.c,v 1.23 2003/01/17 17:06:03 ukai Exp $ */ #include "fm.h" #include <string.h> #include <stdio.h> @@ -296,19 +296,22 @@ set_cgi_environ(char *name, char *fn, char *req_uri) static Str checkPath(char *fn, char *path) { + char *p; Str tmp; struct stat st; while (*path) { - tmp = Strnew(); - while (*path && *path != ':') - Strcat_char(tmp, *path++); - if (*path == ':') - path++; + p = strchr(path, ':'); + tmp = Strnew_charp(expandPath(p ? allocStr(path, p - path) : path)); if (Strlastchar(tmp) != '/') Strcat_char(tmp, '/'); Strcat_charp(tmp, fn); if (stat(tmp->ptr, &st) == 0) return tmp; + if (!p) + break; + path = p + 1; + while (*path == ':') + path++; } return NULL; } |