Xinqi Bao's Git

Split into multiple files
[slstatus.git] / load_avg.c
1 #include <err.h>
2 #include <stdlib.h>
3
4 #include "util.h"
5
6 const char *
7 load_avg(const char *fmt)
8 {
9 double avgs[3];
10
11 if (getloadavg(avgs, 3) < 0) {
12 warnx("Failed to get the load avg");
13 return NULL;
14 }
15
16 return bprintf(fmt, avgs[0], avgs[1], avgs[2]);
17 }