static int
store_generic(CT ct)
{
- char **ap, **ep, *cp;
+ char **ap, **vp, *cp;
CI ci = &ct->c_ctinfo;
/*
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;
}
}
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)
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)