summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-11-18 21:57:50 +0100
committerPali Rohár <pali@kernel.org>2022-11-18 21:57:50 +0100
commit43fd29c72dea38d080be5681056b6a9e536e590b (patch)
treeb1fea2e87753d52aecff4c6daa5491bc663bb4fe
parenta7a7aaeaa9feca5377a0da891d2d444db20cdb7d (diff)
downloadpciutils-43fd29c72dea38d080be5681056b6a9e536e590b.tar.gz
libpci: djgpp: Allow to specify empty IDSDIR=
Like for windows builds this will cause to load pci.ids file from the same directory where is stored application binary. Code is same as for Windows, just djgpp uses global symbol __dos_argv0 instead of _pgmptr. Tested with following compile command: make CROSS_COMPILE=i586-pc-msdosdjgpp- HOST=i586-djgpp ZLIB=no DNS=no IDSDIR=
-rw-r--r--lib/init.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/init.c b/lib/init.c
index 590dfb4..8c8f973 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -13,6 +13,10 @@
#include "internal.h"
+#ifdef PCI_OS_DJGPP
+#include <crt0.h> /* for __dos_argv0 */
+#endif
+
#ifdef PCI_OS_WINDOWS
#include <windows.h>
@@ -262,7 +266,7 @@ pci_get_method_name(int index)
return pci_methods[index]->name;
}
-#ifdef PCI_OS_WINDOWS
+#if defined(PCI_OS_WINDOWS) || defined(PCI_OS_DJGPP)
static void
pci_init_name_list_path(struct pci_access *a)
@@ -274,7 +278,7 @@ pci_init_name_list_path(struct pci_access *a)
char *path, *sep;
size_t len;
-#if defined(_WIN32) || defined(_WINDLL) || defined(_WINDOWS)
+#if defined(PCI_OS_WINDOWS) && (defined(_WIN32) || defined(_WINDLL) || defined(_WINDOWS))
HMODULE module;
size_t size;
@@ -309,11 +313,15 @@ retry:
else if (len == 0)
path[0] = '\0';
-#else
+#elif defined(PCI_OS_DJGPP) || defined(PCI_OS_WINDOWS)
const char *exe_path;
+#ifdef PCI_OS_DJGPP
+ exe_path = __dos_argv0;
+#else
exe_path = _pgmptr;
+#endif
len = strlen(exe_path);
path = pci_malloc(a, len+sizeof(PCI_IDS));