[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/21] get_shared_library_fullname: port to EMX
From: |
KO Myung-Hun |
Subject: |
[PATCH 08/21] get_shared_library_fullname: port to EMX |
Date: |
Sun, 30 Nov 2014 13:20:10 +0900 |
* lib/relocatable.c: Define strcmp and strncmp to stricmp and strnicmp
on EMX, respectively.
(_DLL_InitTerm): New on EMX.
(get_shared_library_fullname): Implement on EMX.
---
lib/relocatable.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
diff --git a/lib/relocatable.c b/lib/relocatable.c
index 81dcaeb..c48ed1c 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -47,6 +47,14 @@
# include <windows.h>
#endif
+#ifdef __EMX__
+# define INCL_DOS
+# include <os2.h>
+
+#define strcmp stricmp
+#define strncmp strnicmp
+#endif
+
#if DEPENDS_ON_LIBCHARSET
# include <libcharset.h>
#endif
@@ -335,6 +343,43 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID
reserved)
return TRUE;
}
+#elif defined __EMX__
+
+extern int _CRT_init (void);
+extern void _CRT_term (void);
+extern void __ctordtorInit (void);
+extern void __ctordtorTerm (void);
+
+unsigned long _System
+_DLL_InitTerm (unsigned long hModule, unsigned long ulFlag)
+{
+ static char location[CCHMAXPATH];
+
+ switch (ulFlag)
+ {
+ case 0:
+ if (_CRT_init () == -1)
+ return 0;
+
+ __ctordtorInit();
+
+ if (DosQueryModuleName (hModule, sizeof (location), location))
+ return 0;
+
+ _fnslashify (location);
+ shared_library_fullname = strdup (location);
+ break;
+
+ case 1:
+ __ctordtorTerm();
+
+ _CRT_term ();
+ break;
+ }
+
+ return 1;
+}
+
#else /* Unix */
static void
@@ -390,15 +435,15 @@ find_shared_library_fullname ()
#endif
}
-#endif /* Native Windows / Unix */
+#endif /* Native Windows / EMX / Unix */
/* Return the full pathname of the current shared library.
Return NULL if unknown.
- Guaranteed to work only on Linux, Cygwin, and native Windows. */
+ Guaranteed to work only on Linux, EMX, Cygwin, and native Windows. */
static char *
get_shared_library_fullname ()
{
-#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) &&
!defined __EMX__
static bool tried_find_shared_library_fullname;
if (!tried_find_shared_library_fullname)
{
--
1.8.5.2
- [PATCH 02/21] gnulib-tool: recognize x:* as an absolute path, (continued)
- [PATCH 02/21] gnulib-tool: recognize x:* as an absolute path, KO Myung-Hun, 2014/11/30
- [PATCH 04/21] stdint: typedef gl_intptr_t and gl_uintptr_t correctly on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 05/21] spawn: do not include sched.h on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 06/21] Fix character encoding aliases for OS/2, KO Myung-Hun, 2014/11/30
- [PATCH 07/21] find_executable: port to EMX, KO Myung-Hun, 2014/11/30
- [PATCH 08/21] get_shared_library_fullname: port to EMX,
KO Myung-Hun <=
- [PATCH 09/21] relocatable: support UNIXROOT in relocate() on EMX, KO Myung-Hun, 2014/11/30
- [PATCH 12/21] pipe_filter_ii_execute: port to OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 10/21] binary-io: put fd in binary mode if it is not a console on EMX, KO Myung-Hun, 2014/11/30
- [PATCH 11/21] pipe-filter-aux: undefine HAVE_SELECT on KLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 14/21] getdtablesize: do not use getrlimit() on OS/2 kLIBC, KO Myung-Hun, 2014/11/30