NeoMutt  2025-12-11-980-ge38c27
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
extract.h
Go to the documentation of this file.
1
24
25#ifndef MUTT_PARSE_EXTRACT_H
26#define MUTT_PARSE_EXTRACT_H
27
28#include <stdint.h>
29#include <string.h>
30#include "mutt/lib.h" // IWYU pragma: keep
31
32#define MoreArgs(buf) (*(buf)->dptr && (*(buf)->dptr != ';') && (*(buf)->dptr != '#'))
33
34/* The same conditions as in mutt_extract_token() */
35#define MoreArgsF(buf, flags) (*(buf)->dptr && \
36 (!mutt_isspace(*(buf)->dptr) || ((flags) & TOKEN_SPACE)) && \
37 ((*(buf)->dptr != '#') || ((flags) & TOKEN_COMMENT)) && \
38 ((*(buf)->dptr != '+') || !((flags) & TOKEN_PLUS)) && \
39 ((*(buf)->dptr != '-') || !((flags) & TOKEN_MINUS)) && \
40 ((*(buf)->dptr != '=') || !((flags) & TOKEN_EQUAL)) && \
41 ((*(buf)->dptr != '?') || !((flags) & TOKEN_QUESTION)) && \
42 ((*(buf)->dptr != ';') || ((flags) & TOKEN_SEMICOLON)) && \
43 (!((flags) & TOKEN_PATTERN) || strchr("~%=!|", *(buf)->dptr)))
44
49{
51 TOKEN_EQUAL = 1U << 0,
52 TOKEN_CONDENSE = 1U << 1,
53 TOKEN_SPACE = 1U << 2,
54 TOKEN_QUOTE = 1U << 3,
55 TOKEN_PATTERN = 1U << 4,
56 TOKEN_COMMENT = 1U << 5,
57 TOKEN_SEMICOLON = 1U << 6,
58 TOKEN_NOSHELL = 1U << 7,
59 TOKEN_QUESTION = 1U << 8,
60 TOKEN_PLUS = 1U << 9,
61 TOKEN_MINUS = 1U << 10,
62};
63typedef uint16_t TokenFlags;
64
65int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags);
66
67#endif /* MUTT_PARSE_EXTRACT_H */
uint16_t TokenFlags
Definition extract.h:63
TokenFlag
Flags for parse_extract_token(), e.g.
Definition extract.h:49
@ TOKEN_COMMENT
Don't reap comments.
Definition extract.h:56
@ TOKEN_MINUS
Treat '-' as a special.
Definition extract.h:61
@ TOKEN_SPACE
Don't treat whitespace as a term.
Definition extract.h:53
@ TOKEN_EQUAL
Treat '=' as a special.
Definition extract.h:51
@ TOKEN_QUOTE
Don't interpret quotes.
Definition extract.h:54
@ TOKEN_PATTERN
~%=!| are terms (for patterns)
Definition extract.h:55
@ TOKEN_CONDENSE
^(char) to control chars (macros)
Definition extract.h:52
@ TOKEN_PLUS
Treat '+' as a special.
Definition extract.h:60
@ TOKEN_NOSHELL
Don't expand environment variables.
Definition extract.h:58
@ TOKEN_SEMICOLON
Don't treat ; as special.
Definition extract.h:57
@ TOKEN_NONE
No flags are set.
Definition extract.h:50
@ TOKEN_QUESTION
Treat '?' as a special.
Definition extract.h:59
int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags)
Extract one token from a string.
Definition extract.c:49
Convenience wrapper for the library headers.
String manipulation buffer.
Definition buffer.h:36