[BACK]Return to sysctl.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sbin / sysctl

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sbin/sysctl/sysctl.c between version 1.140.2.1 and 1.141

version 1.140.2.1, 2012/12/25 21:01:14 version 1.141, 2012/03/11 23:33:00
Line 122  __RCSID("$NetBSD$");
Line 122  __RCSID("$NetBSD$");
 /*  /*
  * generic routines   * generic routines
  */   */
 static const struct handlespec *findhandler(const char *, int, regex_t *,  static const struct handlespec *findhandler(const char *, regex_t *, size_t *);
     size_t *);  
 static void canonicalize(const char *, char *);  static void canonicalize(const char *, char *);
 static void purge_tree(struct sysctlnode *);  static void purge_tree(struct sysctlnode *);
 static void print_tree(int *, u_int, struct sysctlnode *, u_int, int, regex_t *,  static void print_tree(int *, u_int, struct sysctlnode *, u_int, int, regex_t *,
Line 385  main(int argc, char *argv[])
Line 384  main(int argc, char *argv[])
  * ********************************************************************   * ********************************************************************
  */   */
 static const struct handlespec *  static const struct handlespec *
 findhandler(const char *s, int w, regex_t *re, size_t *lastcompiled)  findhandler(const char *s, regex_t *re, size_t *lastcompiled)
 {  {
         const struct handlespec *p;          const struct handlespec *p;
         size_t i, l;          size_t i, l;
Line 406  findhandler(const char *s, int w, regex_
Line 405  findhandler(const char *s, int w, regex_
                 }                  }
                 j = regexec(&re[i], s, 1, &match, 0);                  j = regexec(&re[i], s, 1, &match, 0);
                 if (j == 0) {                  if (j == 0) {
                         if (match.rm_so == 0 && match.rm_eo == (int)l &&                          if (match.rm_so == 0 && match.rm_eo == (int)l)
                             (w ? p[i].ps_w : p[i].ps_p) != NULL)  
                                 return &p[i];                                  return &p[i];
                 }                  }
                 else if (j != REG_NOMATCH) {                  else if (j != REG_NOMATCH) {
Line 670  print_tree(int *name, u_int namelen, str
Line 668  print_tree(int *name, u_int namelen, str
         }          }
   
         canonicalize(gsname, canonname);          canonicalize(gsname, canonname);
         p = findhandler(canonname, 0, re, lastcompiled);          p = findhandler(canonname, re, lastcompiled);
         if (type != CTLTYPE_NODE && p != NULL) {          if (type != CTLTYPE_NODE && p != NULL) {
                   if (p->ps_p == NULL) {
                           sysctlperror("Cannot print `%s': %s\n", gsname,
                               strerror(EOPNOTSUPP));
                           exit(1);
                   }
                 (*p->ps_p)(gsname, gdname, NULL, name, namelen, pnode, type,                  (*p->ps_p)(gsname, gdname, NULL, name, namelen, pnode, type,
                            __UNCONST(p->ps_d));                             __UNCONST(p->ps_d));
                 *sp = *dp = '\0';                  *sp = *dp = '\0';
Line 905  parse(char *l, regex_t *re, size_t *last
Line 908  parse(char *l, regex_t *re, size_t *last
         }          }
   
         canonicalize(gsname, canonname);          canonicalize(gsname, canonname);
         if (type != CTLTYPE_NODE && (w = findhandler(canonname, 1, re,          if (type != CTLTYPE_NODE && (w = findhandler(canonname, re,
             lastcompiled)) != NULL) {              lastcompiled)) != NULL) {
                   if (w->ps_w == NULL) {
                           sysctlperror("Cannot write `%s': %s\n", gsname,
                               strerror(EOPNOTSUPP));
                           exit(1);
                   }
                 (*w->ps_w)(gsname, gdname, value, name, namelen, node, type,                  (*w->ps_w)(gsname, gdname, value, name, namelen, node, type,
                            __UNCONST(w->ps_d));                             __UNCONST(w->ps_d));
                 gsname[0] = '\0';                  gsname[0] = '\0';
Line 2337  kern_drivers(HANDLER_ARGS)
Line 2345  kern_drivers(HANDLER_ARGS)
         rc = prog_sysctl(name, namelen, kd, &sz, NULL, 0);          rc = prog_sysctl(name, namelen, kd, &sz, NULL, 0);
         if (rc == -1) {          if (rc == -1) {
                 sysctlerror(1);                  sysctlerror(1);
                 free(kd);  
                 return;                  return;
         }          }
   

Legend:
Removed from v.1.140.2.1  
changed lines
  Added in v.1.141

CVSweb <webmaster@jp.NetBSD.org>