1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

made more paths be macros

This commit is contained in:
Helmut Grohne 2009-01-23 12:56:20 +00:00 committed by Steve Schnepp
parent 339b8f43a9
commit 611bfb0580
5 changed files with 40 additions and 26 deletions

View file

@ -4,6 +4,8 @@
#include <ctype.h>
#include "common.h"
#define PROC_NET_SNMP "/proc/net/snmp"
int fw_packets(int argc, char **argv) {
FILE *f;
char buff[1024], *s;
@ -24,14 +26,14 @@ int fw_packets(int argc, char **argv) {
return 0;
}
if(!strcmp(argv[1], "autoconf")) {
if(0 == access("/proc/net/snmp", R_OK))
if(0 == access(PROC_NET_SNMP, R_OK))
return writeyes();
else
return writeno("/proc/net/snmp not readable");
return writeno(PROC_NET_SNMP " not readable");
}
}
if(!(f=fopen("/proc/net/snmp", "r"))) {
fputs("cannot open /proc/net/snmp\n", stderr);
if(!(f=fopen(PROC_NET_SNMP, "r"))) {
fputs("cannot open " PROC_NET_SNMP "\n", stderr);
return 1;
}
while(fgets(buff, 1024, f)) {
@ -55,6 +57,6 @@ int fw_packets(int argc, char **argv) {
}
}
fclose(f);
fputs("no ip line found in /proc/net/snmp\n", stderr);
fputs("no ip line found in " PROC_NET_SNMP "\n", stderr);
return 1;
}