Changeset 6922edd for cmd.c


Ignore:
Timestamp:
Oct 26, 2006, 11:14:41 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4c46dfd
Parents:
bc220b2
Message:
Adding the ability to install real commands from perl.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    rf1e629d r6922edd  
    5555  owl_dict_insert_element(cd, cmd->name, (void*)cmd, (void(*)(void*))owl_cmd_free);   
    5656  return(0);
     57}
     58
     59int owl_cmddict_add_cmd(owl_cmddict *cd, owl_cmd * cmd) {
     60  owl_cmd * newcmd = owl_malloc(sizeof(owl_cmd));
     61  if(owl_cmd_create_from_template(newcmd, cmd) < 0) {
     62    owl_free(newcmd);
     63    return -1;
     64  }
     65  owl_function_debugmsg("Add cmd %s", cmd->name);
     66  return owl_dict_insert_element(cd, newcmd->name, (void*)newcmd, (void(*)(void*))owl_cmd_free);
    5767}
    5868
     
    118128  if (cmd->usage) owl_free(cmd->usage);
    119129  if (cmd->description) owl_free(cmd->description);
     130  if (cmd->cmd_aliased_to) owl_free(cmd->cmd_aliased_to);
     131  if (cmd->cmd_perl) owl_perlconfig_cmd_free(cmd);
    120132}
    121133
     
    187199  } else if (cmd->cmd_ctxi_fn) {
    188200    cmd->cmd_ctxi_fn(owl_context_get_data(ctx), ival);
     201  } else if (cmd->cmd_perl) {
     202    return owl_perlconfig_perlcmd(cmd, argc, argv);
    189203  }
    190204
Note: See TracChangeset for help on using the changeset viewer.