Parse a line of user config.
47{
50 if (!pc || !pe)
52
57
59
60
62
65 {
66 if (*line->
dptr ==
'#')
67 break;
68 if (*line->
dptr ==
';')
69 {
71 continue;
72 }
74
75 const int token_len =
buf_len(token);
76 if ((token_len > 0) && (
buf_at(token, token_len - 1) ==
'?'))
77 {
78 token->
data[token_len - 1] =
'\0';
80 }
81
83 if (cmd)
84 {
86 {
90 goto finish;
91 }
92
94 rc = cmd->
parse(cmd, line, pc, pe);
96 goto finish;
97
99 }
100 else
101 {
104 }
105 }
106
107finish:
109 return rc;
110}
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.
const struct Command * command_find_by_name(const struct CommandArray *ca, const char *name)
Find a NeoMutt Command by its name.
#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.
@ 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.
const char * proto
Command prototype.
const char * help
One-line description of the Command.
enum CommandResult(* parse)(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
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.
struct Buffer * message
Error message.