X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhstore.c;fp=uip%2Fmhstore.c;h=50c911c86117e68786459b2ec582ed41bd33da9d;hb=41b6eadbcecf63c9a66aa5e582011987494abefb;hp=6f6746debf8ba2e56b35906d1db086649d61a78a;hpb=3410b680416c49a7617491af38bc1929855a331d;p=mmh diff --git a/uip/mhstore.c b/uip/mhstore.c index 6f6746d..50c911c 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -470,7 +470,7 @@ store_switch(CT ct) static int store_generic(CT ct) { - char **ap, **ep, *cp; + char **ap, **vp, *cp; CI ci = &ct->c_ctinfo; /* @@ -483,17 +483,20 @@ store_generic(CT ct) if (autosw && ct->c_type != CT_MESSAGE && !ct->c_storeproc) { /* ** Check the attribute/value pairs, for the attribute "name". - ** If found, do a few sanity checks and copy the value into - ** the storeproc. + ** If found, take the basename, do a few sanity checks and + ** copy the value into c_storeproc. */ - for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - if (mh_strcasecmp(*ap, "name")==0 && - *(cp = *ep) != '/' && *cp != '.' && - *cp != '|' && *cp != '!' && + for (ap = ci->ci_attrs, vp = ci->ci_values; *ap; ap++,vp++) { + if (mh_strcasecmp(*ap, "name")!=0) { + continue; + } + cp = mhbasename(*vp); + if (*cp && *cp!='.' && *cp!='|' && *cp!='!' && !strchr(cp, '%')) { + /* filename looks good: use it */ ct->c_storeproc = getcpy(cp); - break; } + break; } } @@ -650,8 +653,10 @@ store_external(CT ct) if (autosw) { char *cp; - if ((cp = e->eb_name) && *cp != '/' && *cp != '.' && - *cp != '|' && *cp != '!' && !strchr(cp, '%')) { + cp = mhbasename(e->eb_name); + if (*cp && *cp!='.' && *cp!='|' && *cp!='!' && + !strchr(cp, '%')) { + /* filename looks good: use it */ if (!ct->c_storeproc) ct->c_storeproc = getcpy(cp); if (!p->c_storeproc) @@ -900,8 +905,8 @@ output_content_file(CT ct, int appending) FILE *fp; /* - ** If the pathname is absolute, make sure - ** all the relevant directories exist. + ** If the pathname contains directories, make sure + ** all of them exist. */ if (strchr(ct->c_storage, '/') && make_intermediates(ct->c_storage) == NOTOK)