summaryrefslogtreecommitdiff
path: root/sysutils/i810switch/patches/patch-ab
blob: 51544f01755aed00bc8023e6456dee218e2084be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$NetBSD: patch-ab,v 1.2 2011/10/01 22:32:11 dholland Exp $
--- getline.c	1969-12-31 19:00:00.000000000 -0500
+++ getline.c	2006-12-03 23:16:23.000000000 -0500
@@ -0,0 +1,21 @@
+#include <sys/param.h>
+#include <stdio.h>
+#if defined(__NetBSD__) && __NetBSD_Version__ < 599001600
+int
+getline(char **buf, size_t *len, FILE *fp)
+{
+	static char *b;
+	if (b)
+		free(b);
+	for (;;) {
+		if ((*buf = fparseln(fp, len, NULL, NULL, 0)) == NULL)
+			return 0;
+		if (*len == 0) {
+			free(*buf);
+			continue;
+		}
+		b = *buf;
+		return *len;
+	}
+}
+#endif