main.c (227081) | main.c (270027) |
---|---|
1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 */ 29#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 */ 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sbin/atm/atmconfig/main.c 227081 2011-11-04 13:36:02Z ed $"); | 30__FBSDID("$FreeBSD: head/sbin/atm/atmconfig/main.c 270027 2014-08-15 21:22:49Z ngie $"); |
31 32#include <sys/types.h> 33#include <sys/sysctl.h> 34#include <netdb.h> 35#include <stdarg.h> 36#include <ctype.h> 37#include <limits.h> 38#include <stdint.h> 39#include <fnmatch.h> 40#include <dirent.h> | 31 32#include <sys/types.h> 33#include <sys/sysctl.h> 34#include <netdb.h> 35#include <stdarg.h> 36#include <ctype.h> 37#include <limits.h> 38#include <stdint.h> 39#include <fnmatch.h> 40#include <dirent.h> |
41#ifndef RESCUE | 41#ifdef WITH_BSNMP |
42#include <bsnmp/asn1.h> 43#include <bsnmp/snmp.h> 44#include <bsnmp/snmpclient.h> 45#endif 46 47#include "atmconfig.h" 48#include "private.h" 49 --- 389 unchanged lines hidden (view full) --- 439 } 440 printf(" ]."); 441 if (!has_sub_topics) 442 printf(" No sub-topics found."); 443 printf("\n"); 444 exit(1); 445} 446 | 42#include <bsnmp/asn1.h> 43#include <bsnmp/snmp.h> 44#include <bsnmp/snmpclient.h> 45#endif 46 47#include "atmconfig.h" 48#include "private.h" 49 --- 389 unchanged lines hidden (view full) --- 439 } 440 printf(" ]."); 441 if (!has_sub_topics) 442 printf(" No sub-topics found."); 443 printf("\n"); 444 exit(1); 445} 446 |
447#ifndef RESCUE | 447#ifdef WITH_BSNMP |
448/* 449 * Parse a server specification 450 * 451 * syntax is [trans::][community@][server][:port] 452 */ 453static void 454parse_server(char *name) 455{ --- 66 unchanged lines hidden (view full) --- 522#endif 523 524int 525main(int argc, char *argv[]) 526{ 527 int opt, i; 528 const struct cmdtab *match, *cc, *tab; 529 | 448/* 449 * Parse a server specification 450 * 451 * syntax is [trans::][community@][server][:port] 452 */ 453static void 454parse_server(char *name) 455{ --- 66 unchanged lines hidden (view full) --- 522#endif 523 524int 525main(int argc, char *argv[]) 526{ 527 int opt, i; 528 const struct cmdtab *match, *cc, *tab; 529 |
530#ifndef RESCUE | 530#ifdef WITH_BSNMP |
531 snmp_client_init(&snmp_client); 532 snmp_client.trans = SNMP_TRANS_LOC_STREAM; 533 snmp_client_set_host(&snmp_client, PATH_ILMI_SOCK); 534#endif 535 | 531 snmp_client_init(&snmp_client); 532 snmp_client.trans = SNMP_TRANS_LOC_STREAM; 533 snmp_client_set_host(&snmp_client, PATH_ILMI_SOCK); 534#endif 535 |
536#ifdef RESCUE 537#define OPTSTR "htv" 538#else | 536#ifdef WITH_BSNMP |
539#define OPTSTR "htvs:" | 537#define OPTSTR "htvs:" |
538#else 539#define OPTSTR "htv" |
|
540#endif 541 542 while ((opt = getopt(argc, argv, OPTSTR)) != -1) 543 switch (opt) { 544 545 case 'h': 546 help_func(0, argv); 547 | 540#endif 541 542 while ((opt = getopt(argc, argv, OPTSTR)) != -1) 543 switch (opt) { 544 545 case 'h': 546 help_func(0, argv); 547 |
548#ifndef RESCUE | 548#ifdef WITH_BSNMP |
549 case 's': 550 parse_server(optarg); 551 break; 552#endif 553 554 case 'v': 555 verbose++; 556 break; --- 8 unchanged lines hidden (view full) --- 565 566 argc -= optind; 567 argv += optind; 568 569 if ((main_tab = malloc(sizeof(static_main_tab))) == NULL) 570 err(1, NULL); 571 memcpy(main_tab, static_main_tab, sizeof(static_main_tab)); 572 | 549 case 's': 550 parse_server(optarg); 551 break; 552#endif 553 554 case 'v': 555 verbose++; 556 break; --- 8 unchanged lines hidden (view full) --- 565 566 argc -= optind; 567 argv += optind; 568 569 if ((main_tab = malloc(sizeof(static_main_tab))) == NULL) 570 err(1, NULL); 571 memcpy(main_tab, static_main_tab, sizeof(static_main_tab)); 572 |
573#ifndef RESCUE | 573#ifdef WITH_BSNMP |
574 /* XXX while this is compiled in */ 575 device_register(); 576#endif 577 578 cc = main_tab; 579 i = 0; 580 for (;;) { 581 /* --- 299 unchanged lines hidden --- | 574 /* XXX while this is compiled in */ 575 device_register(); 576#endif 577 578 cc = main_tab; 579 i = 0; 580 for (;;) { 581 /* --- 299 unchanged lines hidden --- |