[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>
This commit is contained in:
15
local.c
15
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user