aboutsummaryrefslogtreecommitdiffstats
path: root/local.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-17 17:05:57 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-17 17:05:57 +0000
commitc09389519e3b83e995e8ea30e1bc424e55c437ba (patch)
treeceadd73b0818fe3273b9daa4a92dbd95d20183b1 /local.c
parentfix indent (diff)
downloadw3m-c09389519e3b83e995e8ea30e1bc424e55c437ba.tar.gz
w3m-c09389519e3b83e995e8ea30e1bc424e55c437ba.zip
[w3m-dev 03647] expandName() and expandPath()
* etc.c (openSecretFile): use expandPath (expandName): rewrite (file_to_url): use expandPath * file.c (_doFileCopy): use expandPath (doFileSave): use expandPath * indep.c (expandPath): rewrite * linein.c (inputLineHistSearch): use expandPath (next_dcompl): use expandPath (doComplete): use expandPath * local.c (set_cgi_environ): rewrite * mailcap.c (loadMailcap): use expandPath * main.c (svBuf): use expandPath (addDownloadList): use expandPath * rc.c (init_rc): use expandPath (rcFile): rewrite (auxbinFile): use expandPath (libFile): use expandPath (etcFile): use expandPath (helpFile): use expandPath * url.c (loadMimeTypes): use expandPath (loadURIMethods): use expandPath From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'local.c')
-rw-r--r--local.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/local.c b/local.c
index c22ec49..ebd59eb 100644
--- a/local.c
+++ b/local.c
@@ -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;
}