if (sysctlbyname("hw.acpi.battery.life", &buf, &size, NULL, 0) < 0) { perror("sysctl"); exit(1); } printf("`%d'\n", buf);