pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Getting net/cdpd to work on aarch64



Hello,

I'm trying to get net/cdpd working on an ARM board running NetBSD 9.3/aarch64. Currently in runs fine on i386/amd64, but exits immediately on arm. It turns out that this simple looking bit of code is what's causing problems on ARM (the problem also exists for 32bit arm):


      while((c=getopt(argc,argv,"i:dt:hoa"))!=EOF) {
        switch(c) {
                case 'd': debug++;
                        break;
                case 'i':
                        cdp_interface_add(&ifaces,optarg);
                        ininited++;
                        break;
                case 't': timeout=atoi(optarg);
                        if(timeout<=0) {
                                printf("wrong value to timeout - reverting to default 60 sec\n");
                                timeout=60;
                        };
                        break;
                case 'o': once=1;
                        break;
                case 'a': allfaces=1;
                        break;
                default: usage();
                        exit(1);
        };
        };


Long story short, it looks like getopt is returning 255 after parsing the arguments, so changing the top line to "while((c=getopt(argc,argv,"i:dt:hoa"))!=255" makes things work now on arm. But the same change causes the amd64 version to fail because on amd64 getopt returns -1 when done. I'm a very poor c programmer so I'm hoping someone can figure out how to fix things so cdpd runs on both x86 and arm architectures.

Thanks,

Jason M.



Home | Main Index | Thread Index | Old Index