summaryrefslogtreecommitdiff
path: root/src/dged/command.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dged/command.h')
-rw-r--r--src/dged/command.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dged/command.h b/src/dged/command.h
index bbc57f2..956c10a 100644
--- a/src/dged/command.h
+++ b/src/dged/command.h
@@ -77,6 +77,16 @@ struct command {
};
/**
+ * Convenience macro for creating a command from a function.
+ */
+#define COMMAND_FN(name_, command_name, function, userdata_) \
+ static struct command command_name##_command = { \
+ .fn = function, \
+ .name = #name_, \
+ .userdata = userdata_, \
+ };
+
+/**
* A command registry
*/
HASHMAP_ENTRY_TYPE(command_entry, struct command);