lynx-dev
[Top][All Lists]
Advanced

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

Re: [Lynx-dev] ANN: lynx2.9.0dev.7


From: Steffen Nurpmeso
Subject: Re: [Lynx-dev] ANN: lynx2.9.0dev.7
Date: Tue, 27 Jul 2021 16:04:12 +0200
User-agent: s-nail v14.9.22-173-g196623ce38

Gisle Vanem wrote in
 <044e3e1e-d399-db71-1ed2-272796ae9e98@gmail.com>:
 |> * modify SGML parsing to allow DEL and INS tags to work on a block-level \
 |> rather
 |>    than only inline (Debian #981351) -TD
 |> * modify configure script to check for libidn2, add options menu \
 |> setting for
 |
 |Tried building with 'libidn':
 |   WWW/Library/Implementation/HTParse.c(29): fatal error C1083:
 |   Cannot open include file: 'idn2.h': No such file or directory
 |
 |There is no 'idn2.h' in libidna. But including
 |'idna.h + 'idn-free.h' works.
 |
 |But then this error too:
 |   WWW/Library/Implementation/HTParse.c(340):
 |   error C2065: 'IDN2_OK': undeclared identifier

Heck there is also idnkit 1 + 2, and i also felt it is a pity
noone uses it!
My MUA can (should be able to) use idnkit 1 + 2, libidn and
libidn2, though the new versions of the latter two have not been
tested yet.  Also i did not know about the bugs the lynx code
mentioned for elder libidn2 implementations!

  #ifdef mx_HAVE_IDNA
  # if mx_HAVE_IDNA == n_IDNA_IMPL_LIBIDN2
  #  include <idn2.h>
  # elif mx_HAVE_IDNA == n_IDNA_IMPL_LIBIDN
  #  include <idna.h>
  #  include <idn-free.h>
  # elif mx_HAVE_IDNA == n_IDNA_IMPL_IDNKIT
  #  include <idn/api.h>
  # endif
  #endif

  ...

  #ifdef mx_HAVE_IDNA
  FL boole
  n_idna_to_ascii(struct n_string *out, char const *ibuf, uz ilen){
     char *idna_utf8;
     boole lofi, rv;
     NYD_IN;
  
     if(ilen == UZ_MAX)
        ilen = su_cs_len(ibuf);
  
     lofi = FAL0;
  
     if((rv = (ilen == 0)))
        goto jleave;
     if(ibuf[ilen] != '\0'){
        lofi = TRU1;
        idna_utf8 = n_lofi_alloc(ilen +1);
        su_mem_copy(idna_utf8, ibuf, ilen);
        idna_utf8[ilen] = '\0';
        ibuf = idna_utf8;
     }
     ilen = 0;
  
  # ifndef mx_HAVE_ALWAYS_UNICODE_LOCALE
     if(n_psonce & n_PSO_UNICODE)
  # endif
        idna_utf8 = n_UNCONST(ibuf);
  # ifndef mx_HAVE_ALWAYS_UNICODE_LOCALE
     else if((idna_utf8 = n_iconv_onetime_cp(n_ICONV_NONE, "utf-8",
           ok_vlook(ttycharset), ibuf)) == NULL)
        goto jleave;
  # endif

  # if mx_HAVE_IDNA == n_IDNA_IMPL_LIBIDN2
     /* C99 */{
        char *idna_ascii;
        int f, rc;
  
        f = IDN2_NONTRANSITIONAL;
  jidn2_redo:
        if((rc = idn2_to_ascii_8z(idna_utf8, &idna_ascii, f)) == IDN2_OK){
           out = n_string_assign_cp(out, idna_ascii);
           idn2_free(idna_ascii);
           rv = TRU1;
           ilen = out->s_len;
        }else if(rc == IDN2_DISALLOWED && f != IDN2_TRANSITIONAL){
           f = IDN2_TRANSITIONAL;
           goto jidn2_redo;
        }
     }
  
  # elif mx_HAVE_IDNA == n_IDNA_IMPL_LIBIDN
     /* C99 */{
        char *idna_ascii;
  
        if(idna_to_ascii_8z(idna_utf8, &idna_ascii, 0) == IDNA_SUCCESS){
           out = n_string_assign_cp(out, idna_ascii);
           idn_free(idna_ascii);
           rv = TRU1;
           ilen = out->s_len;
        }
     }
  
  # elif mx_HAVE_IDNA == n_IDNA_IMPL_IDNKIT
     ilen = su_cs_len(idna_utf8);
  jredo:
     switch(idn_encodename(
        /* LOCALCONV changed meaning in v2 and is no longer available for
         * encoding.  This makes sense, bu */
           (
  #  ifdef IDN_UNICODECONV /* v2 */
           IDN_ENCODE_APP & ~IDN_UNICODECONV
  #  else
           IDN_DELIMMAP | IDN_LOCALMAP | IDN_NAMEPREP | IDN_IDNCONV |
           IDN_LENCHECK | IDN_ASCCHECK
  #  endif
           ), idna_utf8,
           n_string_resize(n_string_trunc(out, 0), ilen)->s_dat, ilen)){
     case idn_buffer_overflow:
        ilen += HOST_NAME_MAX +1;
        goto jredo;
     case idn_success:
        rv = TRU1;
        ilen = su_cs_len(out->s_dat);
        break;
     default:
        ilen = 0;
        break;
     }
  
  # else
  #  error Unknown mx_HAVE_IDNA
  # endif

  jleave:
     if(lofi)
        n_lofi_free(n_UNCONST(ibuf));
     out = n_string_trunc(out, ilen);
     NYD_OU;
     return rv;
  }
  #endif /* mx_HAVE_IDNA */

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

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