X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fm_convert.c;h=b535fe3a9b20b4e26d13fb02803bea83d3b2f69a;hb=99e89d0fcc69e509924b0a14a56e10d15721ccb0;hp=98c47337276fc56924524419d0b27490d3fea104;hpb=452df42b9645e99101184f28518652646ad75ba7;p=mmh diff --git a/sbr/m_convert.c b/sbr/m_convert.c index 98c4733..b535fe3 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -250,10 +250,12 @@ m_conv(struct msgs *mp, char *str, int call) { register int i; register unsigned char *cp, *bp; - unsigned char buf[16]; + unsigned char buf[16]; /* for reserved sequence name */ convdir = 1; cp = bp = str; + + /* Handle an integer */ if (isdigit(*cp)) { while (isdigit(*bp)) bp++; @@ -270,51 +272,47 @@ m_conv(struct msgs *mp, char *str, int call) return BADNUM; } -#ifdef LOCALE - /* doesn't enforce lower case */ - for (bp = buf; isalpha(*cp) && (bp - buf < sizeof(buf) - 1); ) -#else - for (bp = buf; islower(*cp) && (bp - buf < sizeof(buf) - 1); ) -#endif /* LOCALE */ - { + for (bp = buf; isalpha(*cp) && (bp - buf < sizeof(buf) - 1); ) { *bp++ = *cp++; } *bp++ = '\0'; delimp = cp; - if (!strcmp(buf, seq_first)) + /* Which one of the reserved names is it? */ + if (strcmp(buf, seq_first)==0) { return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ? mp->lowmsg : BADMSG); - if (!strcmp(buf, seq_last)) { + } else if (strcmp(buf, seq_last)==0) { convdir = -1; return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ? mp->hghmsg : BADMSG); - } - if (!strcmp(buf, seq_cur)) + } else if (strcmp(buf, seq_cur)==0) { return (mp->curmsg > 0 ? mp->curmsg : BADMSG); - if (!strcmp(buf, seq_prev)) { + } else if (strcmp(buf, seq_prev)==0) { convdir = -1; - for (i = (mp->curmsg <= mp->hghmsg) ? mp->curmsg - 1 : mp->hghmsg; - i >= mp->lowmsg; i--) { + for (i = (mp->curmsg <= mp->hghmsg) ? + mp->curmsg - 1 : mp->hghmsg; + i >= mp->lowmsg; i--) { if (does_exist(mp, i)) return i; } return BADMSG; - } - if (!strcmp(buf, seq_next)) { - for (i = (mp->curmsg >= mp->lowmsg) ? mp->curmsg + 1 : mp->lowmsg; - i <= mp->hghmsg; i++) { + } else if (strcmp(buf, seq_next)==0) { + for (i = (mp->curmsg >= mp->lowmsg) ? + mp->curmsg + 1 : mp->lowmsg; + i <= mp->hghmsg; i++) { if (does_exist(mp, i)) return i; } return BADMSG; - } - return BADLST; + } else { + return BADLST; + } } /*