0

I've just compiled w3m for the Windows using TDM-GCC compiler but after running it it gives:

$ w3m
Can't create config directory (~C:/msys32/.w3m)!Can't find termcap entry xterm-256color

On my computer there is C:/msys32 and, I'm using C:/msys32/usr/bin/sh.exe as the shell on ConEmu Terminal Emulator.

$ echo ~/ 

prints /home/myusername

I've tried configuring w3m with the sysconfdir option like

 ./configure --sysconfdir=/etc

but whatever option I gave to the --sysconfdir, had no effect on the result.

I've taken a look at the config.log file, searched for .w3m seen this line:

RC_DIR='~/.w3m'

Obviously, w3m is adding C:/msys32 to it so it prints ~C:/msys32/.w3m

How can I fix that? Thank you.

Terry
  • 1,206
  • 1
  • 10
  • 26

1 Answers1

0

Well I solved it.

First, I searched for the binaries where that incorrect path was being included:

$ egrep -ir "~C:/msys32" .

Several binaries included that. But one of them included the origin of the erroneous operation, it was indep.c and the function named "expandPath" was producing that erronous path. As a quick and dirty hack, I have modified the part causing the error, here is the patch:

--- indep_orig.c    2016-10-08 12:39:43.656250000 +0300
+++ indep.c 2016-10-07 19:50:18.812500000 +0300
@@ -69,6 +69,7 @@
 }

 #ifndef HAVE_BCOPY
+/*
 void
 bcopy(const void *src, void *dest, int len)
 {
@@ -79,12 +80,12 @@
    for (i = len - 1; i >= 0; i--)
        ((char *)dest)[i] = ((const char *)src)[i];
     }
-    else {         /* src > dest */
+    else {         // src > dest 
    for (i = 0; i < len; i++)
        ((char *)dest)[i] = ((const char *)src)[i];
     }
 }
-
+*/
 void
 bzero(void *ptr, int len)
 {
@@ -246,12 +247,15 @@
      if (*p == '/' || *p == '\0') {    /* ~/dir... or ~ */
        extpath = Strnew_charp(getenv("HOME"));
    }
-   else
-       goto rest;
+     else
+         {  extpath = Strnew_charp(getenv("HOME"));
+        return extpath->ptr;
+         }
+   /*      goto rest;
    if (Strcmp_charp(extpath, "/") == 0 && *p == '/')
        p++;
    Strcat_charp(extpath, p);
-   return extpath->ptr;
+   return extpath->ptr; */
     }
   rest:
     return name;
Terry
  • 1,206
  • 1
  • 10
  • 26