use getdelim instead of getline

Avoids weird macros to build on FreeBSD.
pull/10/head
Christian Neukirchen 8 years ago
parent 3167a7a2d3
commit 472a74b75b

@ -60,7 +60,7 @@ deliver(FILE *infile)
// skip to first "From " line
while (1) {
errno = 0;
ssize_t rd = getline(&line, &linelen, infile);
ssize_t rd = getdelim(&line, &linelen, '\n', infile);
if (rd == -1) {
if (errno == 0)
// invalid mbox file
@ -98,7 +98,7 @@ tryagain:
int is_old = 0;
while (1) {
errno = 0;
ssize_t rd = getline(&line, &linelen, infile);
ssize_t rd = getdelim(&line, &linelen, '\n', infile);
if (rd == -1) {
if (errno != 0)
return -1;

@ -62,7 +62,7 @@ export(char *file)
while (1) {
errno = 0;
ssize_t rd = getline(&line, &linelen, infile);
ssize_t rd = getdelim(&line, &linelen, '\n', infile);
if (rd == -1) {
if (errno == 0)
break;

@ -273,7 +273,7 @@ gen_build()
int intext = 0;
while (1) {
int read = getline(&line, &linelen, stdin);
int read = getdelim(&line, &linelen, '\n', stdin);
if (read == -1) {
if (feof(stdin))
break;

@ -205,7 +205,7 @@ stdinmode()
outfile = stdout;
}
while ((rd = getline(&line, &linelen, stdin)) != -1) {
while ((rd = getdelim(&line, &linelen, '\n', stdin)) != -1) {
if (line[rd-1] == '\n')
line[rd-1] = 0;

Loading…
Cancel
Save