lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev Patch for mailcap viewer order


From: Klaus Weide
Subject: lynx-dev Patch for mailcap viewer order
Date: Thu, 14 Jan 1999 07:55:32 -0600 (CST)

This patch should apply to 2.8.2dev.13.

* Two new functions in HTList.c to reverse and to combine lists.
* Lynx was using the wrong precedence for entries within a mailcap
  (relative to other entries from the same file): RFC 1524 says
  "The configuration information will be obtained from the FIRST
  matching entry in a mailcap file[...]", but Lynx effectively gave
  precedence to the last match.  Recent Debian packages of lynx have
  had a patch applied to change this, but that patch also seems to
  affect the precedence order relative to viewers defined in other
  places, i.e. lynx.cfg and HTInit.c.  The patch here instead changes
  the precedence of mailcap entries form the same files to RFC-like
  behavior, by reordering the list generated from a mailcap file after
  we have finished reading it in.  It leaves the order relative to
  viewers from other sources unchanged.
  Maybe it should be made configurable whether Lynx's traditional
  precedence or the new one is used; currently there is just a #define
  in HTInit.c which could be changed to revert to traditional behavior.

*** lynx2-8-2.old/WWW/Library/Implementation/HTList.c   Thu Aug  6 07:28:22 1998
--- lynx2-8-2/WWW/Library/Implementation/HTList.c       Sun Jan  3 07:57:18 1999
***************
*** 42,47 ****
--- 42,91 ----
      return;
  }
  
+ /*    Reverse order of elements in list.
+  */
+ PUBLIC HTList * HTList_reverse ARGS1(
+     HTList *,         start)
+ {
+     HTList *cur, *succ;
+     if (!(start && start->next && (cur = start->next->next)))
+       return start;
+     start->next->next = NULL;
+     while (cur) {
+       succ = cur->next;
+       cur->next = start->next;
+       start->next = cur;
+       cur = succ;
+     }
+     return start;
+ }
+ 
+ /*    Append a list to another.
+  *
+  *    If successful, the second list will become empty but not freed.
+  */
+ PUBLIC HTList * HTList_appendList ARGS2(
+     HTList *,         start,
+     HTList *,         tail)
+ {
+     HTList * temp = start;
+ 
+     if (!start) {
+         CTRACE(tfp, "HTList: Trying to append list %p to a nonexisting 
list\n",
+                   tail);
+         return NULL;
+     }
+     if (!(tail && tail->next))
+       return start;
+ 
+     while (temp->next)
+       temp = temp->next;
+ 
+     temp->next = tail->next;
+     tail->next = NULL;                /* tail is now an empty list */
+     return start;
+ }
+ 
  
  /*      Add object to START of list (so it is pointed to by the head).
  */
*** lynx2-8-2.old/WWW/Library/Implementation/HTList.h   Thu Aug  6 07:28:22 1998
--- lynx2-8-2/WWW/Library/Implementation/HTList.h       Sun Jan  3 07:57:46 1999
***************
*** 60,65 ****
--- 60,76 ----
  extern void HTList_delete PARAMS((
        HTList *        me));
  
+ /*    Reverse a list.
+ */
+ extern HTList * HTList_reverse PARAMS((
+       HTList *        start));
+ 
+ /*    Append two lists, making second list empty.
+ */
+ extern HTList * HTList_appendList PARAMS((
+       HTList *        start,
+       HTList *        tail));
+ 
  
  /*      Add object to START of list (so it is pointed to by the head).
  */
*** lynx2-8-2.old/src/HTInit.c  Sun Jan  3 05:36:25 1999
--- lynx2-8-2/src/HTInit.c      Sun Jan  3 06:28:39 1999
***************
*** 647,657 ****
      return(-1);
  }
  
  
  PRIVATE int HTLoadTypesConfigFile ARGS1(
        char *,         fn)
  {
!   return ProcessMailcapFile(fn);
  }
  
  
--- 647,676 ----
      return(-1);
  }
  
+ #define reverse_mailcap 1
  
  PRIVATE int HTLoadTypesConfigFile ARGS1(
        char *,         fn)
  {
!     int result = 0;
!     HTList * saved = HTPresentations;
! 
!     if (reverse_mailcap) {            /* temporarily hide existing list */
!       HTPresentations = NULL;
!     }
! 
!     result = ProcessMailcapFile(fn);
! 
!     if (reverse_mailcap) {
!       if (result && HTPresentations) {
!           HTList_reverse(HTPresentations);
!           HTList_appendList(HTPresentations, saved);
!           FREE(saved);
!       } else {
!           HTPresentations = saved;
!       }
!     }
!     return result;
  }
  
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]