Changeset e19eb97 for cmd.c


Ignore:
Timestamp:
Aug 15, 2009, 7:08:18 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:
1077891a
Parents:
fa4562c
git-author:
Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:51)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:18)
Message:
Add const qualifiers for char * and void *.

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

Legend:

Unmodified
Added
Removed
  • cmd.c

    rfa4562c re19eb97  
    3838}
    3939
    40 owl_cmd *owl_cmddict_find(owl_cmddict *d, char *name) {
     40owl_cmd *owl_cmddict_find(owl_cmddict *d, const char *name) {
    4141  return owl_dict_find_element(d, name);
    4242}
     
    4747
    4848/* creates a new command alias */
    49 int owl_cmddict_add_alias(owl_cmddict *cd, char *alias_from, char *alias_to) {
     49int owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {
    5050  owl_cmd *cmd;
    5151  cmd = owl_malloc(sizeof(owl_cmd));
     
    6565}
    6666
    67 char *_owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, char **argv, int argc, char *buff) {
     67char *_owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, const char *const *argv, int argc, const char *buff) {
    6868  char *retval = NULL;
    6969  owl_cmd *cmd;
     
    7878}
    7979
    80 char *owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, char *cmdbuff) {
     80char *owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, const char *cmdbuff) {
    8181  char **argv;
    8282  int argc;
     
    103103}
    104104
    105 char *owl_cmddict_execute_argv(owl_cmddict *cd, owl_context *ctx, char **argv, int argc) {
     105char *owl_cmddict_execute_argv(owl_cmddict *cd, owl_context *ctx, const char *const *argv, int argc) {
    106106  char *buff, *ptr;
    107107  int len = 0, i;
     
    143143}
    144144
    145 int owl_cmd_create_alias(owl_cmd *cmd, char *name, char *aliased_to) {
     145int owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {
    146146  memset(cmd, 0, sizeof(owl_cmd));
    147147  cmd->name = owl_strdup(name);
     
    167167}
    168168
    169 char *owl_cmd_execute(owl_cmd *cmd, owl_cmddict *cd, owl_context *ctx, int argc, char **argv, char *cmdbuff) {
     169char *owl_cmd_execute(owl_cmd *cmd, owl_cmddict *cd, owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
    170170  static int alias_recurse_depth = 0;
    171171  int ival=0;
    172   char *cmdbuffargs;
     172  const char *cmdbuffargs;
    173173  char *newcmd, *rv=NULL;
    174174
     
    206206
    207207  if (cmd->cmd_i_fn || cmd->cmd_ctxi_fn) {
    208       char *ep = "x";
     208      const char *ep = "x";
    209209      if (argc != 2) {
    210210        owl_function_makemsg("Wrong number of arguments for %s command.", argv[0]);
     
    238238
    239239/* returns a reference */
    240 char *owl_cmd_get_summary(owl_cmd *cmd) {
     240const char *owl_cmd_get_summary(owl_cmd *cmd) {
    241241  return cmd->summary;
    242242}
     
    255255
    256256
    257 void owl_cmd_get_help(owl_cmddict *d, char *name, owl_fmtext *fm) {
    258   char *s;
     257void owl_cmd_get_help(owl_cmddict *d, const char *name, owl_fmtext *fm) {
     258  const char *s;
    259259  char *indent;
    260260  owl_cmd *cmd;
Note: See TracChangeset for help on using the changeset viewer.