Diff for /embedaddon/bird/client/commands.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2017/08/22 12:33:54 version 1.1.1.2, 2021/03/17 19:50:23
Line 36  struct cmd_node { Line 36  struct cmd_node {
   
 static struct cmd_node cmd_root;  static struct cmd_node cmd_root;
   
   #define isspace_(X) isspace((unsigned char) (X))
   
 void  void
 cmd_build_tree(void)  cmd_build_tree(void)
 {  {
Line 53  cmd_build_tree(void) Line 55  cmd_build_tree(void)
       while (*c)        while (*c)
         {          {
           char *d = c;            char *d = c;
          while (*c && !isspace(*c))          while (*c && !isspace_(*c))
             c++;              c++;
           for(new=old->son; new; new=new->sibling)            for(new=old->son; new; new=new->sibling)
             if (new->len == c-d && !memcmp(new->token, d, c-d))              if (new->len == c-d && !memcmp(new->token, d, c-d))
Line 71  cmd_build_tree(void) Line 73  cmd_build_tree(void)
               new->prio = (new->len == 3 && (!memcmp(new->token, "roa", 3) || !memcmp(new->token, "rip", 3))) ? 0 : 1; /* Hack */                new->prio = (new->len == 3 && (!memcmp(new->token, "roa", 3) || !memcmp(new->token, "rip", 3))) ? 0 : 1; /* Hack */
             }              }
           old = new;            old = new;
          while (isspace(*c))          while (isspace_(*c))
             c++;              c++;
         }          }
       if (cmd->is_real_cmd)        if (cmd->is_real_cmd)
Line 132  cmd_list_ambiguous(struct cmd_node *root, char *cmd, i Line 134  cmd_list_ambiguous(struct cmd_node *root, char *cmd, i
   struct cmd_node *m;    struct cmd_node *m;
   
   for(m=root->son; m; m=m->sibling)    for(m=root->son; m; m=m->sibling)
    if (m->len > len && !memcmp(m->token, cmd, len))        if (m->len > len && !memcmp(m->token, cmd, len))
       cmd_display_help(m->help, m->cmd);        cmd_display_help(m->help, m->cmd);
 }  }
   
Line 147  cmd_help(char *cmd, int len) Line 149  cmd_help(char *cmd, int len)
   n = &cmd_root;    n = &cmd_root;
   while (cmd < end)    while (cmd < end)
     {      {
      if (isspace(*cmd))      if (isspace_(*cmd))
         {          {
           cmd++;            cmd++;
           continue;            continue;
         }          }
       z = cmd;        z = cmd;
      while (cmd < end && !isspace(*cmd))      while (cmd < end && !isspace_(*cmd))
         cmd++;          cmd++;
       m = cmd_find_abbrev(n, z, cmd-z, &ambig);        m = cmd_find_abbrev(n, z, cmd-z, &ambig);
       if (ambig)        if (ambig)
Line 222  cmd_complete(char *cmd, int len, char *buf, int again) Line 224  cmd_complete(char *cmd, int len, char *buf, int again)
   int ambig, cnt = 0, common;    int ambig, cnt = 0, common;
   
   /* Find the last word we want to complete */    /* Find the last word we want to complete */
  for(fin=end; fin > start && !isspace(fin[-1]); fin--)  for(fin=end; fin > start && !isspace_(fin[-1]); fin--)
     ;      ;
   
   /* Find the context */    /* Find the context */
   n = &cmd_root;    n = &cmd_root;
   while (cmd < fin && n->son)    while (cmd < fin && n->son)
     {      {
      if (isspace(*cmd))      if (isspace_(*cmd))
         {          {
           cmd++;            cmd++;
           continue;            continue;
         }          }
       z = cmd;        z = cmd;
      while (cmd < fin && !isspace(*cmd))      while (cmd < fin && !isspace_(*cmd))
         cmd++;          cmd++;
       m = cmd_find_abbrev(n, z, cmd-z, &ambig);        m = cmd_find_abbrev(n, z, cmd-z, &ambig);
       if (ambig)        if (ambig)
Line 290  cmd_expand(char *cmd) Line 292  cmd_expand(char *cmd)
   n = &cmd_root;    n = &cmd_root;
   while (*c)    while (*c)
     {      {
      if (isspace(*c))      if (isspace_(*c))
         {          {
           c++;            c++;
           continue;            continue;
         }          }
       b = c;        b = c;
      while (*c && !isspace(*c))      while (*c && !isspace_(*c))
         c++;          c++;
       m = cmd_find_abbrev(n, b, c-b, &ambig);        m = cmd_find_abbrev(n, b, c-b, &ambig);
       if (!m)        if (!m)

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>