#ifndef MUTT_MUTT_COMMANDS_H
#define MUTT_MUTT_COMMANDS_H
+#include <stdint.h>
+
struct Buffer;
+/**
+ * enum CommandResult - Error codes for command_t parse functions
+ */
+enum CommandResult
+{
+ MUTT_CMD_ERROR = -1, ///< Error: Can't help the user
+ MUTT_CMD_WARNING = -2, ///< Warning: Help given to the user
+ MUTT_CMD_SUCCESS = 0, ///< Success: Command worked
+ MUTT_CMD_FINISH = 1 ///< Finish: Stop processing this file
+};
+
/**
* typedef command_t - Prototype for a function to parse a command
* @param buf Temporary Buffer space
* @param s Buffer containing string to be parsed
* @param data Flags associated with the command
* @param err Buffer for error messages
- * @retval 0 Success
- * @retval -1 Error
- * @retval -2 Warning
+ * @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-typedef int (*command_t)(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
+typedef enum CommandResult (*command_t)(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
/**
* struct Command - A user-callable command
*/
struct Command
{
- const char *name; /**< Name of the command */
- command_t func; /**< Function to parse the command */
- unsigned long data; /**< Data or flags to pass to the command */
+ const char *name; ///< Name of the command
+ command_t func; ///< Function to parse the command
+ intptr_t data; ///< Data or flags to pass to the command
};
const struct Command *mutt_command_get(const char *s);