From 7d85d4e9500b2d1d802b8c5b15307ee9c770c245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20H=C3=A5llberg?= Date: Sat, 17 Jan 2009 00:46:26 +0100 Subject: fixed formatting errors in '#help' diff --git a/cmd.c b/cmd.c index e633b5f..628d213 100644 --- a/cmd.c +++ b/cmd.c @@ -73,88 +73,173 @@ static void cmd_color _; /* This must be init'd now at runtime */ cmdstruct *commands = NULL; +#define C(name, func, help) { NULL, name, help, func, NULL } + /* The builtin commands */ cmdstruct default_commands[] = { - {NULL,"help", "[keys|math|command]\tthis text, or help on specified topic", cmd_help,NULL}, - {NULL,"17", "command\t\t\trepeat \"command\" 17 times", (function_str)0,NULL}, + C("help", cmd_help, + "[keys|math|command]\tthis text, or help on specified topic"), + C("17", (function_str)0, + "command\t\t\trepeat \"command\" 17 times"), #ifndef NO_SHELL - {NULL,"!", "shell-command\t\texecute a shell command using /bin/sh", cmd_shell,NULL}, + C("!", cmd_shell, + "shell-command\t\texecute a shell command using /bin/sh"), #endif - {NULL,"action", "[[<|=|>|%][+|-]name] [{pattern|(expression)} [=[command]]]\n\t\t\t\tdelete/list/define actions", cmd_action,NULL}, - {NULL,"add", "{string|(expr)}\t\tadd the string to word completion list", cmd_add,NULL}, - {NULL,"alias", "[name[=[text]]]\t\tdelete/list/define aliases", cmd_alias,NULL}, - {NULL,"at", "[name [(time-string) [command]]\tset time of delayed label", cmd_at,NULL}, - {NULL,"beep", "\t\t\t\tmake your terminal beep (like #print (*7))", cmd_beep,NULL}, - {NULL,"bind", "[edit|name [seq][=[command]]]\tdelete/list/define key bindings", cmd_bind,NULL}, - {NULL,"cancel", "[number]\t\tcancel editing session", cmd_cancel,NULL}, - {NULL,"capture", "[filename]\t\tbegin/end of capture to file", cmd_capture,NULL}, - {NULL,"clear", "\t\t\tclear input line (use from spawned programs)", cmd_clear,NULL}, + C("action", cmd_action, + "[[<|=|>|%][+|-]name] [{pattern|(expression)} [=[command]]]\n" + "\t\t\t\tdelete/list/define actions"), + C("add", cmd_add, + "{string|(expr)}\t\tadd the string to word completion list"), + C("alias", cmd_alias, + "[name[=[text]]]\t\tdelete/list/define aliases"), + C("at", cmd_at, + "[name [(time-string) [command]]\n\t\t\t\tset time of delayed label"), + C("beep", cmd_beep, + "\t\t\t\tmake your terminal beep (like #print (*7))"), + C("bind", cmd_bind, + "[edit|name [seq][=[command]]]\n" + "\t\t\t\tdelete/list/define key bindings"), + C("cancel", cmd_cancel, + "[number]\t\tcancel editing session"), + C("capture", cmd_capture, + "[filename]\t\tbegin/end of capture to file"), + C("clear", cmd_clear, + "\t\t\tclear input line (use from spawned programs)"), #ifdef BUG_TELNET - {NULL,"color", "attr\t\t\tset default colors/attributes", cmd_color,NULL}, + C("color", cmd_color, + "attr\t\t\tset default colors/attributes"), #endif - {NULL,"connect", "[connect-id [initstr] [address port]\topen a new connection", cmd_connect,NULL}, - {NULL,"cpu", "\t\t\t\tshow CPU time used by powwow", cmd_cpu,NULL}, - {NULL,"delim", "[normal|program|{custom [chars]}]\n\t\t\t\tset word completion delimeters", cmd_delim,NULL}, - {NULL,"do", "(expr) command\t\trepeat \"command\" (expr) times", cmd_do,NULL}, - {NULL,"edit", "\t\t\t\tlist editing sessions", cmd_edit,NULL}, - {NULL,"emulate", "[<|!]{text|(expr)}\tprocess result as if received from host", cmd_emulate,NULL}, - {NULL,"exe", "[<|!]{text|(string-expr)}\texecute result as if typed from keyboard", cmd_exe,NULL}, - {NULL,"file", "[=[filename]]\t\tset/show powwow definition file", cmd_file,NULL}, - {NULL,"for", "([init];check;[loop]) command\twhile \"check\" is true exec \"command\"", cmd_for,NULL}, - {NULL,"group", "[name] [on|off|list]\tgroup alias/action manipulation", cmd_group,NULL}, - {NULL,"groupdelim", "[delimiter]\tchange delimiter for action/alias groups", cmd_groupdelim,NULL}, - {NULL,"hilite", "[attr]\t\t\thighlight your input line", cmd_hilite,NULL}, - {NULL,"history", "[{number|(expr)}]\tlist/execute commands in history", cmd_history,NULL}, - {NULL,"host", "[hostname port]]\tset/show address of default host", cmd_host,NULL}, - {NULL,"identify", "[startact [endact]]\tsend MUME client identification", cmd_identify,NULL}, - {NULL,"if", "(expr) instr1 [; #else instr2]\tif \"expr\" is true execute \"instr1\"\n\t\t\t\totherwise execute \"instr2\"", cmd_if,NULL}, - {NULL,"in", "[label [(delay) [command]]]\tdelete/list/define delayed labels", cmd_in,NULL}, - {NULL,"init", "[=[command]]\t\tdefine command to execute on connect to host", cmd_init,NULL}, - {NULL,"isprompt", "\t\t\trecognize a prompt as such", cmd_isprompt,NULL}, - {NULL,"key", "name\t\t\texecute the \"name\" key binding", cmd_key,NULL}, - {NULL,"keyedit", "editing-name\t\trun a line-editing function", cmd_keyedit,NULL}, - {NULL,"load", "[filename]\t\tload powwow settings from file", cmd_load,NULL}, - {NULL,"map", "[-[number]|walksequence]\tshow/clear/edit (auto)map", cmd_map,NULL}, - {NULL,"mark", "[string[=[attr]]]\t\tdelete/list/define markers", cmd_mark,NULL}, + C("connect", cmd_connect, + "[connect-id [initstr] [address port]\n" + "\t\t\t\topen a new connection"), + C("cpu", cmd_cpu, + "\t\t\t\tshow CPU time used by powwow"), + C("delim", cmd_delim, + "[normal|program|{custom [chars]}]\n" + "\t\t\t\tset word completion delimeters"), + C("do", cmd_do, + "(expr) command\t\trepeat \"command\" (expr) times"), + C("edit", cmd_edit, + "\t\t\t\tlist editing sessions"), + C("emulate", cmd_emulate, + "[<|!]{text|(expr)}\tprocess result as if received from host"), + C("exe", cmd_exe, + "[<|!]{text|(string-expr)}\texecute result as if typed from keyboard"), + C("file", cmd_file, + "[=[filename]]\t\tset/show powwow definition file"), + C("for", cmd_for, + "([init];check;[loop]) command\n" + "\t\t\t\twhile \"check\" is true exec \"command\""), + C("group", cmd_group, + "[name] [on|off|list]\tgroup alias/action manipulation"), + C("groupdelim", cmd_groupdelim, + "[delimiter]\tchange delimiter for action/alias groups"), + C("hilite", cmd_hilite, + "[attr]\t\t\thighlight your input line"), + C("history", cmd_history, + "[{number|(expr)}]\tlist/execute commands in history"), + C("host", cmd_host, + "[hostname port]]\tset/show address of default host"), + C("identify", cmd_identify, + "[startact [endact]]\tsend MUME client identification"), + C("if", cmd_if, + "(expr) instr1 [; #else instr2]\n" + "\t\t\t\tif \"expr\" is true execute \"instr1\",\n" + "\t\t\t\totherwise execute \"instr2\""), + C("in", cmd_in, + "[label [(delay) [command]]]\tdelete/list/define delayed labels"), + C("init", cmd_init, + "[=[command]]\t\tdefine command to execute on connect to host"), + C("isprompt", cmd_isprompt, + "\t\t\trecognize a prompt as such"), + C("key", cmd_key, + "name\t\t\texecute the \"name\" key binding"), + C("keyedit", cmd_keyedit, + "editing-name\t\trun a line-editing function"), + C("load", cmd_load, + "[filename]\t\tload powwow settings from file"), + C("map", cmd_map, + "[-[number]|walksequence]\tshow/clear/edit (auto)map"), + C("mark", cmd_mark, + "[string[=[attr]]]\t\tdelete/list/define markers"), #ifdef HAVE_LIBDL - {NULL,"module","[name]\t\tload shared library extension", cmd_module,NULL}, + C("module", cmd_module, + "[name]\t\t\tload shared library extension"), #endif - {NULL,"movie", "[filename]\t\tbegin/end of movie record to file", cmd_movie,NULL}, - {NULL,"net", "\t\t\t\tprint amount of data received from/sent to host", cmd_net,NULL}, - {NULL,"nice", "[{number|(expr)}[command]]\tset/show priority of new actions/marks", cmd_nice,NULL}, - {NULL,"option", "[[+|-|=]name]\t\tturn various options", cmd_option,NULL}, - {NULL,"prefix", "string\t\t\tprefix all lines with string", cmd_prefix,NULL}, - {NULL,"", "(expr)\t\t\tevaluate expression, trashing result", cmd_eval,NULL}, - {NULL,"print", "[<|!][text|(expr)]\tprint text/result on screen, appending a \\n\n\t\t\t\tif no argument, prints value of variable $0", cmd_print,NULL}, - {NULL,"prompt", "[[<|=|>|%][+|-]name] [{pattern|(expression)} [=[prompt-command]]]\n\t\t\t\tdelete/list/define actions on prompts", cmd_prompt,NULL}, - {NULL,"put", "{text|(expr)}\t\tput text/result of expression in history", cmd_put,NULL}, - {NULL,"qui", "\t\t\t\tdo nothing", cmd_qui,NULL}, - {NULL,"quit", "\t\t\t\tquit powwow", cmd_quit,NULL}, - {NULL,"quote", "[on|off]\t\t\ttoggle verbatim-flag on/off", cmd_quote,NULL}, - {NULL,"rawsend", "{string|(expr)}\t\tsend raw data to the MUD", cmd_rawsend,NULL}, - {NULL,"rawprint", "{string|(expr)}\t\tsend raw data to the screen", cmd_rawprint,NULL}, - {NULL,"rebind", "name [seq]\t\tchange sequence of a key binding", cmd_rebind,NULL}, - {NULL,"rebindall", "\t\t\trebind all key bindings", cmd_rebindall,NULL}, - {NULL,"rebindALL", "\t\t\trebind ALL key bindings, even trivial ones", cmd_rebindALL,NULL}, - {NULL,"record", "[filename]\t\tbegin/end of record to file", cmd_record,NULL}, - {NULL,"request", "[editor][prompt][all]\tsend various identification strings", cmd_request,NULL}, - {NULL,"reset", "\t\tclear the whole defined list and reload default", cmd_reset,NULL}, - {NULL,"retrace", "[number]\t\tretrace the last number steps", cmd_retrace,NULL}, - {NULL,"save", "[filename]\t\tsave powwow settings to file", cmd_save,NULL}, - {NULL,"send", "[<|!]{text|(expr)}\teval expression, sending result to the MUD", cmd_send,NULL}, - {NULL,"setvar", "name[=text|(expr)]\tset/show internal limits and variables", cmd_setvar,NULL}, - {NULL,"snoop", "connect-id\t\ttoggle output display for connections", cmd_snoop,NULL}, - {NULL,"spawn", "connect-id command\ttalk with a shell command", cmd_spawn,NULL}, - {NULL,"speedwalk", "[speedwalk sequence]\texecute a speedwalk sequence explicitly", cmd_speedwalk,NULL}, - {NULL,"stop", "\t\t\t\tremove all delayed commands from active list", cmd_stop,NULL}, - {NULL,"time", "\t\t\t\tprint current time and date", cmd_time,NULL}, - {NULL,"var", "variable [= [<|!]{string|(expr)} ]\twrite result into the variable", cmd_var,NULL}, - {NULL,"ver", "\t\t\t\tshow powwow version", cmd_ver,NULL}, - {NULL,"while", "(expr) instr\t\twhile \"expr\" is true execute \"instr\"", cmd_while,NULL}, - {NULL,"write", "[>|!](expr;name)\t\twrite result of expr to \"name\" file", cmd_write,NULL}, - {NULL,"zap", "connect-id\t\t\tclose a connection", cmd_zap,NULL}, - {NULL,(char *)0, (char *)0, (function_str)0,NULL} + C("movie", cmd_movie, + "[filename]\t\tbegin/end of movie record to file"), + C("net", cmd_net, + "\t\t\t\tprint amount of data received from/sent to host"), + C("nice", cmd_nice, + "[{number|(expr)}[command]]\n" + "\t\t\t\tset/show priority of new actions/marks"), + C("option", cmd_option, + "[[+|-|=]name]|list\tlist or view various options"), + C("prefix", cmd_prefix, + "string\t\t\tprefix all lines with string"), + C("", cmd_eval, + "(expr)\t\t\tevaluate expression, trashing result"), + C("print", cmd_print, + "[<|!][text|(expr)]\tprint text/result on screen, appending a \\n\n" + "\t\t\t\tif no argument, prints value of variable $0"), + C("prompt", cmd_prompt, + "[[<|=|>|%][+|-]name] [{pattern|(expression)} [=[prompt-command]]]\n" + "\t\t\t\tdelete/list/define actions on prompts"), + C("put", cmd_put, + "{text|(expr)}\t\tput text/result of expression in history"), + C("qui", cmd_qui, + "\t\t\t\tdo nothing"), + C("quit", cmd_quit, + "\t\t\t\tquit powwow"), + C("quote", cmd_quote, + "[on|off]\t\t\ttoggle verbatim-flag on/off"), + C("rawsend", cmd_rawsend, + "{string|(expr)}\tsend raw data to the MUD"), + C("rawprint", cmd_rawprint, + "{string|(expr)}\tsend raw data to the screen"), + C("rebind", cmd_rebind, + "name [seq]\t\tchange sequence of a key binding"), + C("rebindall", cmd_rebindall, + "\t\t\trebind all key bindings"), + C("rebindALL", cmd_rebindALL, + "\t\t\trebind ALL key bindings, even trivial ones"), + C("record", cmd_record, + "[filename]\t\tbegin/end of record to file"), + C("request", cmd_request, + "[editor][prompt][all]\tsend various identification strings"), + C("reset", cmd_reset, + "\t\tclear the whole defined list and reload default"), + C("retrace", cmd_retrace, + "[number]\t\tretrace the last number steps"), + C("save", cmd_save, + "[filename]\t\tsave powwow settings to file"), + C("send", cmd_send, + "[<|!]{text|(expr)}\teval expression, sending result to the MUD"), + C("setvar", cmd_setvar, + "name[=text|(expr)]\tset/show internal limits and variables"), + C("snoop", cmd_snoop, + "connect-id\t\ttoggle output display for connections"), + C("spawn", cmd_spawn, + "connect-id command\ttalk with a shell command"), + C("speedwalk", cmd_speedwalk, + "[speedwalk sequence]\texecute a speedwalk sequence explicitly"), + C("stop", cmd_stop, + "\t\t\t\tremove all delayed commands from active list"), + C("time", cmd_time, + "\t\t\t\tprint current time and date"), + C("var", cmd_var, + "variable [= [<|!]{string|(expr)} ]\n" + "\t\t\t\twrite result into the variable"), + C("ver", cmd_ver, + "\t\t\t\tshow powwow version"), + C("while", cmd_while, + "(expr) instr\t\twhile \"expr\" is true execute \"instr\""), + C("write", cmd_write, + "[>|!](expr;name)\t\twrite result of expr to \"name\" file"), + C("zap", cmd_zap, + "connect-id\t\t\tclose a connection"), + { NULL } }; char *_cmd_sort_name( cmdstruct *cmd ) { @@ -239,7 +324,7 @@ static void cmd_module __P1 (char *,arg) { int pindex; struct stat junk; char *prefixes[] = { - "./", + ".", "/lib/powwow", "/usr/lib/powwow", "/usr/local/lib/powwow", diff --git a/cmd.h b/cmd.h index f8186a5..372139b 100644 --- a/cmd.h +++ b/cmd.h @@ -4,7 +4,8 @@ #define _CMD_H_ typedef struct cmdstruct { - char *sortname; /* set to NULL if you want to sort by command name */ + char *sortname; /* set to NULL if you want to sort by + * command name */ char *name; /* command name */ char *help; /* short help */ function_str funct; /* function to call */ diff --git a/plugtest.c b/plugtest.c index 1d12c7d..dd42c58 100644 --- a/plugtest.c +++ b/plugtest.c @@ -2,10 +2,11 @@ #include "defines.h" #include "cmd.h" +#include "tty.h" void plugtest( char *arg ); -cmdstruct mycommand = { NULL, "plugtest", "test command", plugtest, NULL }; +cmdstruct mycommand = { NULL, NULL, "plugtest", plugtest, "test command" }; void powwow_init() { tty_printf( "Init plugtest.so!\n" ); -- cgit v0.10.2