X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/40a17f8f191deee9f27fd3dd394eda9a641e6f1c..47e4d2685ab31e71336a7806fdc3dcd2a107f60f:/uip/refile.c diff --git a/uip/refile.c b/uip/refile.c index cd352a40..05a533e2 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -1,6 +1,4 @@ - -/* - * refile.c -- move or link message(s) from a source folder +/* refile.c -- move or link message(s) from a source folder * -- into one or more destination folders * * This code is Copyright (c) 2002, by the authors of nmh. See the @@ -217,7 +215,7 @@ main (int argc, char **argv) */ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { if (is_selected (mp, msgnum)) { - cp = getcpy (m_name (msgnum)); + cp = mh_xstrdup(m_name (msgnum)); if (m_file (mp, cp, retainseqs ? msgnum : 0, folders, foldp, preserve, !linkf)) done (1); @@ -275,11 +273,13 @@ static void opnfolds (struct msgs *src_folder, struct st_fold *folders, int nfolders) { char nmaildir[BUFSIZ]; - register struct st_fold *fp, *ep; - register struct msgs *mp; + struct st_fold *fp, *ep; + struct msgs *mp; for (fp = folders, ep = folders + nfolders; fp < ep; fp++) { - chdir (m_maildir ("")); + if (chdir (m_maildir ("")) < 0) { + advise (m_maildir (""), "chdir"); + } strncpy (nmaildir, m_maildir (fp->f_name), sizeof(nmaildir)); /* @@ -302,21 +302,23 @@ opnfolds (struct msgs *src_folder, struct st_fold *folders, int nfolders) fp->f_mp = src_folder; } - chdir (maildir); + if (maildir[0] != '\0' && chdir (maildir) < 0) { + advise (maildir, "chdir"); + } } } /* - * Set the Previous-Sequence and then sychronize the + * Set the Previous-Sequence and then synchronize the * sequence file, for each destination folder. */ static void clsfolds (struct st_fold *folders, int nfolders) { - register struct st_fold *fp, *ep; - register struct msgs *mp; + struct st_fold *fp, *ep; + struct msgs *mp; for (fp = folders, ep = folders + nfolders; fp < ep; fp++) { mp = fp->f_mp;