if (!fgets(buf2, sizeof buf2, f)) break; sp = strchr(buf1, ':'); np = strchr(buf2, ':'); if (!np || !sp) goto formaterr; *sp = '\0'; tab = newtable(snmptabs, buf1); if (tab == NULL) { UFWARN((printf(_("unknown title %s\n"), buf1))); continue; } np++; sp++;  endflag = 0; while (!endflag) { while (isspace(*sp)) sp++; while (isspace(*np)) np++;   p = skiptok(sp); if (*p == '\0') endflag = 1; *p = '\0';  if (*sp != '\0')	 printval(tab, sp, strtoul(np, &np, 10)); sp = p + 1; } }
void parsesnmp(){    FILE *f;    char buf1[512], buf2[512];    char *sp, *np, *p;    f = fopen("/proc/net/snmp", "r");    if (!f) {	perror(_("cannot open /proc/net/snmp"));	return;    }    while (fgets(buf1, sizeof buf1, f)) {	int endflag;	struct tabtab *tab;	if (!fgets(buf2, sizeof buf2, f))	    break;	sp = strchr(buf1, ':');	np = strchr(buf2, ':');	if (!np || !sp)	    goto formaterr;	*sp = '\0';	tab = newtable(snmptabs, buf1);	if (tab == NULL) {	    UFWARN((printf(_("unknown title %s\n"), buf1)));	    continue;	}	np++;	sp++;	endflag = 0;	while (!endflag) {	    while (isspace(*sp))		sp++;	    while (isspace(*np))		np++;	    /*if (*np == '\0') goto formaterr; */	    p = skiptok(sp);	    if (*p == '\0')		endflag = 1;	    *p = '\0';	    if (*sp != '\0')	/* XXX */		printval(tab, sp, strtoul(np, &np, 10));	    sp = p + 1;	}    }    if (ferror(f))	perror("/proc/net/snmp");    fclose(f);    return;  formaterr:    perror(_("error parsing /proc/net/snmp"));    return;}