Changeset 0a0fb74 for cmd.c


Ignore:
Timestamp:
Aug 15, 2009, 7:08:19 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
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)
Message:
Add const qualifiers for owl_cmd *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r3f8514b r0a0fb74  
    55#include "owl.h"
    66
    7 extern owl_cmd commands_to_init[];
     7extern const owl_cmd commands_to_init[];
    88
    99/**************************************************************************/
     
    2323
    2424/* for bulk initialization at startup */
    25 int owl_cmddict_add_from_list(owl_cmddict *cd, owl_cmd *cmds) {
    26   owl_cmd *cur;
     25int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) {
     26  const owl_cmd *cur;
    2727  int ret = 0;
    2828  for (cur = cmds; cur->name != NULL; cur++) {
     
    3838}
    3939
    40 owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {
     40const owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {
    4141  return owl_dict_find_element(d, name);
    4242}
     
    5555}
    5656
    57 int owl_cmddict_add_cmd(owl_cmddict *cd, owl_cmd * cmd) {
     57int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) {
    5858  owl_cmd * newcmd = owl_malloc(sizeof(owl_cmd));
    5959  if(owl_cmd_create_from_template(newcmd, cmd) < 0) {
     
    6767char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) {
    6868  char *retval = NULL;
    69   owl_cmd *cmd;
     69  const owl_cmd *cmd;
    7070
    7171  if (!strcmp(argv[0], "")) {
     
    132132
    133133/* sets up a new command based on a template, copying strings */
    134 int owl_cmd_create_from_template(owl_cmd *cmd, owl_cmd *templ) {
     134int owl_cmd_create_from_template(owl_cmd *cmd, const owl_cmd *templ) {
    135135  *cmd = *templ;
    136136  if (!templ->name) return(-1);
     
    162162}
    163163
    164 int owl_cmd_is_context_valid(owl_cmd *cmd, const owl_context *ctx) {
     164int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) {
    165165  if (owl_context_matches(ctx, cmd->validctx)) return 1;
    166166  else return 0;
    167167}
    168168
    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) {
     169char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
    170170  static int alias_recurse_depth = 0;
    171171  int ival=0;
     
    238238
    239239/* returns a reference */
    240 const char *owl_cmd_get_summary(owl_cmd *cmd) {
     240const char *owl_cmd_get_summary(const owl_cmd *cmd) {
    241241  return cmd->summary;
    242242}
    243243
    244244/* returns a summary line describing this keymap.  the caller must free. */
    245 char *owl_cmd_describe(owl_cmd *cmd) {
     245char *owl_cmd_describe(const owl_cmd *cmd) {
    246246  char *s;
    247247  int slen;
Note: See TracChangeset for help on using the changeset viewer.