CVS commit by ossi: split box list preparation from "consumption".
M +22 -16 main.c 1.59 --- isync/src/main.c #1.58:1.59 @@ -195,5 +195,5 @@ main( int argc, char **argv ) store_t *ctx[2]; string_list_t *boxes[2], *mbox, *sbox, **mboxp, **sboxp, *cboxes, *chanptr; - char *config = 0, *channame, *boxlist, *opt, *ochar; + char *config = 0, *channame, *boxlist, *boxp, *opt, *ochar; const char *names[2]; int all = 0, list = 0, cops = 0, ops[2] = { 0, 0 }; @@ -496,19 +496,7 @@ main( int argc, char **argv ) } } - if (list && multiple) - printf( "%s:\n", chan->name ); - if (boxlist) { - for (boxlist = strtok( boxlist, ",\n" ); boxlist; boxlist = strtok( 0, ",\n" )) - if (list) - puts( boxlist ); - else { - names[M] = names[S] = boxlist; - switch (sync_boxes( ctx, names, chan )) { - case SYNC_BAD(M): t = M; goto screwt; - case SYNC_BAD(S): t = S; goto screwt; - case SYNC_FAIL: ret = 1; - } - } - } else if (chan->patterns) { + if (boxlist) + boxp = boxlist; + else if (chan->patterns) { for (t = 0; t < 2; t++) { if (!ctx[t]->listed) { @@ -537,4 +525,22 @@ main( int argc, char **argv ) gotdupe: ; } + } + + if (list && multiple) + printf( "%s:\n", chan->name ); + if (boxlist) { + while ((names[S] = strsep( &boxp, ",\n" ))) { + if (list) + puts( names[S] ); + else { + names[M] = names[S]; + switch (sync_boxes( ctx, names, chan )) { + case SYNC_BAD(M): t = M; goto screwt; + case SYNC_BAD(S): t = S; goto screwt; + case SYNC_FAIL: ret = 1; + } + } + } + } else if (chan->patterns) { for (mbox = cboxes; mbox; mbox = mbox->next) if (list) ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel