X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Frefile.c;h=b1c2aa98a8782206e5e531558cddfe6c8940fd1f;hp=2ac8916feadb184e361cdea99c7a79363c878c89;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/uip/refile.c b/uip/refile.c index 2ac8916..b1c2aa9 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -1,11 +1,11 @@ /* - * 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 - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** 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 +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include #include @@ -48,8 +48,8 @@ struct st_fold { }; /* - * static prototypes - */ +** static prototypes +*/ static void opnfolds (struct st_fold *, int); static void clsfolds (struct st_fold *, int); static void remove_files (int, char **); @@ -82,8 +82,8 @@ main (int argc, char **argv) argp = arguments; /* - * Parse arguments - */ + ** Parse arguments + */ while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -94,8 +94,7 @@ main (int argc, char **argv) adios (NULL, "-%s unknown\n", cp); case HELPSW: - snprintf (buf, sizeof(buf), "%s [msgs] [switches] +folder ...", - invo_name); + snprintf (buf, sizeof(buf), "%s [msgs] [switches] +folder ...", invo_name); print_help (buf, switches, 1); done (1); case VERSIONSW: @@ -128,20 +127,25 @@ main (int argc, char **argv) adios (NULL, "only one source folder at a time!"); if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); - folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp, - *cp != '@' ? TFOLDER : TSUBCWF); + folder = path (*cp == '+' || *cp == '@' ? + cp + 1 : cp, + *cp != '@' ? + TFOLDER : TSUBCWF); continue; case FILESW: if (filep > NFOLDERS) - adios (NULL, "only %d files allowed!", NFOLDERS); + adios (NULL, "only %d files allowed!", + NFOLDERS); if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + adios (NULL, "missing argument to %s", + argp[-2]); files[filep++] = path (cp, TFILE); continue; case RPROCSW: if (!(rmmproc = *argp++) || *rmmproc == '-') - adios (NULL, "missing argument to %s", argp[-2]); + adios (NULL, "missing argument to %s", + argp[-2]); continue; case NRPRCSW: rmmproc = NULL; @@ -150,7 +154,8 @@ main (int argc, char **argv) } if (*cp == '+' || *cp == '@') { if (foldp > NFOLDERS) - adios (NULL, "only %d folders allowed!", NFOLDERS); + adios (NULL, "only %d folders allowed!", + NFOLDERS); folders[foldp++].f_name = pluspath (cp); } else @@ -168,8 +173,8 @@ main (int argc, char **argv) #endif /* WHATNOW */ /* - * We are refiling a file to the folders - */ + ** We are refiling a file to the folders + */ if (filep > 0) { if (folder || msgs.size) adios (NULL, "use -file or some messages, not both"); @@ -210,11 +215,11 @@ main (int argc, char **argv) opnfolds (folders, foldp); /* Link all the selected messages into destination folders. - * - * This causes the add hook to be run for messages that are - * linked into another folder. The refile hook is run for - * messages that are moved to another folder. - */ + ** + ** This causes the add hook to be run for messages that are + ** linked into another folder. The refile hook is run for + ** messages that are moved to another folder. + */ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { if (is_selected (mp, msgnum)) { cp = getcpy (m_name (msgnum)); @@ -225,22 +230,23 @@ main (int argc, char **argv) } /* - * This is a hack. If we are using an external rmmproc, - * then save the current folder to the context file, - * so the external rmmproc will remove files from the correct - * directory. This should be moved to folder_delmsgs(). - */ + ** This is a hack. If we are using an external rmmproc, + ** then save the current folder to the context file, + ** so the external rmmproc will remove files from the correct + ** directory. This should be moved to folder_delmsgs(). + */ if (rmmproc) { context_replace (pfolder, folder); context_save (); fflush (stdout); } - /* If -nolink, then "remove" messages from source folder. - * - * Note that folder_delmsgs does not call the delete hook - * because the message has already been handled above. - */ + /* + ** If -nolink, then "remove" messages from source folder. + ** + ** Note that folder_delmsgs does not call the delete hook + ** because the message has already been handled above. + */ if (!linkf) { folder_delmsgs (mp, unlink_msgs, 1); } @@ -261,9 +267,9 @@ main (int argc, char **argv) /* - * Read all the destination folders and - * create folder structures for all of them. - */ +** Read all the destination folders and +** create folder structures for all of them. +*/ static void opnfolds (struct st_fold *folders, int nfolders) @@ -292,9 +298,9 @@ opnfolds (struct st_fold *folders, int nfolders) /* - * Set the Previous-Sequence and then sychronize the - * sequence file, for each destination folder. - */ +** Set the Previous-Sequence and then sychronize the +** sequence file, for each destination folder. +*/ static void clsfolds (struct st_fold *folders, int nfolders) @@ -311,10 +317,10 @@ clsfolds (struct st_fold *folders, int nfolders) /* - * If you have a "rmmproc" defined, we called that - * to remove all the specified files. If "rmmproc" - * is not defined, then just unlink the files. - */ +** If you have a "rmmproc" defined, we called that +** to remove all the specified files. If "rmmproc" +** is not defined, then just unlink the files. +*/ static void remove_files (int filep, char **files) @@ -343,18 +349,21 @@ remove_files (int filep, char **files) /* - * Link (or copy) the message into each of - * the destination folders. - */ +** Link (or copy) the message into each of +** the destination folders. +*/ static int -m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve, int refile) +m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve, + int refile) { int msgnum; struct st_fold *fp, *ep; for (fp = folders, ep = folders + nfolders; fp < ep; fp++) { - if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile, maildir)) == -1) + if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, + preserve, nfolders == 1 && refile, maildir)) + == -1) return 1; } return 0;