X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/07a2268d47ebe74a1079992b2e5888feb0ad110f..4a56a28ac439137ba2b71fcb5952b4e4abd1e2fc:/sbr/m_convert.c diff --git a/sbr/m_convert.c b/sbr/m_convert.c index 26abdf8c..566b02a5 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -1,6 +1,4 @@ - -/* - * m_convert.c -- parse a message range or sequence and set SELECTED +/* m_convert.c -- parse a message range or sequence and set SELECTED * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -8,6 +6,7 @@ */ #include +#include /* * error codes for sequence @@ -76,7 +75,7 @@ m_convert (struct msgs *mp, char *name) cp = delimp; if (*cp != '\0' && *cp != '-' && *cp != ':' && *cp != '=') { badelim: - advise (NULL, "illegal argument delimiter: `%c'(0%o)", *delimp, *delimp); + inform("illegal argument delimiter: `%c'(0%o)", *delimp, *delimp); return 0; } @@ -86,28 +85,28 @@ badelim: badmsg: switch (err) { case BADMSG: - advise (NULL, "no %s message", cp); + inform("no %s message", cp); break; case BADNUM: - advise (NULL, "message %s doesn't exist", cp); + inform("message %s doesn't exist", cp); break; case BADRNG: - advise (NULL, "message %s out of range 1-%d", cp, mp->hghmsg); + inform("message %s out of range 1-%d", cp, mp->hghmsg); break; case BADLST: badlist: - advise (NULL, "bad message list %s", name); + inform("bad message list %s", name); break; case BADNEW: - advise (NULL, "folder full, no %s message", name); + inform("folder full, no %s message", name); break; default: - advise (NULL, "no messages match specification"); + inform("no messages match specification"); } return 0; } @@ -118,7 +117,7 @@ badlist: goto badelim; if (first > mp->hghmsg || last < mp->lowmsg) { rangerr: - advise (NULL, "no messages in range %s", name); + inform("no messages in range %s", name); return 0; } @@ -178,7 +177,7 @@ rangerr: } } else { /* looking for the nth message. if not enough, fail. */ if (last < mp->lowmsg || last > mp->hghmsg) { - advise (NULL, "no such message"); + inform("no such message"); return 0; } first = last; @@ -203,8 +202,8 @@ single: * limits simply reallocate the folder so it's within range. */ if (first < mp->lowoff || first > mp->hghoff) - mp = folder_realloc(mp, first < mp->lowoff ? first : mp->lowoff, - first > mp->hghoff ? first : mp->hghoff); + mp = folder_realloc(mp, min(first, mp->lowoff), + max(first, mp->hghoff)); set_select_empty (mp, first); } else { @@ -212,9 +211,9 @@ single: || first < mp->lowmsg || !(does_exist (mp, first))) { if (!strcmp (name, "cur") || !strcmp (name, ".")) - advise (NULL, "no %s message", name); + inform("no %s message", name); else - advise (NULL, "message %d doesn't exist", first); + inform("message %d doesn't exist", first); return 0; } } @@ -359,7 +358,7 @@ attr (struct msgs *mp, char *cp) /* hack for "cur-name", "cur-n", etc. */ if (!strcmp (cp, "cur")) return 0; - if (strncmp ("cur", cp, 3) == 0) { + if (has_prefix(cp, "cur")) { if (cp[3] == ':' || cp[3] == '=') return 0; } @@ -504,6 +503,6 @@ attr (struct msgs *mp, char *cp) if (first || just_one) return BADMSG; - advise (NULL, "sequence %s %s", cp, inverted ? "full" : "empty"); + inform("sequence %s %s", cp, inverted ? "full" : "empty"); return -1; }