* lib/progreloc.c (find_executable): Implement on EMX. --- lib/progreloc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/lib/progreloc.c b/lib/progreloc.c index 3d7b6a9..5b9e247 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -44,6 +44,12 @@ # include <windows.h> #endif +#ifdef __EMX__ +# define INCL_DOS +# include <os2.h> +#endif + + #include "relocatable.h" #ifdef NO_XMALLOC @@ -157,6 +163,18 @@ find_executable (const char *argv0) /* Shouldn't happen. */ return NULL; return xstrdup (location); +#elif defined __EMX__ + PPIB ppib; + char location[CCHMAXPATH]; + + DosGetInfoBlocks (NULL, &ppib); + + 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