int ignore_history;
int no_output;
int json_output;
-int pretty;
int no_update;
int scan_interval;
int time_constant;
static void load_ugly_table(FILE *fp)
{
- char buf[4096];
+ char *buf = NULL;
+ size_t buflen = 0;
+ ssize_t nread;
struct nstat_ent *db = NULL;
struct nstat_ent *n;
- while (fgets(buf, sizeof(buf), fp) != NULL) {
- char idbuf[sizeof(buf)];
+ while ((nread = getline(&buf, &buflen, fp)) != -1) {
+ char idbuf[4096];
int off;
char *p;
int count1, count2, skip = 0;
p = next;
}
n = db;
- if (fgets(buf, sizeof(buf), fp) == NULL)
+ nread = getline(&buf, &buflen, fp);
+ if (nread == -1)
abort();
count2 = count_spaces(buf);
if (count2 > count1)
n = n->next;
} while (p > buf + off + 2);
}
+ free(buf);
while (db) {
n = db;