NeoMutt  2023-05-17-16-g61469c
Teaching an old dog new tricks
DOXYGEN
extract.h
Go to the documentation of this file.
1
23#ifndef MUTT_PARSE_EXTRACT_H
24#define MUTT_PARSE_EXTRACT_H
25
26#include <stdint.h>
27
28struct Buffer;
29
30#define MoreArgs(buf) (*(buf)->dptr && (*(buf)->dptr != ';') && (*(buf)->dptr != '#'))
31
32/* The same conditions as in mutt_extract_token() */
33#define MoreArgsF(buf, flags) (*(buf)->dptr && \
34 (!isspace(*(buf)->dptr) || ((flags) & TOKEN_SPACE)) && \
35 ((*(buf)->dptr != '#') || ((flags) & TOKEN_COMMENT)) && \
36 ((*(buf)->dptr != '+') || !((flags) & TOKEN_PLUS)) && \
37 ((*(buf)->dptr != '-') || !((flags) & TOKEN_MINUS)) && \
38 ((*(buf)->dptr != '=') || !((flags) & TOKEN_EQUAL)) && \
39 ((*(buf)->dptr != '?') || !((flags) & TOKEN_QUESTION)) && \
40 ((*(buf)->dptr != ';') || ((flags) & TOKEN_SEMICOLON)) && \
41 (!((flags) & TOKEN_PATTERN) || strchr("~%=!|", *(buf)->dptr)))
42
43typedef uint16_t TokenFlags;
44#define TOKEN_NO_FLAGS 0
45#define TOKEN_EQUAL (1 << 0)
46#define TOKEN_CONDENSE (1 << 1)
47#define TOKEN_SPACE (1 << 2)
48#define TOKEN_QUOTE (1 << 3)
49#define TOKEN_PATTERN (1 << 4)
50#define TOKEN_COMMENT (1 << 5)
51#define TOKEN_SEMICOLON (1 << 6)
52#define TOKEN_BACKTICK_VARS (1 << 7)
53#define TOKEN_NOSHELL (1 << 8)
54#define TOKEN_QUESTION (1 << 9)
55#define TOKEN_PLUS (1 << 10)
56#define TOKEN_MINUS (1 << 11)
57
58int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags);
59
60#endif /* MUTT_PARSE_EXTRACT_H */
int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: extract.c:47
uint16_t TokenFlags
Flags for parse_extract_token(), e.g. TOKEN_EQUAL.
Definition: extract.h:43
String manipulation buffer.
Definition: buffer.h:34