void handle_long_opt(const char *myoptarg) { char *cp, *cp2; /* * else it's a long option, so process it like name=value */ cp = (char *)malloc(strlen(myoptarg) + 3); if (!cp) return; strcpy(cp, myoptarg); cp2 = strchr(cp, '='); if (!cp2 && !strchr(cp, ' ')) { /* * well, they didn't specify an argument as far as we * can tell. Give them a '1' as the argument (which * works for boolean tokens and a few others) and let * them suffer from there if it's not what they * wanted */ strcat(cp, " 1"); } else { /* * replace the '=' with a ' ' */ if (cp2) *cp2 = ' '; } netsnmp_config(cp); free(cp); }
int main(int argc, char** argv) { netsnmp_container *container; netsnmp_config("debugTokens access:tcp,verbose:access:tcp,tcp,verbose:tcp"); netsnmp_container_init_list(); dodebug = 1; container = netsnmp_access_tcpconn_container_load(NULL, 0); netsnmp_access_tcpconn_container_free(container, 0); }