1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:05:21 +02:00

eeshow/file.c (file_read): use getline instead of fgets

OSHW-SCHEM-PCB10mm of github.com:cpavlina/kicad-schlib/library/symbol.lib
has a line > 1000 characters.
This commit is contained in:
Werner Almesberger 2016-08-16 01:24:04 -03:00
parent 8a087797b2
commit 37351bf8bc

View File

@ -220,12 +220,13 @@ bool file_read(struct file *file,
bool (*parse)(const struct file *file, void *user, const char *line),
void *user)
{
char buf[1000];
static char *buf = NULL;
static size_t n = 0;
char *nl;
if (file->vcs)
return vcs_read(file->vcs, file, parse, user);
while (fgets(buf, sizeof(buf), file->file)) {
while (getline(&buf, &n, file->file) > 0) {
nl = strchr(buf, '\n');
if (nl)
*nl = 0;