7 void print_load(const char *format) {
9 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun)
13 if (getloadavg(loadavg, 3) == -1)
16 for (walk = format; *walk != '\0'; walk++) {
22 if (BEGINS_WITH(walk+1, "1min")) {
23 (void)printf("%1.2f", loadavg[0]);
24 walk += strlen("1min");
27 if (BEGINS_WITH(walk+1, "5min")) {
28 (void)printf("%1.2f", loadavg[1]);
29 walk += strlen("5min");
32 if (BEGINS_WITH(walk+1, "15min")) {
33 (void)printf("%1.2f", loadavg[2]);
34 walk += strlen("15min");
40 (void)fputs("Cannot read load\n", stderr);