summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--dpid/Makefile.am3
-rw-r--r--dpid/dpid.c20
-rw-r--r--dpid/dpidrc.in6
4 files changed, 22 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ef21bf61..ba0fb951 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,6 +60,7 @@ dillo-3.1 [not released yet]
- Expand home tilde '~' in the file plugin.
- Ignore width attribute with relative values for td and th elements.
- Enable Doxygen for C files and use Awesome Doxygen theme.
+ - Fix DPIs extension (.dpi.exe) in Windows systems via Cygwin.
Patches: Rodrigo Arias Mallo <rodarima@gmail.com>
-----------------------------------------------------------------------------
diff --git a/dpid/Makefile.am b/dpid/Makefile.am
index a59fa083..7f8e751e 100644
--- a/dpid/Makefile.am
+++ b/dpid/Makefile.am
@@ -1,5 +1,6 @@
AM_CPPFLAGS = \
-I$(top_srcdir) \
+ -DEXEEXT='"$(EXEEXT)"' \
-DDPIDRC_SYS='"$(sysconfdir)/dpidrc"'
bin_PROGRAMS = dpid dpidc
@@ -31,5 +32,5 @@ sysconf_DATA = dpidrc
CLEANFILES = $(sysconf_DATA)
dpidrc: $(srcdir)/dpidrc.in Makefile
- sed -e 's|[@]libdir[@]|$(libdir)|' $(srcdir)/dpidrc.in > dpidrc
+ sed -e 's|[@]libdir[@]|$(libdir)|;s|[@]EXEEXT[@]|$(EXEEXT)|g' $(srcdir)/dpidrc.in > dpidrc
diff --git a/dpid/dpid.c b/dpid/dpid.c
index 21e33bf2..06ae86b7 100644
--- a/dpid/dpid.c
+++ b/dpid/dpid.c
@@ -36,6 +36,8 @@
#include "../dpip/dpip.h"
+#define DPI_EXT (".dpi" EXEEXT)
+
#define QUEUE 5
volatile sig_atomic_t caught_sigchld = 0;
@@ -140,16 +142,26 @@ void est_dpi_terminator()
}
}
+static int ends_with(const char *str, const char *suffix)
+{
+ if (!str || !suffix)
+ return 0;
+ size_t lenstr = strlen(str);
+ size_t lensuffix = strlen(suffix);
+ if (lensuffix > lenstr)
+ return 0;
+ return strncmp(str + lenstr - lensuffix, suffix, lensuffix) == 0;
+}
+
/*! Identify a given file
* Currently there is only one file type associated with dpis.
* More file types will be added as needed
*/
enum file_type get_file_type(char *file_name)
{
- char *dot = strrchr(file_name, '.');
-
- if (dot && !strcmp(dot, ".dpi"))
- return DPI_FILE; /* Any filename ending in ".dpi" */
+ if (ends_with(file_name, DPI_EXT))
+ /* Any filename ending in ".dpi" (or ".dpi.exe" on Windows) */
+ return DPI_FILE;
else {
MSG_ERR("get_file_type: Unknown file type for %s\n", file_name);
return UNKNOWN_FILE;
diff --git a/dpid/dpidrc.in b/dpid/dpidrc.in
index b16f9b56..f0e69a0f 100644
--- a/dpid/dpidrc.in
+++ b/dpid/dpidrc.in
@@ -1,5 +1,5 @@
dpi_dir=@libdir@/dillo/dpi
-proto.file=file/file.dpi
-proto.ftp=ftp/ftp.filter.dpi
-proto.data=datauri/datauri.filter.dpi
+proto.file=file/file.dpi@EXEEXT@
+proto.ftp=ftp/ftp.filter.dpi@EXEEXT@
+proto.data=datauri/datauri.filter.dpi@EXEEXT@