/*
- * 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
- * complete copyright information.
- */
+** 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
+** complete copyright information.
+*/
#include <h/mh.h>
/*
- * error codes for sequence
- * and message range processing
- */
+** error codes for sequence
+** and message range processing
+*/
#define BADMSG (-2)
#define BADRNG (-3)
#define BADNEW (-4)
static char *delimp;
/*
- * static prototypes
- */
+** static prototypes
+*/
static int m_conv (struct msgs *, char *, int);
static int attr (struct msgs *, char *);
else if (err > 0)
return 1;
/*
- * else err == 0, so continue
- */
+ ** else err == 0, so continue
+ */
found = 0;
/*
- * Check for special "new" sequence, which
- * is valid only if ALLOW_NEW is set.
- */
+ ** Check for special "new" sequence, which
+ ** is valid only if ALLOW_NEW is set.
+ */
if ((mp->msgflags & ALLOW_NEW) && !strcmp (cp, "new")) {
if ((err = first = getnew (mp)) <= 0)
goto badmsg;
cp = delimp;
if (*cp != '\0' && *cp != '-' && *cp != ':') {
badelim:
- advise (NULL, "illegal argument delimiter: `%c'(0%o)", *delimp, *delimp);
+ advise (NULL, "illegal argument delimiter: `%c'(0%o)",
+ *delimp, *delimp);
return 0;
}
break;
case BADRNG:
- advise (NULL, "message %s out of range 1-%d", cp, mp->hghmsg);
+ advise (NULL, "message %s out of range 1-%d",
+ cp, mp->hghmsg);
break;
case BADLST:
break;
case BADNEW:
- advise (NULL, "folder full, no %s message", name);
+ advise (NULL, "folder full, no %s message",
+ name);
break;
default:
single:
/*
- * Single Message
- *
- * If ALLOW_NEW is set, then allow selecting of an
- * empty slot. If ALLOW_NEW is not set, then we
- * check if message is in-range and exists.
- */
+ ** Single Message
+ **
+ ** If ALLOW_NEW is set, then allow selecting of an
+ ** empty slot. If ALLOW_NEW is not set, then we
+ ** check if message is in-range and exists.
+ */
if (mp->msgflags & ALLOW_NEW) {
set_select_empty (mp, first);
} else {
}
/*
- * Cycle through the range and select the messages
- * that exist. If ALLOW_NEW is set, then we also check
- * if we are selecting an empty slot.
- */
+ ** Cycle through the range and select the messages
+ ** that exist. If ALLOW_NEW is set, then we also check
+ ** if we are selecting an empty slot.
+ */
for (; first <= last; first++) {
if (does_exist (mp, first) ||
((mp->msgflags & ALLOW_NEW) && is_select_empty (mp, first))) {
}
/*
- * Convert the various message names to
- * their numeric values.
- *
- * n (integer)
- * prev
- * next
- * first
- * last
- * cur
- * . (same as cur)
- */
+** Convert the various message names to
+** their numeric values.
+**
+** n (integer)
+** prev
+** next
+** first
+** last
+** cur
+** . (same as cur)
+*/
static int
m_conv (struct msgs *mp, char *str, int call)
}
/*
- * Handle user defined sequences.
- * They can take the following forms:
- *
- * seq
- * seq:prev
- * seq:next
- * seq:first
- * seq:last
- * seq:+n
- * seq:-n
- * seq:n
- */
+** Handle user defined sequences.
+** They can take the following forms:
+**
+** seq
+** seq:prev
+** seq:next
+** seq:first
+** seq:last
+** seq:+n
+** seq:-n
+** seq:n
+*/
static int
attr (struct msgs *mp, char *cp)
range = 1;
/*
- * seq:prev (or)
- * seq:next (or)
- * seq:first (or)
- * seq:last
- */
+ ** seq:prev (or)
+ ** seq:next (or)
+ ** seq:first (or)
+ ** seq:last
+ */
if (isalpha (*dp)) {
if (!strcmp (dp, "prev")) {
convdir = -1;
return BADLST;
} else {
/*
- * seq:n (or)
- * seq:+n (or)
- * seq:-n
- */
+ ** seq:n (or)
+ ** seq:+n (or)
+ ** seq:-n
+ */
if (*dp == '+')
dp++;
else if (*dp == '-') {
found++;
/*
- * If we have a range, then break out
- * once we've found enough.
- */
+ ** If we have a range, then break out
+ ** once we've found enough.
+ */
if (range && found >= range)
break;
}