[w3m-dev-en 00223] Patch for cygwin compile

From: Doug Kaufman (dkaufman@rahul.net)
Date: Sat Sep 23 2000 - 22:08:23 CDT

  • Next message: Ken Yap: "[w3m-dev-en 00225] Re: Patch for cygwin compile"

    I just built w3m version 0.1.11-tb6 with cygwin 1.1.4 and
    ncurses 5.1. In addition to the problem with the makefile that I
    previously reported (need to remove "-lm"), configure doesn't get
    the proper values for SIGNAL_ARG and SIGNAL_ARGLIST if CFLAGS are
    set to -O2 -W -Wall, although it does when left with the default -O.
    Similarly, it defines INET6 with the first set of options (incorrect),
    but not with the latter. I am not very good with configure scripts so
    someone else may have to look at that.

    The following patch allows w3m to show the screen properly, even
    with BG_COLOR set, and allows navigation through local files, even
    when there are spaces in the directory and file names. I am not a
    programmer, so someone may want to clean this up, but it seems to
    work. I IFDEF'd the changes with __CYGWIN__, but some of the changes
    may apply to other platforms. I haven't had a chance yet to compile
    for DOS under DJGPP, but I suspect that at least the change with the
    space in the href will also need to be appllied there, since DJGPP
    programs use the Window LFN API under Win9x (but not WinNT).

    By the way, has anyone succeeded in porting w3m to DJGPP without the
    use of ncurses? I seem to remember failing when I tried with SLang and
    with PDCurses. These two libraries are readily available for DJGPP.
    Compiling ncurses under DJGPP with an 8+3 filesystem wasn't fun, since
    the filenames in the package aren't unique under 8+3. I got a working
    w3m for DOS, however (older version of w3m).

    Patch is in "diff -u" format. I hope that is OK.
                                Doug

    --- w3m/cookie.c Thu Jul 13 11:42:24 2000
    +++ w3m/cookie.c.new Sat Sep 23 19:27:02 2000
    @@ -238,7 +238,11 @@
                 if (p1)
                     continue;
                 p1 = New(struct cookie);
    +#ifdef __CYGWIN__
    + bcopy((const char *)p, (char *)p1, sizeof(struct cookie));
    +#else
                 bcopy(p, p1, sizeof(struct cookie));
    +#endif
                 p1->next = fco;
                 fco = p1;
                 if (p1->version > version)
    --- w3m/file.c Thu Jul 13 11:42:24 2000
    +++ w3m/file.c.new Sat Sep 23 19:21:34 2000
    @@ -1553,7 +1553,11 @@
     
             if (obuf->bp.pos == obuf->pos && tp <= ep &&
                 tp > obuf->line->ptr && tp[-1] == ' ') {
    +#ifdef __CYGWIN__
    + bcopy((const char *)tp, (char *)(tp - 1), ep - tp + 1);
    +#else
                 bcopy(tp, tp - 1, ep - tp + 1);
    +#endif /* __CYGWIN__ */
                 obuf->line->length--;
                 obuf->pos--;
             }
    @@ -1720,8 +1724,13 @@
         }
         if (i >= 0) {
             obuf->tag_sp--;
    +#ifdef __CYGWIN__
    + bcopy((const char *)(&obuf->tag_stack[i + 1]), (char *)(&obuf->tag_stack[i]),
    + (obuf->tag_sp - i) * sizeof(struct cmdtable *));
    +#else
             bcopy(&obuf->tag_stack[i + 1], &obuf->tag_stack[i],
                   (obuf->tag_sp - i) * sizeof(struct cmdtable *));
    +#endif /* __CYGWIN__ */
             return 1;
         }
         else if ((p = has_hidden_link(obuf, cmd)) != NULL) {
    @@ -1750,8 +1759,13 @@
                 else {
                     if (i >= 0) {
                         obuf->tag_sp--;
    +#ifdef __CYGWIN__
    + bcopy((const char *)(&obuf->tag_stack[i + 1]), (char *)&obuf->tag_stack[i],
    + (obuf->tag_sp - i) * sizeof(struct cmdtable *));
    +#else
                         bcopy(&obuf->tag_stack[i + 1], &obuf->tag_stack[i],
                               (obuf->tag_sp - i) * sizeof(struct cmdtable *));
    +#endif /* __CYGWIN__ */
                     }
                     else {
                         passthrough(obuf, p, 1);
    @@ -1767,8 +1781,13 @@
     save_fonteffect(struct html_feed_environ *h_env, struct readbuffer *obuf)
     {
         if (obuf->fontstat_sp < FONT_STACK_SIZE)
    +#ifdef __CYGWIN__
    + bcopy((const char *)(obuf->fontstat), (char *)(obuf->fontstat_stack[obuf->fontstat_sp]),
    + FONTSTAT_SIZE);
    +#else
             bcopy(obuf->fontstat, obuf->fontstat_stack[obuf->fontstat_sp],
                   FONTSTAT_SIZE);
    +#endif /* __CYGWIN__ */
         obuf->fontstat_sp++;
         if (obuf->in_bold)
             push_tag(obuf, "</b>", HTML_N_B);
    @@ -1783,8 +1802,13 @@
         if (obuf->fontstat_sp > 0)
             obuf->fontstat_sp--;
         if (obuf->fontstat_sp < FONT_STACK_SIZE)
    +#ifdef __CYGWIN__
    + bcopy((const char *)(obuf->fontstat_stack[obuf->fontstat_sp]), (char *)(obuf->fontstat),
    + FONTSTAT_SIZE);
    +#else
             bcopy(obuf->fontstat_stack[obuf->fontstat_sp], obuf->fontstat,
                   FONTSTAT_SIZE);
    +#endif /* __CYGWIN__ */
         if (obuf->in_bold)
             push_tag(obuf, "<b>", HTML_B);
         if (obuf->in_under)
    @@ -3654,7 +3678,11 @@
                                           pos);
                         if (p) {
                             effect |= PE_ANCHOR;
    +#ifdef __CYGWIN__
    + a_href = registerHref(buf, p, q, r, currentLn(buf), pos);
    +#else
                             a_href = registerHref(buf, remove_space(p), q, r, currentLn(buf), pos);
    +#endif /* __CYGWIN__ */
                             a_href->hseq = ((hseq > 0) ? hseq : -hseq) - 1;
                         }
                         break;
    @@ -4412,7 +4440,11 @@
             l->lineBuf = NullLine;
             l->propBuf = NullProp;
         }
    +#ifdef __CYGWIN__
    + bcopy((const char *) prop, (char *) l->propBuf, pos * sizeof(Lineprop));
    +#else
         bcopy((void *) prop, (void *) l->propBuf, pos * sizeof(Lineprop));
    +#endif /* __CYGWIN__ */
         l->len = pos;
         l->prev = buf->currentLine;
         if (buf->currentLine) {
    @@ -5296,7 +5328,11 @@
             l = New(Line);
             l->lineBuf = lineBuf2->ptr;
             l->propBuf = New_N(Lineprop, len);
    +#ifdef __CYGWIN__
    + bcopy((const char *) propBuffer, (char *) l->propBuf, len * sizeof(Lineprop));
    +#else
             bcopy((void *) propBuffer, (void *) l->propBuf, len * sizeof(Lineprop));
    +#endif /* __CYGWIN__ */
             l->len = len;
             l->prev = pl;
             if (squeezeBlankLine) {
    --- w3m/terms.c Mon Jul 10 15:19:20 2000
    +++ w3m/terms.c.new Sat Sep 23 17:43:36 2000
    @@ -1065,10 +1065,10 @@
                      * avoid the scroll, I prohibit to draw character on
                      * (COLS-1,LINES-1).
                      */
    -#ifndef BG_COLOR
    +#if !defined(BG_COLOR) || defined(__CYGWIN__)
                     if (line == LINES - 1 && col == COLS - 1)
                         break;
    -#endif /* not BG_COLOR */
    +#endif /* not BG_COLOR || CYGWIN */
                     if ((!(pr[col] & S_STANDOUT) && (mode & S_STANDOUT)) ||
                         (!(pr[col] & S_UNDERLINE) && (mode & S_UNDERLINE)) ||
                         (!(pr[col] & S_BOLD) && (mode & S_BOLD)) ||

    __
    Doug Kaufman
    Internet: dkaufman@rahul.net



    This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 23:30:53 CDT