Hi/2. Bruno Haible wrote: > KO Myung-Hun wrote: >> BTW, do you mean to put URL into a source as a comment ? > > Yes, this is what I mean. Rationale: Most gnulib developers don't > have this reference handy, and a Google search did not provide > the URL that you found. >
Strange. I found this URL by googling. >>> Reliability: Please don't ignore the return value of DosGetInfoBlocks. >>> >> >> DosGetInfoBlocks() returns no values. > > Well, the URL that you showed describes its return value as > "APIRET ulrc; /* Return Code. */" > You should have clicked the link. Then you could see this. ----- ulrc (APIRET) - returns Return Code. DosGetInfoBlocks returns no values. ----- Anyway I added codes to check a return value. > And the code in > http://dennisdarland.com/russell_doc/html/os__dep_8c-source.html > and in > http://cpansearch.perl.org/src/JHI/perl-5.7.1/os2/OS2/Process/Process.xs > do check the return value. > > And http://www.gladir.com/CODER/COS2/dosgetinfoblocks.htm > describes that a return value == NO_ERROR means success. > I think, it means it returns only 0. > Even when (or especially when) you don't know under which conditions a > system function can fail, you should check its return value. Code that > does not follow this policy becomes unreliable and undebuggable, in the long > run. > Absolutely. -- KO Myung-Hun Using Mozilla SeaMonkey 2.7.2 Under OS/2 Warp 4 for Korean with FixPak #15 In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
>From e0c96755bd69ced4cfaaed608460d86d35791e7a Mon Sep 17 00:00:00 2001 From: KO Myung-Hun <k...@chollian.net> Date: Tue, 30 Apr 2013 22:01:05 +0900 Subject: [PATCH] find_executable: port to EMX * lib/progreloc.c (find_executable): Implement on EMX. --- lib/progreloc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/progreloc.c b/lib/progreloc.c index 3d7b6a9..73d4abb 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -44,6 +44,11 @@ # include <windows.h> #endif +#ifdef __EMX__ +# define INCL_DOS +# include <os2.h> +#endif + #include "relocatable.h" #ifdef NO_XMALLOC @@ -157,6 +162,23 @@ find_executable (const char *argv0) /* Shouldn't happen. */ return NULL; return xstrdup (location); +#elif defined __EMX__ + PPIB ppib; + char location[CCHMAXPATH]; + + /* See http://cyberkinetica.homeunix.net/os2tk45/cp1/619_L2H_DosGetInfoBlocksSynt.html + for specifications of DosGetInfoBlocks(). */ + if (DosGetInfoBlocks (NULL, &ppib)) + return NULL; + + /* See http://cyberkinetica.homeunix.net/os2tk45/cp1/1247_L2H_DosQueryModuleNameSy.html + for specifications of DosQueryModuleName(). */ + if (DosQueryModuleName (ppib->pib_hmte, sizeof (location), location)) + return NULL; + + _fnslashify (location); + + return xstrdup (location); #else /* Unix */ # ifdef __linux__ /* The executable is accessible as /proc/<pid>/exe. In newer Linux -- 1.8.5.2