Mercurial > gnulib
changeset 37504:12811854baf7
find_executable: port to EMX
* lib/progreloc.c (find_executable): Implement on EMX.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | KO Myung-Hun <komh78@gmail.com> |
---|---|
date | Wed, 03 Dec 2014 16:02:50 +0900 |
parents | d78370899111 |
children | 1aaefe261baa |
files | ChangeLog lib/progreloc.c |
diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Dec 04 10:03:34 2014 +0900 +++ b/ChangeLog Wed Dec 03 16:02:50 2014 +0900 @@ -1,5 +1,8 @@ 2014-12-08 KO Myung-Hun <komh78@gmail.com> + find_executable: port to EMX + * lib/progreloc.c (find_executable): Implement on EMX. + sched: check struct sched_param in spawn.h as well * lib/sched.in.h: Include spawn.h on kLIBC. * lib/sched_h.m4: Check struct sched_param in spawn.h as well.
--- a/lib/progreloc.c Thu Dec 04 10:03:34 2014 +0900 +++ b/lib/progreloc.c Wed Dec 03 16:02:50 2014 +0900 @@ -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 @@ /* 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 specification of DosGetInfoBlocks(). */ + if (DosGetInfoBlocks (NULL, &ppib)) + return NULL; + + /* See http://cyberkinetica.homeunix.net/os2tk45/cp1/1247_L2H_DosQueryModuleNameSy.html + for specification 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