NeoMutt  2019-12-07
Teaching an old dog new tricks
DOXYGEN
mutt_commands.h File Reference

Mapping from user command name to function. More...

#include <stdint.h>
+ Include dependency graph for mutt_commands.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Command
 A user-callable command. More...
 

Typedefs

typedef enum CommandResult(* command_t) (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)
 typedef command_t - Prototype for a function to parse a command More...
 

Enumerations

enum  CommandResult { MUTT_CMD_ERROR = -1, MUTT_CMD_WARNING = -2, MUTT_CMD_SUCCESS = 0, MUTT_CMD_FINISH = 1 }
 Error codes for command_t parse functions. More...
 

Functions

const struct Commandmutt_command_get (const char *s)
 Get a Command by its name. More...
 
void mutt_commands_apply (void *data, void(*application)(void *, const struct Command *))
 

Detailed Description

Mapping from user command name to function.

Authors
  • Bernard Pratz

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file mutt_commands.h.

Typedef Documentation

◆ command_t

typedef enum CommandResult(* command_t) (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)

typedef command_t - Prototype for a function to parse a command

Parameters
bufTemporary Buffer space
sBuffer containing string to be parsed
dataFlags associated with the command
errBuffer for error messages
Return values
CommandResultResult e.g. MUTT_CMD_SUCCESS

Definition at line 49 of file mutt_commands.h.

Enumeration Type Documentation

◆ CommandResult

Error codes for command_t parse functions.

Enumerator
MUTT_CMD_ERROR 

Error: Can't help the user.

MUTT_CMD_WARNING 

Warning: Help given to the user.

MUTT_CMD_SUCCESS 

Success: Command worked.

MUTT_CMD_FINISH 

Finish: Stop processing this file.

Definition at line 33 of file mutt_commands.h.

34 {
35  MUTT_CMD_ERROR = -1,
36  MUTT_CMD_WARNING = -2,
37  MUTT_CMD_SUCCESS = 0,
38  MUTT_CMD_FINISH = 1
39 };
Error: Can&#39;t help the user.
Definition: mutt_commands.h:35
Success: Command worked.
Definition: mutt_commands.h:37
Warning: Help given to the user.
Definition: mutt_commands.h:36
Finish: Stop processing this file.
Definition: mutt_commands.h:38

Function Documentation

◆ mutt_command_get()

const struct Command* mutt_command_get ( const char *  s)

Get a Command by its name.

Parameters
sCommand string to lookup
Return values
ptrSuccess, Command
NULLError, no such command

Definition at line 2643 of file init.c.

2644 {
2645  for (int i = 0; Commands[i].name; i++)
2646  if (mutt_str_strcmp(s, Commands[i].name) == 0)
2647  return &Commands[i];
2648  return NULL;
2649 }
const char * name
Name of the command.
Definition: mutt_commands.h:56
const struct Command Commands[]
Definition: init.h:5002
const char * name
Definition: pgpmicalg.c:46
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:615
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_commands_apply()

void mutt_commands_apply ( void *  data,
void(*)(void *, const struct Command *)  application 
)
+ Here is the caller graph for this function: