summaryrefslogtreecommitdiff
path: root/gettext-tools/gnulib-lib/progreloc.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-12-28 00:06:36 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-12-28 00:06:36 +0000
commit6eb5949dd99d174393465069c2fd0bab32deddcc (patch)
treed104f72ac2dcb0f592b1c8e06a5af6790bd4080c /gettext-tools/gnulib-lib/progreloc.c
parent482840e61f86ca321838a91e902c41d40c098bbb (diff)
downloadgettext-tarball-6eb5949dd99d174393465069c2fd0bab32deddcc.tar.gz
gettext-0.19.7gettext-0.19.7
Diffstat (limited to 'gettext-tools/gnulib-lib/progreloc.c')
-rw-r--r--gettext-tools/gnulib-lib/progreloc.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gettext-tools/gnulib-lib/progreloc.c b/gettext-tools/gnulib-lib/progreloc.c
index 3d7b6a9..1d2b4b3 100644
--- a/gettext-tools/gnulib-lib/progreloc.c
+++ b/gettext-tools/gnulib-lib/progreloc.c
@@ -1,5 +1,5 @@
/* Provide relocatable programs.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or modify
@@ -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 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