bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/21] find_executable: port to EMX


From: KO Myung-Hun
Subject: [PATCH 07/21] find_executable: port to EMX
Date: Sun, 30 Nov 2014 13:20:09 +0900

* 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]