4 #if !defined(DZEN) && !defined(XMOBAR)
5 #error "You have to enable either -DDZEN or -DXMOBAR"
12 #define BAR "^fg(#333333)^p(5;-2)^ro(2)^p()^fg()^p(5)"
14 #define BAR "<fc=#333333> | </fc>"
16 #define BEGINS_WITH(haystack, needle) (strncmp(haystack, needle, strlen(needle)) == 0)
17 #define max(a, b) ((a) > (b) ? (a) : (b))
21 #define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
23 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
25 #define THERMAL_ZONE "hw.acpi.thermal.tz%d.temperature"
26 #define BATT_LIFE "hw.acpi.battery.life"
27 #define BATT_TIME "hw.acpi.battery.time"
28 #define BATT_STATE "hw.acpi.battery.state"
32 #if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
35 #include <sys/param.h>
39 /* Allows for the definition of a variable without opening a new scope, thus
40 * suited for usage in a macro. Idea from wmii. */
41 #define with(type, var, init) \
42 for (type var = (type)-1; (var == (type)-1) && ((var=(init)) || 1); )
44 #define CASE_SEC(name) \
45 if (BEGINS_WITH(current, name)) \
46 with(cfg_t *, sec, cfg_getsec(cfg, name)) \
49 #define CASE_SEC_TITLE(name) \
50 if (BEGINS_WITH(current, name)) \
51 with(const char *, title, current + strlen(name) + 1) \
52 with(cfg_t *, sec, cfg_gettsec(cfg, name, title)) \
56 typedef enum { CS_DISCHARGING, CS_CHARGING, CS_FULL } charging_status_t;
59 char *skip_character(char *input, char character, int amount);
60 void die(const char *fmt, ...);
61 bool slurp(char *filename, char *destination, int size);
64 void print_seperator();
65 char *color(const char *colorstr);
66 char *endcolor() __attribute__ ((pure));
68 void print_ipv6_info(const char *format);
69 void print_disk_info(const char *path, const char *format);
70 void print_battery_info(int number, const char *format, bool last_full_capacity);
71 void print_time(const char *format);
72 const char *get_ip_addr();
73 void print_wireless_info(const char *interface, const char *format_up, const char *format_down);
74 void print_run_watch(const char *title, const char *pidfile, const char *format);
75 void print_cpu_temperature_info(int zone, const char *format);
76 void print_eth_info(const char *interface, const char *format_up, const char *format_down);
78 bool process_runs(const char *path);
80 /* socket file descriptor for general purposes */
81 extern int general_socket;
83 extern cfg_t *cfg, *cfg_general;