Adding commandsAdding commands raevnos Sat, 2007-06-23 13:44
This page talks about how to add new builtin commands.
Rule 1: If at all possible, do it via softcode and @command.
Registering a new command
Adding to the command table
To be written. See src/command.c for examples.
See the example in cmdlocal.c
Writing the command
TBW, possibly as a child page. Variables available in COMMAND() blocks, etc.
Adding new switches
1.8.3p6 and later
Just include the switch name in the string of valid switches for the command.
1.8.3p5 and earlier
To add a new switch that doesn't already exist, add it, in all-caps, as new line to src/SWITCHES. The first time you re-run make after that, hdrs/switches.h and src/switchinc.c will be automatically rebuilt to include the new switch. There's a limit as to how many switches you can have -- to raise it, increase the
NUM_BYTES #define in hdrs/command.h. Each time you increase it by 1, you get room for up to 8 more switches.
For switches included in src/SWITCHES:
For switches not in the file (1.8.3p6 and later):