Add a patch for net/sacc to ignore possible extra fields (e.g. gopher+) - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
 (HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) changeset b84e87552c2f3c08553cea31a9751d9370153414
 (DIR) parent 7981c5f981fdbbec116d1d88d87dcb4bd13d17e1
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri, 17 Aug 2018 20:42:02 
       
       Add a patch for net/sacc to ignore possible extra fields (e.g. gopher+)
       
       Diffstat:
        net/sacc/patch-sacc.c |  58 +++++++++++++++++++++++++++++++++++++++++++++++++++
        1 files changed, 58 insertions(+), 0 deletions(-)
       ---
       diff -r 7981c5f981fd -r b84e87552c2f net/sacc/patch-sacc.c
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/net/sacc/patch-sacc.c     Fri Aug 17 20:42:02 2018 +0200
       @@ -0,0 +1,58 @@
       +$NetBSD$
       +
       +According RFC 1436:
       +
       +> [...] If there are yet other tab delimited fields, the basic
       +> Gopher client should ignore them. [...]
       +
       +In order to do that:
       +
       + - Change the behaviour of invaliditem() in order to consider an item with
       +   more than 3 tabs valid.
       + - Adjust the 2nd argument of pickfield() as a string of possible separator, if
       +   more than 3 tabs are present the separator at the right of the port can also
       +   be a `\t', not just a `\r'.
       + - In molditem() ignore any possible extra characters.
       +
       +--- sacc.c.orig        2018-02-24 15:24:43.000000000 +0000
       ++++ sacc.c
       +@@ -259,11 +259,11 @@ displaytextitem(Item *item)
       + }
       + 
       + static char *
       +-pickfield(char **raw, char sep)
       ++pickfield(char **raw, const char *sep)
       + {
       +       char *c, *f = *raw;
       + 
       +-      for (c = *raw; *c && *c != sep; ++c)
       ++      for (c = *raw; *c && strchr(sep, *c) == NULL; ++c)
       +               ;
       + 
       +       *c = '\0';
       +@@ -285,7 +285,7 @@ invaliditem(char *raw)
       +       if (c)
       +               *raw++ = '\0';
       + 
       +-      return (tabs == 3) ? NULL : raw;
       ++      return (tabs >= 3) ? NULL : raw;
       + }
       + 
       + static void
       +@@ -303,10 +303,12 @@ molditem(Item *item, char **raw)
       +       }
       + 
       +       item->type = *raw[0]++;
       +-      item->username = pickfield(raw, '\t');
       +-      item->selector = pickfield(raw, '\t');
       +-      item->host = pickfield(raw, '\t');
       +-      item->port = pickfield(raw, '\r');
       ++      item->username = pickfield(raw, "\t");
       ++      item->selector = pickfield(raw, "\t");
       ++      item->host = pickfield(raw, "\t");
       ++      item->port = pickfield(raw, "\t\r");
       ++      while (*raw[0] != '\0')
       ++              ++*raw;
       +       if (!*raw[0])
       +               ++*raw;
       + }