RE: Multi-destiny Traps

Magnus Fromreide <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <1237927560.5572.41.camel@sara>
On Tue, 2009-03-24 at 16:58 +0000, Sergio Cabaço wrote:
> 
> > What O/S is this "unix-based system"?
> 
> It is a sub-module (uses the kernel with some modifications) of LynxOS
> (not all POSIX specifications) and it hasn't getopt available in the
> system.
> 
> > What does "man getopt" report?
> 
> Nothing, it has not man available. It is a very delicate OS :)
> 
> I have encountered net-snmp-config.h that is generated by configure.
> In this file, HAVE_GETOPT_H is defined with value 1. I think if I
> could put it to 0 in configure, this would work just fine.

In order to do it in configure we have to figure out how it differs from
a normal getopt so that it can be tested for. 
Are you cross compiling as well?
 
> Maybe, when putted into 0, this will make no difference but I would
> like to try it.

You could try to run configure and then comment out HAVE_GETOPT_H in
include/net-snmp/net-snmp-config.h

This is actually quite interesting.
>From some surfing on the net I found a manual page for getopt on LynxOS
2.5, that indicates that there is a getopt.

Could you please provide the output of the attached program when run on
LynxOS?

/MF

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
test-getopt.c (text/x-csrc, 589 B)
#include <stdio.h>
#include <getopt.h>

void test(int argc, char* argv[])
{
    int arg;
    const char Opts[] =
	"Y:VhHm:M:O:I:P:D:dv:r:t:c:Z:e:E:n:u:l:x:X:a:A:p:T:-:3:s:S:L:C:";
    optind = 1;
    while((arg = getopt(argc, argv, Opts)) != EOF)
	printf("arg = %c, optind = %d, optarg = %s\n", arg, optind, optarg);
    while(optind < argc) {
	printf("argv[%d] = %s\n", optind, argv[optind]);
	++optind;
    }
}

int main()
{
    char *av[] = { "trapsess", "-v", "3", "-u", "xpto", "-A", "xpto", "-l",
		   "noauthnopriv", "xxx.xxx.xxx.xxx:111", NULL };
    test(10, av);
    return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.