Changeset 0a0fb74
- Timestamp:
- Aug 15, 2009, 7:08:19 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- a352029b
- Parents:
- 3f8514b
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:58)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:19)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cmd.c
r3f8514b r0a0fb74 5 5 #include "owl.h" 6 6 7 extern owl_cmd commands_to_init[];7 extern const owl_cmd commands_to_init[]; 8 8 9 9 /**************************************************************************/ … … 23 23 24 24 /* for bulk initialization at startup */ 25 int owl_cmddict_add_from_list(owl_cmddict *cd, owl_cmd *cmds) {26 owl_cmd *cur;25 int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) { 26 const owl_cmd *cur; 27 27 int ret = 0; 28 28 for (cur = cmds; cur->name != NULL; cur++) { … … 38 38 } 39 39 40 owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {40 const owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) { 41 41 return owl_dict_find_element(d, name); 42 42 } … … 55 55 } 56 56 57 int owl_cmddict_add_cmd(owl_cmddict *cd, owl_cmd * cmd) {57 int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) { 58 58 owl_cmd * newcmd = owl_malloc(sizeof(owl_cmd)); 59 59 if(owl_cmd_create_from_template(newcmd, cmd) < 0) { … … 67 67 char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) { 68 68 char *retval = NULL; 69 owl_cmd *cmd;69 const owl_cmd *cmd; 70 70 71 71 if (!strcmp(argv[0], "")) { … … 132 132 133 133 /* sets up a new command based on a template, copying strings */ 134 int owl_cmd_create_from_template(owl_cmd *cmd, owl_cmd *templ) {134 int owl_cmd_create_from_template(owl_cmd *cmd, const owl_cmd *templ) { 135 135 *cmd = *templ; 136 136 if (!templ->name) return(-1); … … 162 162 } 163 163 164 int owl_cmd_is_context_valid( owl_cmd *cmd, const owl_context *ctx) {164 int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) { 165 165 if (owl_context_matches(ctx, cmd->validctx)) return 1; 166 166 else return 0; 167 167 } 168 168 169 char *owl_cmd_execute( owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {169 char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) { 170 170 static int alias_recurse_depth = 0; 171 171 int ival=0; … … 238 238 239 239 /* returns a reference */ 240 const char *owl_cmd_get_summary( owl_cmd *cmd) {240 const char *owl_cmd_get_summary(const owl_cmd *cmd) { 241 241 return cmd->summary; 242 242 } 243 243 244 244 /* returns a summary line describing this keymap. the caller must free. */ 245 char *owl_cmd_describe( owl_cmd *cmd) {245 char *owl_cmd_describe(const owl_cmd *cmd) { 246 246 char *s; 247 247 int slen; -
commands.c
re19eb97 r0a0fb74 40 40 41 41 42 owl_cmd commands_to_init[]42 const owl_cmd commands_to_init[] 43 43 = { 44 44 OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY, -
functions.c
r77bced3 r0a0fb74 39 39 } 40 40 41 owl_cmd *owl_function_get_cmd(const char *name)41 const owl_cmd *owl_function_get_cmd(const char *name) 42 42 { 43 43 return owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 110 110 char *owl_function_cmd_describe(const char *name) 111 111 { 112 owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);112 const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); 113 113 if (cmd) return owl_cmd_describe(cmd); 114 114 else return(NULL); -
keymap.c
re19eb97 r0a0fb74 102 102 for (i=0; i<nbindings; i++) { 103 103 char buff[100]; 104 owl_cmd *cmd;104 const owl_cmd *cmd; 105 105 const char *tmpdesc, *desc = ""; 106 106 -
perlconfig.c
re19eb97 r0a0fb74 452 452 } 453 453 454 char *owl_perlconfig_perlcmd( owl_cmd *cmd, int argc, const char *const *argv)454 char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 455 455 { 456 456 int i, count;
Note: See TracChangeset
for help on using the changeset viewer.