Parse a line of user config.
46{
49 if (!err)
51
55
57
58
60
63 {
64 if (*line->
dptr ==
'#')
65 break;
66 if (*line->
dptr ==
';')
67 {
69 continue;
70 }
72
73 const int token_len =
buf_len(token);
74 if ((token_len > 0) && (
buf_at(token, token_len - 1) ==
'?'))
75 {
76 token->
data[token_len - 1] =
'\0';
78 }
79
80 bool match = false;
81 const struct Command **cp = NULL;
83 {
84 const struct Command *cmd = *cp;
85
87 {
89 {
93 goto finish;
94 }
95
97 rc = cmd->
parse(cmd, line, err);
99 goto finish;
100
102 match = true;
103 break;
104 }
105 }
106
107 if (!match)
108 {
111 break;
112 }
113 }
114
115finish:
117 return rc;
118}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
void buf_seek(struct Buffer *buf, size_t offset)
Set current read/write position to offset from beginning.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
static bool show_help(struct CliHelp *help)
Show the Help.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
@ NT_COMMAND
A Command has been executed, Command.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
char * dptr
Current read/write position.
char * data
Pointer to data.
enum CommandResult(* parse)(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
const char * proto
Command prototype.
const char * help
One-line description of the Command.
const char * path
Help path, relative to the NeoMutt Docs.
const char * name
Name of the command.
Container for Accounts, Notifications.
struct CommandArray commands
NeoMutt commands.
struct Notify * notify
Notifications handler.