summaryrefslogtreecommitdiff
path: root/src/libstddjb/skagetln_loose.c
blob: 7fc5916aeadeda2ba20c7d1014e87dcdd62b382c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <errno.h>
#include <skalibs/stralloc.h>
#include <skalibs/skamisc.h>

int skagetln_loose (buffer *b, stralloc *sa, char sep)
{
  int e = errno ;
  int r = skagetln(b, sa, sep) ;
  if (r >= 0) return r ;
  if (errno != EPIPE) return -1 ;
  if (!stralloc_0(sa)) return -1 ;
  return (errno = e, 3) ;
}