aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Another portability issue (fixing under test)  (Read 4468 times)

Gaznevada

  • Jr. Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 51
Another portability issue (fixing under test)
« on: June 05, 2008, 03:55:57 PM »

CVS 20080604

src/utils/cas/cas.c

getopt.h 'long_options' are used, not defined in all unices
(I'm talking about IRIX but I'm afraid the same holds for
all unices without glibc. Fix me if I'm wrong).

A quick-and-dirty fix is to simplify the source trimming
down all the 'long_options' calls.

Just to spotlight a potential problem.
A fix for IRIX  using standard 'getopt' is under testing.

Cheers

--
Gaznevada


Logged
--
"Orwell was an optimist" - Usenet, somewhere.

Gaznevada

  • Jr. Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 51
Re: Another portability issue (fixing under test)
« Reply #1 on: June 07, 2008, 12:21:11 AM »

Ugly and dirty patch. In short:

- remove the structure "static struct option long_options[]"
from cas.c,

- change
while ((c = getopt_long (argc, argv, "c:P:H:hpo", long_options, NULL)) != -1)
into a poorman
while ((c = getopt (argc, argv, "c:P:H:hpo")) != -1)

- edit the  usage() accordingly.

It works. wxCas needs no changes at all.

Now I think that aMule is fully functional on IRIX. For the two of
us still using IRIX, I mean.

Cheers.

--
Gaznevada
Logged
--
"Orwell was an optimist" - Usenet, somewhere.

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Another portability issue (fixing under test)
« Reply #2 on: June 07, 2008, 12:23:23 PM »

I won't commit the cas.c patch because it is a regression for all users while only benefiting few people. I have however added this information to the wiki page about aMule compilation on IRIX, therefore it will be easy for everyone to patch the file. :)

Thanks a lot for helping to make aMule compatible to more platforms!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Another portability issue (fixing under test)
« Reply #3 on: June 07, 2008, 03:28:52 PM »

Isn't there some #ifdef IRIX which could be used ?
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Gaznevada

  • Jr. Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 51
Re: Another portability issue (fixing under test)
« Reply #4 on: June 07, 2008, 03:34:10 PM »

I won't commit the cas.c patch because it is a regression for all users while only benefiting few people. I have however added this information to the wiki page about aMule compilation on IRIX, therefore it will be easy for everyone to patch the file. :)

I think this would be the best solution. "Few people": you are definitely right  ;D

Thanks a lot for helping to make aMule compatible to more platforms!

You're welcome. It was quite amusing making come back from the dead an old IRIX O2.
Now is my aMule server 24/7, not to mention that IRIX has top-ranking uptime  :D

Cheers

--
Gaznevada
Logged
--
"Orwell was an optimist" - Usenet, somewhere.

Gaznevada

  • Jr. Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 51
Re: Another portability issue (fixing under test)
« Reply #5 on: June 07, 2008, 04:02:59 PM »

Isn't there some #ifdef IRIX which could be used ?

Yes. The standard clause is

#ifdef (__mips__) 

but I think the problem is more general: how many architectures are there out there not supporting
long options in getopt? Quckly the clause will become something like

#if defined (__mips__) || defined (__hpux__) || defined(_some_other_exotic_unix_flavor__) || ...

only to fix a little bit more than two lines of code. There is a similar situation in
php_syntree.h and PRIu64: you have to check if PRIu64 is defined or not an then
tell if the CPU is a 32- or 64-bit. My proposed patch heavily relies on MIPS/IRIX and
I think is qute dangerous and not satisfacting as well.

It's worth to check all the unices for just two lines? So I think the best solution is to
leave the original code untouched and write a wiki-HOWTO explaining the modifications, maybe
with a patchfile along with the final distribution. IMHO.

My one cent and a half.

Cheers

--
Gaznevada

Logged
--
"Orwell was an optimist" - Usenet, somewhere.

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Another portability issue (fixing under test)
« Reply #6 on: June 07, 2008, 09:46:55 PM »

It's worth to check all the unices for just two lines? So I think the best solution is to
leave the original code untouched and write a wiki-HOWTO explaining the modifications, maybe
with a patchfile along with the final distribution. IMHO.

You're wrong. The best solution is to make configure check for getopt_long() and PRIu64, which is what I'll do.
Logged
concordia cum veritate

Gaznevada

  • Jr. Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 51
Re: Another portability issue (fixing under test)
« Reply #7 on: June 08, 2008, 02:01:50 AM »

You're wrong. The best solution is to make configure check for getopt_long() and PRIu64, which is what I'll do.

It wouldn't be the first time I'm wrong.  And it will not be the last one, I'm afraid...

Cheers

--
Gaznevada


Logged
--
"Orwell was an optimist" - Usenet, somewhere.

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Another portability issue (fixing under test)
« Reply #8 on: June 08, 2008, 11:19:13 PM »

Don't feel sad about it. It may turn out that I was wrong either. ;)
Logged
concordia cum veritate