skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

skagetlnsep_loose.c (365B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/stralloc.h>
      5 #include <skalibs/skamisc.h>
      6 
      7 int skagetlnsep_loose (buffer *b, stralloc *sa, char const *sep, size_t seplen)
      8 {
      9   int e = errno ;
     10   int r = skagetlnsep(b, sa, sep, seplen) ;
     11   if (r >= 0) return r ;
     12   if (errno != EPIPE) return -1 ;
     13   if (!stralloc_0(sa)) return -1 ;
     14   return (errno = e, 3) ;
     15 }