#include <stdio.h>
#if !defined(__SVR4) && !defined(__GNUC__)
#include <strings.h>
#endif
#include <string.h>
#include "ipf.h"
char *
getaline(char *str, size_t size, FILE *file, int *linenum)
{
char *p;
int s, len;
do {
for (p = str, s = size; ; p += (len - 1), s -= (len - 1)) {
if (fgets(p, s, file) == NULL)
return (NULL);
len = strlen(p);
if (p[len - 1] != '\n') {
p[len] = '\0';
break;
}
(*linenum)++;
p[len - 1] = '\0';
if (len < 2 || p[len - 2] != '\\')
break;
else
p[len - 2] = ' ';
}
} while (*str == '\0');
return (str);
}