2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

fix interrupts.c to actually work

This commit is contained in:
Helmut Grohne 2013-01-28 14:12:17 +01:00
parent 7c5a9a8c58
commit 1956b4dd7b

View File

@ -37,10 +37,13 @@ int interrupts(int argc, char **argv) {
return 1;
}
while(fgets(buff, 256, f)) {
if(!strncmp(buff, "intr ", 5))
printf("intr.value %s", buff+5);
else if(!strncmp(buff, "ctxt ", 5))
printf("ctx.value %s", buff+5);
if(!strncmp(buff, "intr ", 5)) {
buff[5 + strcspn(buff + 5, " \t\n")] = '\0';
printf("intr.value %s\n", buff+5);
} else if(!strncmp(buff, "ctxt ", 5)) {
buff[5 + strcspn(buff + 5, " \t\n")] = '\0';
printf("ctx.value %s\n", buff+5);
}
}
fclose(f);
return 0;