[BACK]Return to smi.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / snmp

Diff for /src/usr.bin/snmp/smi.c between version 1.12 and 1.13

version 1.12, 2020/08/08 13:02:54 version 1.13, 2020/12/14 07:44:26
Line 39 
Line 39 
 #define MINIMUM(a, b)   (((a) < (b)) ? (a) : (b))  #define MINIMUM(a, b)   (((a) < (b)) ? (a) : (b))
   
 char *smi_displayhint_os(struct textconv *, int, const char *, size_t, int);  char *smi_displayhint_os(struct textconv *, int, const char *, size_t, int);
   char *smi_displayhint_int(struct textconv*, int, long long);
   
 int smi_oid_cmp(struct oid *, struct oid *);  int smi_oid_cmp(struct oid *, struct oid *);
 int smi_key_cmp(struct oid *, struct oid *);  int smi_key_cmp(struct oid *, struct oid *);
Line 345 
Line 346 
                         break;                          break;
                 }                  }
                 hint = "INTEGER: ";                  hint = "INTEGER: ";
                   if (object != NULL && object->o_textconv != NULL &&
                       object->o_textconv->tc_syntax == root->be_encoding)
                           return smi_displayhint_int(object->o_textconv,
                               print_hint, v);
                 if (root->be_class == BER_CLASS_APPLICATION) {                  if (root->be_class == BER_CLASS_APPLICATION) {
                         if (root->be_type == SNMP_T_COUNTER32)                          if (root->be_type == SNMP_T_COUNTER32)
                                 hint = "Counter32: ";                                  hint = "Counter32: ";
Line 628 
Line 633 
         if (oid == NULL)          if (oid == NULL)
                 return RB_MIN(oidtree, &smi_oidtree);                  return RB_MIN(oidtree, &smi_oidtree);
         return RB_NEXT(oidtree, &smi_oidtree, oid);          return RB_NEXT(oidtree, &smi_oidtree, oid);
   }
   
   char *
   smi_displayhint_int(struct textconv *tc, int print_hint, long long v)
   {
           size_t i;
           char *rbuf;
   
           for (i = 0; tc->tc_enum[i].tce_name != NULL; i++) {
                   if (tc->tc_enum[i].tce_number == v) {
                           if (print_hint) {
                                   if (asprintf(&rbuf, "INTEGER: %s(%lld)",
                                       tc->tc_enum[i].tce_name, v) == -1)
                                           return NULL;
                           } else {
                                   if (asprintf(&rbuf, "%s",
                                       tc->tc_enum[i].tce_name) == -1)
                                           return NULL;
                           }
                           return rbuf;
                   }
           }
           if (asprintf(&rbuf, "%s%lld", print_hint ? "INTEGER: " : "", v) == -1)
                   return NULL;
           return rbuf;
 }  }
   
 #define REPLACEMENT "\357\277\275"  #define REPLACEMENT "\357\277\275"

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13