aboutsummaryrefslogtreecommitdiffstats
path: root/rc.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 /rc.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 'rc.c')
-rw-r--r--rc.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/rc.c b/rc.c
index 80370f4..cdb68ff 100644
--- a/rc.c
+++ b/rc.c
@@ -1,4 +1,4 @@
-/* $Id: rc.c,v 1.76 2003/01/17 16:58:17 ukai Exp $ */
+/* $Id: rc.c,v 1.77 2003/01/17 17:06:05 ukai Exp $ */
/*
* Initialization file etc.
*/
@@ -1375,7 +1375,7 @@ init_rc(void)
if (config_file != NULL)
goto open_rc;
- rc_dir = expandName(RC_DIR);
+ rc_dir = expandPath(RC_DIR);
i = strlen(rc_dir);
if (i > 1 && rc_dir[i - 1] == '/')
rc_dir[i - 1] = '\0';
@@ -1580,53 +1580,35 @@ rcFile(char *base)
(base[0] == '.'
&& (base[1] == '/' || (base[1] == '.' && base[2] == '/')))
|| (base[0] == '~' && base[1] == '/')))
- return expandName(base);
- else {
- Str file = Strnew_charp(rc_dir);
-
- if (Strlastchar(file) != '/')
- Strcat_char(file, '/');
- Strcat_charp(file, base);
- return expandName(file->ptr);
- }
+ /* /file, ./file, ../file, ~/file */
+ return expandPath(base);
+ return expandPath(Strnew_m_charp(rc_dir, "/", base, NULL)->ptr);
}
char *
auxbinFile(char *base)
{
- Str file = Strnew_charp(w3m_auxbin_dir());
- Strcat_char(file, '/');
- Strcat_charp(file, base);
- return expandName(file->ptr);
+ return expandPath(Strnew_m_charp(w3m_auxbin_dir(), "/", base, NULL)->ptr);
}
#if 0 /* not used */
char *
libFile(char *base)
{
- Str file = Strnew_charp(w3m_lib_dir());
- Strcat_char(file, '/');
- Strcat_charp(file, base);
- return expandName(file->ptr);
+ return expandPath(Strnew_m_charp(w3m_lib_dir(), "/", base, NULL)->ptr);
}
#endif
char *
etcFile(char *base)
{
- Str file = Strnew_charp(w3m_etc_dir());
- Strcat_char(file, '/');
- Strcat_charp(file, base);
- return expandName(file->ptr);
+ return expandPath(Strnew_m_charp(w3m_etc_dir(), "/", base, NULL)->ptr);
}
#ifndef USE_HELP_CGI
char *
helpFile(char *base)
{
- Str file = Strnew_charp(w3m_help_dir());
- Strcat_char(file, '/');
- Strcat_charp(file, base);
- return expandName(file->ptr);
+ return expandPath(Strnew_m_charp(w3m_help_dir(), "/", base, NULL)->ptr);
}
#endif