skalibs

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

skagetln_loose.c (329B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/stralloc.h>
      5 #include <skalibs/skamisc.h>
      6 
      7 int skagetln_loose (buffer *b, stralloc *sa, char sep)
      8 {
      9   int e = errno ;
     10   int r = skagetln(b, sa, sep) ;
     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 }