ed2k for some OSes

ed2k – A program computing eDonkey link (ed2k://), or only the Hash/Id (à la md5).

I first time installed it on FreeBSD (which exists in ports). Later I tried compiling it on OpenSolaris – and it doesn’t work. Lots of errors. The same source code also doesn’t compile in Ubuntu 9.10.

Then I decided to fix it. Changes are:

  • Defined/replaced u_int32_t as uint32_t. The former exists in *BSD and Linux but not SunOS (OpenSolaris). I decided to redefine it to minimize the amount of lines added since, well, they both are basically same thing and the latter works on more platforms.
  • Defined/replaced rindex as strrchr. Same functions but the former is deprecated (according to OpenBSD’s man page).
  • Included stdint.h. Required make the code gcc-4.4 compatible (at least in Ubuntu 9.10).
  • Integrated fixes from FreeBSD’s ports. To remove warnings from all C compilers I tried (suncc, gcc various versions).

Note that it still doesn’t work in Windows (can be compiled with one additional line but ed2k -l produces garbage which I haven’t bothered to find out why). Now it works in Windows.

Here be the fixed version. Still in public domain or whatever. Tried in OpenBSD 4.6 (standard gcc), FreeBSD 7.2-STABLE (standard gcc), OpenSolaris 2009.06 (Sun Studio 12u1, gcc 3.4 (from OpenSolaris’ IPS), Blastwave’s gcc 4.3.4), Ubuntu (Server) 9.10 (standard gcc) and Windows 7 (gcc 3.4.5 and gcc 4.4.0)

[ ed2k.c | patch for original source ]

One thought on “ed2k for some OSes

  1. It’s always a problem compiling anything on OpenSolaris, especially with Oracle Solaris Studio. I believe the biggest problem is quality of code which really compiles smoothly on Linux if the author is a Linux guy for the reason of many gcc-isms. I noticed that all the code released under BSD is way more portable.
    Actually #include and #define are enough to fix most of code but I had a few exceptions. I wish someone could make a guide on compiling open-source programs in OpenSolaris, explaining common errors and solutions. That’s a huge task for me alone but we (the OpenSolaris users) could get together and do it!

Leave a Reply

Your email address will not be published. Required fields are marked *