On Sat, Sep 18, 2010 at 5:11 PM, Jordi Mallach <[email protected]> wrote:
> On Sat, Sep 18, 2010 at 04:01:54PM +0530, BVK Chaitanya wrote:
>> Attached patch adds new --count option to limit number of mails
>> downloaded/moved by movemail in one session.
>
> You forgot the attachment! :)
>
Ahhh, it is attached now :)
thanks,
bvk.chaitanya
--- mailutils-2.2-orig/movemail/movemail.c 2010-05-20 18:38:19.000000000 +0530
+++ mailutils-2.2/movemail/movemail.c 2010-09-18 15:45:18.000000000 +0530
@@ -33,6 +33,8 @@
#include "mailutils/libargp.h"
#include <muaux.h>
+#define min(a,b) ((a) < (b) ? (a) : (b))
+
const char *program_version = "movemail (" PACKAGE_STRING ")";
static char doc[] = N_("GNU movemail -- move messages across mailboxes.");
static char args_doc[] = N_("inbox-url destfile [POP-password]");
@@ -51,6 +53,8 @@
N_("output information used by Emacs rmail interface") },
{ "uidl", 'u', NULL, 0,
N_("use UIDLs to avoid downloading the same message twice") },
+ { "count", 'c', N_("COUNT"), 0,
+ N_("download only COUNT number of mails") },
{ "verbose", 'v', NULL, 0,
N_("increase verbosity level") },
{ "owner", 'P', N_("MODELIST"), 0,
@@ -69,6 +73,7 @@
static int verbose_option;
static int ignore_errors;
static char *program_id_option;
+static unsigned count_mails = UINT_MAX;
enum set_ownership_mode
{
@@ -141,6 +146,10 @@
mu_argp_node_list_new (lst, "uidl", "yes");
break;
+ case 'c':
+ mu_argp_node_list_new (lst, "count", arg);
+ break;
+
case 'v':
verbose_option++;
break;
@@ -314,6 +323,8 @@
N_("Output information used by Emacs rmail interface.") },
{ "uidl", mu_cfg_bool, &uidl_option, 0, NULL,
N_("Use UIDLs to avoid downloading the same message twice.") },
+ { "count", mu_cfg_int, &count_mails, 0, NULL,
+ N_("download only COUNT number of mails") },
{ "verbose", mu_cfg_int, &verbose_option, 0, NULL,
N_("Set verbosity level.") },
{ "ignore-errors", mu_cfg_bool, &ignore_errors, 0, NULL,
@@ -854,7 +865,7 @@
}
else if (reverse_order)
{
- for (i = total; i > 0; i--)
+ for (i = min (total, count_mails); i > 0; i--)
{
rc = move_message (source, dest, i);
if (rc == 0)
@@ -867,7 +878,7 @@
}
else
{
- for (i = 1; i <= total; i++)
+ for (i = 1; i <= min (total, count_mails); i++)
{
rc = move_message (source, dest, i);
if (rc == 0)
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils