X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmark.c;h=bdd02ade9fe1ec188a915585ba7dd6090d54ad0a;hp=9cca0ad55874b33e548797a20a3986652d11586e;hb=714b5c530ece27ea2835a313013f5b770163403c;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4 diff --git a/uip/mark.c b/uip/mark.c index 9cca0ad..bdd02ad 100644 --- a/uip/mark.c +++ b/uip/mark.c @@ -40,12 +40,12 @@ static struct swit switches[] = { /* ** static prototypes */ -static void print_debug (struct msgs *); -static void seq_printdebug (struct msgs *); +static void print_debug(struct msgs *); +static void seq_printdebug(struct msgs *); int -main (int argc, char **argv) +main(int argc, char **argv) { int addsw = 0, deletesw = 0, debugsw = 0; int listsw = 0, publicsw = -1, zerosw = 0; @@ -59,12 +59,12 @@ main (int argc, char **argv) #ifdef LOCALE setlocale(LC_ALL, ""); #endif - invo_name = r1bindex (argv[0], '/'); + invo_name = r1bindex(argv[0], '/'); /* read user profile/context */ context_read(); - arguments = getarguments (invo_name, argc, argv, 1); + arguments = getarguments(invo_name, argc, argv, 1); argp = arguments; /* @@ -72,22 +72,20 @@ main (int argc, char **argv) */ while ((cp = *argp++)) { if (*cp == '-') { - switch (smatch (++cp, switches)) { + switch (smatch(++cp, switches)) { case AMBIGSW: - ambigsw (cp, switches); - done (1); + ambigsw(cp, switches); + done(1); case UNKWNSW: - adios (NULL, "-%s unknown\n", cp); + adios(NULL, "-%s unknown\n", cp); case HELPSW: - snprintf (buf, sizeof(buf), - "%s [+folder] [msgs] [switches]", - invo_name); - print_help (buf, switches, 1); - done (1); + snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name); + print_help(buf, switches, 1); + done(1); case VERSIONSW: print_version(invo_name); - done (1); + done(1); case ADDSW: addsw++; @@ -104,11 +102,12 @@ main (int argc, char **argv) case SEQSW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + adios(NULL, "missing argument to %s", + argp[-2]); /* check if too many sequences specified */ if (seqp >= NUMATTRS) - adios (NULL, "too many sequences (more than %d) specified", NUMATTRS); + adios(NULL, "too many sequences (more than %d) specified", NUMATTRS); seqs[seqp++] = cp; continue; @@ -133,9 +132,9 @@ main (int argc, char **argv) } if (*cp == '+' || *cp == '@') { if (folder) - adios (NULL, "only one folder at a time!"); + adios(NULL, "only one folder at a time!"); else - folder = pluspath (cp); + folder = pluspath(cp); } else app_msgarg(&msgs, cp); } @@ -152,20 +151,20 @@ main (int argc, char **argv) listsw++; } - if (!context_find ("path")) - free (path ("./", TFOLDER)); + if (!context_find("path")) + free(path("./", TFOLDER)); if (!msgs.size) app_msgarg(&msgs, listsw ? "all" :"cur"); if (!folder) - folder = getfolder (1); - maildir = m_maildir (folder); + folder = getfolder(1); + maildir = m_maildir(folder); - if (chdir (maildir) == NOTOK) - adios (maildir, "unable to change directory to"); + if (chdir(maildir) == NOTOK) + adios(maildir, "unable to change directory to"); /* read folder and create message structure */ - if (!(mp = folder_read (folder))) - adios (NULL, "unable to read folder %s", folder); + if (!(mp = folder_read(folder))) + adios(NULL, "unable to read folder %s", folder); /* print some general debugging info */ if (debugsw) @@ -173,37 +172,38 @@ main (int argc, char **argv) /* check for empty folder */ if (mp->nummsg == 0) - adios (NULL, "no messages in %s", folder); + adios(NULL, "no messages in %s", folder); /* parse all the message ranges/sequences and set SELECTED */ for (msgnum = 0; msgnum < msgs.size; msgnum++) - if (!m_convert (mp, msgs.msgs[msgnum])) - done (1); + if (!m_convert(mp, msgs.msgs[msgnum])) + done(1); if (publicsw == 1 && is_readonly(mp)) - adios (NULL, "folder %s is read-only, so -public not allowed", folder); + adios(NULL, "folder %s is read-only, so -public not allowed", + folder); /* ** Make sure at least one sequence has been ** specified if we are adding or deleting. */ if (seqp == 0 && (addsw || deletesw)) - adios (NULL, "-%s requires at least one -sequence argument", - addsw ? "add" : "delete"); + adios(NULL, "-%s requires at least one -sequence argument", + addsw ? "add" : "delete"); seqs[seqp] = NULL; /* Adding messages to sequences */ if (addsw) { for (seqp = 0; seqs[seqp]; seqp++) - if (!seq_addsel (mp, seqs[seqp], publicsw, zerosw)) - done (1); + if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw)) + done(1); } /* Deleting messages from sequences */ if (deletesw) { for (seqp = 0; seqs[seqp]; seqp++) - if (!seq_delsel (mp, seqs[seqp], publicsw, zerosw)) - done (1); + if (!seq_delsel(mp, seqs[seqp], publicsw, zerosw)) + done(1); } /* Listing messages in sequences */ @@ -211,22 +211,22 @@ main (int argc, char **argv) if (seqp) { /* print the sequences given */ for (seqp = 0; seqs[seqp]; seqp++) - seq_print (mp, seqs[seqp]); + seq_print(mp, seqs[seqp]); } else { /* else print them all */ - seq_printall (mp); + seq_printall(mp); } /* print debugging info about SELECTED messages */ if (debugsw) - seq_printdebug (mp); + seq_printdebug(mp); } - seq_save (mp); /* synchronize message sequences */ - context_replace (pfolder, folder); /* update current folder */ - context_save (); /* save the context file */ - folder_free (mp); /* free folder/message structure */ - done (0); + seq_save(mp); /* synchronize message sequences */ + context_replace(pfolder, folder); /* update current folder */ + context_save(); /* save the context file */ + folder_free(mp); /* free folder/message structure */ + done(0); return 1; } @@ -235,24 +235,24 @@ main (int argc, char **argv) ** Print general debugging info */ static void -print_debug (struct msgs *mp) +print_debug(struct msgs *mp) { char buf[100]; - printf ("invo_name = %s\n", invo_name); - printf ("mypath = %s\n", mypath); - printf ("defpath = %s\n", defpath); - printf ("ctxpath = %s\n", ctxpath); - printf ("context flags = %s\n", snprintb (buf, sizeof(buf), - (unsigned) ctxflags, DBITS)); - printf ("foldpath = %s\n", mp->foldpath); - printf ("folder flags = %s\n\n", snprintb(buf, sizeof(buf), - (unsigned) mp->msgflags, FBITS)); - printf ("lowmsg=%d hghmsg=%d nummsg=%d curmsg=%d\n", - mp->lowmsg, mp->hghmsg, mp->nummsg, mp->curmsg); - printf ("lowsel=%d hghsel=%d numsel=%d\n", - mp->lowsel, mp->hghsel, mp->numsel); - printf ("lowoff=%d hghoff=%d\n\n", mp->lowoff, mp->hghoff); + printf("invo_name = %s\n", invo_name); + printf("mypath = %s\n", mypath); + printf("defpath = %s\n", defpath); + printf("ctxpath = %s\n", ctxpath); + printf("context flags = %s\n", snprintb(buf, sizeof(buf), + (unsigned) ctxflags, DBITS)); + printf("foldpath = %s\n", mp->foldpath); + printf("folder flags = %s\n\n", snprintb(buf, sizeof(buf), + (unsigned) mp->msgflags, FBITS)); + printf("lowmsg=%d hghmsg=%d nummsg=%d curmsg=%d\n", + mp->lowmsg, mp->hghmsg, mp->nummsg, mp->curmsg); + printf("lowsel=%d hghsel=%d numsel=%d\n", + mp->lowsel, mp->hghsel, mp->numsel); + printf("lowoff=%d hghoff=%d\n\n", mp->lowoff, mp->hghoff); } @@ -261,17 +261,14 @@ print_debug (struct msgs *mp) ** messages and the sequences they are in. */ static void -seq_printdebug (struct msgs *mp) +seq_printdebug(struct msgs *mp) { int msgnum; char buf[100]; - printf ("\n"); + printf("\n"); for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { - if (is_selected (mp, msgnum)) - printf ("%*d: %s\n", DMAXFOLDER, msgnum, - snprintb (buf, sizeof(buf), - (unsigned) mp->msgstats[msgnum - mp->lowoff], - seq_bits (mp))); + if (is_selected(mp, msgnum)) + printf("%*d: %s\n", DMAXFOLDER, msgnum, snprintb(buf, sizeof(buf), (unsigned) mp->msgstats[msgnum - mp->lowoff], seq_bits(mp))); } }