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

Diff for /src/usr.bin/snmp/snmpc.c between version 1.7 and 1.8

version 1.7, 2019/08/14 14:40:23 version 1.8, 2019/09/18 09:44:38
Line 45 
Line 45 
 int snmpc_walk(int, char *[]);  int snmpc_walk(int, char *[]);
 int snmpc_trap(int, char *[]);  int snmpc_trap(int, char *[]);
 int snmpc_mibtree(int, char *[]);  int snmpc_mibtree(int, char *[]);
   struct snmp_agent *snmpc_connect(char *, char *);
 int snmpc_parseagent(char *, char *);  int snmpc_parseagent(char *, char *);
 int snmpc_print(struct ber_element *);  int snmpc_print(struct ber_element *);
 __dead void snmpc_printerror(enum snmp_error, char *);  __dead void snmpc_printerror(enum snmp_error, char *);
Line 304 
Line 305 
         if (argc < 2)          if (argc < 2)
                 usage();                  usage();
   
         agent = snmp_connect_v12(snmpc_parseagent(argv[0], "161"), version,          if ((agent = snmpc_connect(argv[0], "161")) == NULL)
             community);  
         if (agent == NULL)  
                 err(1, "%s", snmp_app->name);                  err(1, "%s", snmp_app->name);
         agent->timeout = timeout;          agent->timeout = timeout;
         agent->retries = retries;          agent->retries = retries;
Line 372 
Line 371 
                 usage();                  usage();
         oids = argc == 1 ? mib : argv[1];          oids = argc == 1 ? mib : argv[1];
   
         agent = snmp_connect_v12(snmpc_parseagent(argv[0], "161"), version, community);          if ((agent = snmpc_connect(argv[0], "161"))== NULL)
         if (agent == NULL)  
                 err(1, "%s", snmp_app->name);                  err(1, "%s", snmp_app->name);
         agent->timeout = timeout;          agent->timeout = timeout;
         agent->retries = retries;          agent->retries = retries;
Line 495 
Line 493 
         if (version == SNMP_V1)          if (version == SNMP_V1)
                 errx(1, "trap is not supported for snmp v1");                  errx(1, "trap is not supported for snmp v1");
   
         agent = snmp_connect_v12(snmpc_parseagent(argv[0], "162"),          if ((agent = snmpc_connect(argv[0], "162")) == NULL)
             version, community);  
         if (agent == NULL)  
                 err(1, "%s", snmp_app->name);                  err(1, "%s", snmp_app->name);
   
         if (pledge("stdio", NULL) == -1)          if (pledge("stdio", NULL) == -1)
Line 691 
Line 687 
                 printf("%s\n", buf);                  printf("%s\n", buf);
         }          }
         return 0;          return 0;
   }
   
   struct snmp_agent *
   snmpc_connect(char *host, char *port)
   {
           switch (version) {
           case SNMP_V1:
           case SNMP_V2C:
                   return snmp_connect_v12(snmpc_parseagent(host, port), version,
                       community);
           }
           return NULL;
 }  }
   
 int  int

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8