Пример #1
0
int
main(void)
{
        struct items {
                char *up;
                char *load;
                char *fan;
                char *temp;
                char *mem;
                char *swap;
                char *diskio;
                char *fs_root;
                char *fs_home;
                char *fs_storage;
                char *net_speed;
                char *batt;
                char *vol;
                char *time;
                char *status;
        };

	if (!(dpy = XOpenDisplay(NULL))) {
		fprintf(stderr, "dwmstatus: cannot open display.\n");
		return 1;
    }

        struct items *i = malloc(sizeof(struct items));

	while(1) {
		i->up = get_up();
		i->load = get_load();
		i->fan = get_fan();
		i->temp = get_temp();
		i->mem = get_mem();
		i->swap = get_swap();
		i->diskio = get_diskio("sda");
                i->fs_root = get_space("/");
                i->fs_home = get_space("/home");
                i->net_speed = get_net_speed();
		i->batt = get_batt();
		i->vol = get_vol();
		i->time = mktimes("%m/%d/%Y %a %H:%M", tzkiev);

		i->status = smprintf(
                        "up:%s la:%s fan:%s temp:%s m:%s s:%s io:%s /:%s "
                        "~/:%s net:%s bat:%s vol:%s %s",
                        i->up, i->load, i->fan, i->temp, i->mem, i->swap,
                        i->diskio, i->fs_root, i->fs_home, i->net_speed,
                        i->batt, i->vol, i->time);
		setstatus(i->status);

                sleep(INTERVAL);
    }

        free(i);

	XCloseDisplay(dpy);

	return EXIT_SUCCESS;
}
Пример #2
0
//{{{ int main(int argc,char** argv)
int main(int argc,char** argv)
{
	//get_config();
	format_msg(0);//初次运行时获取天气
	get_batt();// 初次运行时获取电量
	get_cpu();//cpu
	get_mem();//mem
	get_net();//net
	get_temp();//temperature
	get_mailchk();//2014-4-2添加,邮件检查的显示。
	disp_msg();
	exit(0);
}//}}}
Пример #3
0
char	*get_device(char *varname, Meinkompf db)
{
  if (match("battery.*", varname))
    return (get_batt(varname, db));
  return (my_strdup(""));
}