[prev in list] [next in list] [prev in thread] [next in thread]
List: opennms-cvs
Subject: [opennms-cvs] SF.net SVN: opennms: [6322]
From: rangerrick () users ! sourceforge ! net
Date: 2007-05-31 17:54:05
Message-ID: E1Htoqb-00024D-Gd () sc8-pr-svn3 ! sourceforge ! net
[Download RAW message or body]
Revision: 6322
http://svn.sourceforge.net/opennms/?rev=6322&view=rev
Author: rangerrick
Date: 2007-05-31 10:54:04 -0700 (Thu, 31 May 2007)
Log Message:
-----------
thanks brozow for fixing my awful c usage
Modified Paths:
--------------
opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/configure.in
opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/src/mib2opennms.c
Modified: opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/configure.in
===================================================================
--- opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/configure.in 2007-05-31 \
16:55:19 UTC (rev 6321)
+++ opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/configure.in 2007-05-31 \
17:54:04 UTC (rev 6322) @@ -1,5 +1,5 @@
AC_INIT(src/mib2opennms.c)
-AM_INIT_AUTOMAKE(mib2opennms,0.2.2)
+AM_INIT_AUTOMAKE(mib2opennms,0.2.3)
AM_CONFIG_HEADER(src/config.h)
dnl find and test the C compiler
Modified: opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/src/mib2opennms.c
===================================================================
--- opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/src/mib2opennms.c 2007-05-31 \
16:55:19 UTC (rev 6321)
+++ opennms/trunk/opennms-daemon/src/main/resources/contrib/mib2opennms/src/mib2opennms.c 2007-05-31 \
17:54:04 UTC (rev 6322) @@ -34,6 +34,7 @@
int verbosity = 0;
int generic6 = 0;
+int wrapevents = 0;
#define verbose(level, ...) \
if( (level) <= verbosity ) { \
@@ -100,6 +101,9 @@
smiNode = smiGetFirstNode(smiModule, SMI_NODEKIND_NOTIFICATION);
fprintf(file, "<!-- Start of auto generated data from MIB: %s -->\n", \
smiModule->name); + if (wrapevents) {
+ fprintf(file, "<events>\n");
+ }
for(; smiNode; smiNode = smiGetNextNode(smiNode, SMI_NODEKIND_NOTIFICATION) )
{
@@ -166,14 +170,18 @@
fprintf(file, "</event>\n");
}
+ if (wrapevents) {
+ fprintf(file, "</events>\n");
+ }
fprintf(file, "<!-- End of auto generated data from MIB: %s -->\n",
smiModule->name);
}
void usage() {
fprintf(stderr,
- "Usage: mib2opennms [-v] [-f file] [-m MIBPATH] MIB1 [MIB2 [...]] [-6]\n"\
- " -6 - hardcode generic to 6\n"
+ "Usage: mib2opennms [-v] [-f file] [-m MIBPATH] [-6] [-w] MIB1 [MIB2 [...]]\n"\
+ " -6 - hardcode generic to 6\n"\
+ " -w - wrap event in <events> tag\n"
);
exit(1);
}
@@ -186,7 +194,10 @@
char* modulename;
char* filename = NULL;
+
+ char* STANDARD_PATH = ".:/usr/share/snmp/mibs";
char* mibpath = NULL;
+ int pathlen = 0;
FILE* file = stdout;
@@ -195,9 +206,9 @@
EventDefaults* defaults = NULL;
- printf("mib2opennms version %s\n", VERSION);
+ fprintf(stderr, "mib2opennms version %s\n", VERSION);
- while ( (c = getopt(argc, argv, "m:f:v:6")) != -1 ) {
+ while ( (c = getopt(argc, argv, "m:f:v:6w")) != -1 ) {
switch (c) {
case 'm' :
mibpath = optarg;
@@ -211,6 +222,9 @@
case '6' :
generic6++;
break;
+ case 'w' :
+ wrapevents++;
+ break;
default :
usage();
}
@@ -222,13 +236,19 @@
smiInit(NULL);
+ pathlen = strlen(STANDARD_PATH) + (mibpath == NULL ? 0 : strlen(mibpath)+1 /* for \
the colon */); +
+ char * newpath = (char *) malloc( pathlen * sizeof(char) );
+ newpath[0] = '\0';
+
if (mibpath != NULL) {
- strcat(mibpath, ".:/usr/share/snmp/mibs\0");
- } else {
- mibpath = ".:/usr/share/snmp/mibs";
+ strcat(newpath, mibpath);
+ strcat(newpath, ":");
}
+
+ strcat(newpath, STANDARD_PATH);
- smiSetPath(mibpath);
+ smiSetPath(newpath);
modules = (SmiModule **) malloc( argc * sizeof(SmiModule *));
moduleCount = 0;
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic