dotfiles/examples/statusbar items - C sources/loadavg.c

17 lines
259 B
C
Raw Normal View History

2021-09-07 20:53:41 +00:00
#include <stdio.h>
int main (void)
{
float loadavg;
FILE *fp;
fp = fopen("/proc/loadavg","r");
fscanf(fp,"%f",&loadavg);
fclose(fp);
printf("%.2f",loadavg);
if ( loadavg > 2.0 )
{
printf("\a");
}
return(0);
}