- gauge_t snum, mnum, lnum;
- FILE *loadavg;
- char buffer[16];
-
- char *fields[8];
- int numfields;
-
- if ((loadavg = fopen ("/proc/loadavg", "r")) == NULL)
- {
- char errbuf[1024];
- WARNING ("load: fopen: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- return (-1);
- }
-
- if (fgets (buffer, 16, loadavg) == NULL)
- {
- char errbuf[1024];
- WARNING ("load: fgets: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- fclose (loadavg);
- return (-1);
- }
-
- if (fclose (loadavg))
- {
- char errbuf[1024];
- WARNING ("load: fclose: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- }
-
- numfields = strsplit (buffer, fields, 8);
-
- if (numfields < 3)
- return (-1);
-
- snum = atof (fields[0]);
- mnum = atof (fields[1]);
- lnum = atof (fields[2]);
-
- load_submit(snum, mnum, lnum);
+ gauge_t snum, mnum, lnum;
+ FILE *loadavg;
+ char buffer[16];
+
+ char *fields[8];
+ int numfields;
+
+ if ((loadavg = fopen("/proc/loadavg", "r")) == NULL) {
+ char errbuf[1024];
+ WARNING("load: fopen: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ return (-1);
+ }
+
+ if (fgets(buffer, 16, loadavg) == NULL) {
+ char errbuf[1024];
+ WARNING("load: fgets: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ fclose(loadavg);
+ return (-1);
+ }
+
+ if (fclose(loadavg)) {
+ char errbuf[1024];
+ WARNING("load: fclose: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ }
+
+ numfields = strsplit(buffer, fields, 8);
+
+ if (numfields < 3)
+ return (-1);
+
+ snum = atof(fields[0]);
+ mnum = atof(fields[1]);
+ lnum = atof(fields[2]);
+
+ load_submit(snum, mnum, lnum);