From: Pali Rohár Date: Fri, 18 Nov 2022 20:57:50 +0000 (+0100) Subject: libpci: djgpp: Allow to specify empty IDSDIR= X-Git-Tag: v3.10.0~14^2~3 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=43fd29c72dea38d080be5681056b6a9e536e590b;p=pciutils.git 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= --- 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 /* for __dos_argv0 */ +#endif + #ifdef PCI_OS_WINDOWS #include @@ -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));