X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fm_convert.c;h=d187a341e1613b68f123fb73be3789d78dd416ff;hp=df128d7dd9e9e1c80064e6adb8e6348c5e055ba7;hb=18591f8e001ecedbee48a51c1d1f08ebaa1c15c8;hpb=b0b1dd37ff515578cf7cba51625189eb34a196cb diff --git a/sbr/m_convert.c b/sbr/m_convert.c index df128d7..d187a34 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -10,6 +10,7 @@ /* FIXME: This code needs rework! Rewrite as a parser? */ #include +#include /* ** error codes for sequence @@ -35,23 +36,6 @@ static char *delimp; /* delimiter pointer */ static int m_conv(struct msgs *, char *, int); static int attr(struct msgs *, char *); - -static void -addtosel(struct msgs *mp, int msg) -{ - if (is_selected(mp, msg)) { - return; /* dont select twice */ - } - set_selected(mp, msg); - mp->numsel++; - if (mp->lowsel == 0 || msg < mp->lowsel) { - mp->lowsel = msg; - } - if (msg > mp->hghsel) { - mp->hghsel = msg; - } -} - int m_convert(struct msgs *mp, char *name) { @@ -79,15 +63,15 @@ m_convert(struct msgs *mp, char *name) ** ALLOW_BEYOND is set, and can appear only on its own. ** Also, it is available in any folder. */ - if ((mp->msgflags & ALLOW_BEYOND) && !strcmp(cp, seq_beyond)) { - addtosel(mp, getbeyond(mp)); + if ((mp->msgflags & ALLOW_BEYOND) && strcmp(cp, seq_beyond)==0) { + set_selected(mp, getbeyond(mp)); return 1; } /* ** Handle the special all sequence: replace `a' with `f-l' */ - if (!strcmp(cp, seq_all)) { + if (strcmp(cp, seq_all)==0) { cp = concat(seq_first, "-", seq_last, NULL); } @@ -203,7 +187,7 @@ rangerr: */ if (first > mp->hghmsg || first < mp->lowmsg || !does_exist(mp, first)) { - if (!strcmp(name, seq_cur)) + if (strcmp(name, seq_cur)==0) advise(NULL, "no current message"); else /* this case seems to never be reached */ @@ -225,7 +209,7 @@ badelim: /* Cycle through the range and select the messages that exist. */ for (found=0; first <= last; first++) { if (does_exist(mp, first)) { - addtosel(mp, first); + set_selected(mp, first); found++; } } @@ -248,8 +232,8 @@ badelim: static int m_conv(struct msgs *mp, char *str, int call) { - register int i; - register unsigned char *cp, *bp; + int i; + unsigned char *cp, *bp; unsigned char buf[16]; /* for reserved sequence name */ convdir = 1; @@ -272,7 +256,7 @@ m_conv(struct msgs *mp, char *str, int call) return BADNUM; } - for (bp = buf; isalpha(*cp) && (bp - buf < sizeof(buf) - 1); ) { + for (bp = buf; isalpha(*cp) && (bp - buf < (int)sizeof(buf) - 1); ) { *bp++ = *cp++; } *bp++ = '\0'; @@ -333,16 +317,16 @@ m_conv(struct msgs *mp, char *str, int call) static int attr(struct msgs *mp, char *cp) { - register unsigned char *dp; + unsigned char *dp; char *bp = NULL; - register int i, j; + int i, j; int found; int inverted = 0; int range = 0; /* no range */ int first = 0; /* hack for "c-..." */ - if (!strcmp(cp, seq_cur)) + if (strcmp(cp, seq_cur)==0) return 0; /* "c:..." -- this code need to be rewritten... */ if (strncmp(seq_cur, cp, strlen(seq_cur))==0 && @@ -375,17 +359,17 @@ attr(struct msgs *mp, char *cp) ** seq:l */ if (isalpha(*dp)) { - if (!strcmp(dp, seq_prev)) { + if (strcmp(dp, seq_prev)==0) { convdir = -1; first = (mp->curmsg > 0) && (mp->curmsg <= mp->hghmsg) ? mp->curmsg - 1 : mp->hghmsg; - } else if (!strcmp(dp, seq_next)) { + } else if (strcmp(dp, seq_next)==0) { convdir = 1; first = (mp->curmsg >= mp->lowmsg) ? mp->curmsg + 1 : mp->lowmsg; - } else if (!strcmp(dp, seq_first)) { + } else if (strcmp(dp, seq_first)==0) { convdir = 1; - } else if (!strcmp(dp, seq_last)) { + } else if (strcmp(dp, seq_last)==0) { convdir = -1; } else return BADLST; @@ -426,7 +410,7 @@ attr(struct msgs *mp, char *cp) if (does_exist(mp, j) && inverted ? !in_sequence(mp, i, j) : in_sequence(mp, i, j)) { - addtosel(mp, j); + set_selected(mp, j); found++; /*