summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/skagetln_loose.c15
-rw-r--r--src/libstddjb/skagetlnsep_loose.c15
2 files changed, 30 insertions, 0 deletions
diff --git a/src/libstddjb/skagetln_loose.c b/src/libstddjb/skagetln_loose.c
new file mode 100644
index 0000000..7fc5916
--- /dev/null
+++ b/src/libstddjb/skagetln_loose.c
@@ -0,0 +1,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) ;
+}
diff --git a/src/libstddjb/skagetlnsep_loose.c b/src/libstddjb/skagetlnsep_loose.c
new file mode 100644
index 0000000..ad0fd0a
--- /dev/null
+++ b/src/libstddjb/skagetlnsep_loose.c
@@ -0,0 +1,15 @@
+/* ISC license. */
+
+#include <errno.h>
+#include <skalibs/stralloc.h>
+#include <skalibs/skamisc.h>
+
+int skagetlnsep_loose (buffer *b, stralloc *sa, char const *sep, size_t seplen)
+{
+ int e = errno ;
+ int r = skagetlnsep(b, sa, sep, seplen) ;
+ if (r >= 0) return r ;
+ if (errno != EPIPE) return -1 ;
+ if (!stralloc_0(sa)) return -1 ;
+ return (errno = e, 3) ;
+}