64 size_t ds = err->
dsize;
66 if (regerror(regerr, preg, err->
data, ds) > ds)
85 const char *context_req_chars[] = {
96 char *context_loc = strpbrk(s->
dptr + pmatch[0].rm_so, context_req_chars[kind]);
97 if (!context_loc || (context_loc >= &s->
dptr[pmatch[0].rm_eo]))
121 int num = (int) strtol(&s->
dptr[pmatch[group].rm_so], NULL, 0);
122 unsigned char c = (
unsigned char) (s->
dptr[pmatch[group].rm_eo - 1]);
123 if (toupper(c) ==
'K')
125 else if (toupper(c) ==
'M')
164 if ((pmatch[grp].rm_so == -1) || (pmatch[grp].rm_so == pmatch[grp].rm_eo))
172 unsigned char c = (
unsigned char) (s->
dptr[pmatch[grp].rm_so]);
227 regerr = regcomp(&pspec->
cooked, pspec->
raw, REG_EXTENDED);
269 s->
dptr += pmatch[0].rm_eo;
292 bool skip_quote =
false;
314 if (skip_quote && (*s->
dptr ==
'"'))
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Convenience wrapper for the core headers.
bool eat_message_range(struct Pattern *pat, PatternCompFlags flags, struct Buffer *s, struct Buffer *err, struct MailboxView *mv)
Parse a range of message numbers - Implements eat_arg_t -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
Convenience wrapper for the library headers.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
uint8_t PatternCompFlags
Flags for mutt_pattern_comp(), e.g. MUTT_PC_FULL_MSG.
static int eat_range_by_regex(struct Pattern *pat, struct Buffer *s, int kind, struct Buffer *err, struct MailboxView *mv)
Parse a range given as a regex.
static int scan_range_slot(struct Buffer *s, regmatch_t pmatch[], int grp, int side, int kind, struct MailboxView *mv)
Parse a range of message numbers.
EatRangeError
Error codes for eat_range_by_regex()
@ RANGE_E_MVIEW
Range requires MailboxView, but none available.
@ RANGE_E_OK
Range is valid.
@ RANGE_E_SYNTAX
Range contains syntax error.
static int scan_range_num(struct Buffer *s, regmatch_t pmatch[], int group, int kind, struct MailboxView *mv)
Parse a number range.
static void order_range(struct Pattern *pat)
Put a range in order.
static int report_regerror(int regerr, regex_t *preg, struct Buffer *err)
Create a regex error message.
static bool is_menu_available(struct Buffer *s, regmatch_t pmatch[], int kind, struct Buffer *err, const struct Menu *menu)
Do we need a MailboxView for this Pattern?
@ RANGE_S_LEFT
Left side of range.
@ RANGE_S_RIGHT
Right side of range.
static int email_msgno(struct Email *e)
Helper to get the Email's message number.
@ RANGE_K_REL
Relative range.
@ RANGE_K_ABS
Absolute range.
@ RANGE_K_LT
Less-than range.
@ RANGE_K_INVALID
Range is invalid.
@ RANGE_K_BARE
Single symbol.
@ RANGE_K_GT
Greater-than range.
struct RangeRegex RangeRegexes[]
Set of Regexes for various range types.
String manipulation buffer.
char * dptr
Current read/write position.
size_t dsize
Length of data.
char * data
Pointer to data.
The envelope/body of an email.
struct Menu * menu
Needed for pattern compilation.
struct Mailbox * mailbox
Current Mailbox.
int msg_count
Total number of messages.
A simple (non-regex) pattern.
long min
Minimum for range checks.
long max
Maximum for range checks.
Regular expression representing a range.
int lgrp
Paren group matching the left side.
int rgrp
Paren group matching the right side.
regex_t cooked
Compiled form.
const char * raw
Regex as string.