1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

convert obsd_* to callbacks.print (completely untested)

This commit is contained in:
Phil Sutter 2009-11-16 01:41:53 +01:00
parent a249b9bc44
commit 712caa8ab3
4 changed files with 14 additions and 16 deletions

View File

@ -910,14 +910,6 @@ void generate_text_internal(char *p, int p_max_size,
}
}
#endif
#ifdef __OpenBSD__
OBJ(obsd_vendor) {
get_obsd_vendor(p, p_max_size);
}
OBJ(obsd_product) {
get_obsd_product(p, p_max_size);
}
#endif /* __OpenBSD__ */
#ifdef X11
OBJ(font) {
new_font(p, obj->data.s);

View File

@ -367,7 +367,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
parse_obsd_sensor(obj, arg);
obj->callbacks.print = &print_obsd_sensors_volt;
END OBJ(obsd_vendor, 0)
obj->callbacks.print = &get_obsd_vendor;
END OBJ(obsd_product, 0)
obj->callbacks.print = &get_obsd_product;
#endif /* __OpenBSD__ */
END OBJ(buffers, &update_meminfo)
END OBJ(cached, &update_meminfo)

View File

@ -547,14 +547,16 @@ void print_obsd_sensors_volt(struct text_object *obj, char *p, int p_max_size)
}
/* chipset vendor */
void get_obsd_vendor(char *buf, size_t client_buffer_size)
void get_obsd_vendor(struct text_object *obj, char *buf, size_t client_buffer_size)
{
int mib[2];
char vendor[64];
size_t size = sizeof(vendor);
(void)obj;
mib[0] = CTL_HW;
mib[1] = HW_VENDOR;
char vendor[64];
size_t size = sizeof(vendor);
if (sysctl(mib, 2, vendor, &size, NULL, 0) == -1) {
NORM_ERR("error reading vendor");
@ -565,14 +567,16 @@ void get_obsd_vendor(char *buf, size_t client_buffer_size)
}
/* chipset name */
void get_obsd_product(char *buf, size_t client_buffer_size)
void get_obsd_product(struct text_object *obj, char *buf, size_t client_buffer_size)
{
int mib[2];
char product[64];
size_t size = sizeof(product);
(void)obj;
mib[0] = CTL_HW;
mib[1] = HW_PRODUCT;
char product[64];
size_t size = sizeof(product);
if (sysctl(mib, 2, product, &size, NULL, 0) == -1) {
NORM_ERR("error reading product");

View File

@ -13,8 +13,8 @@ void parse_obsd_sensor(struct text_object *, const char *);
void print_obsd_sensors_temp(struct text_object *, char *, int);
void print_obsd_sensors_fan(struct text_object *, char *, int);
void print_obsd_sensors_volt(struct text_object *, char *, int);
void get_obsd_vendor(char *buf, size_t client_buffer_size);
void get_obsd_product(char *buf, size_t client_buffer_size);
void get_obsd_vendor(struct text_object *, char *buf, size_t client_buffer_size);
void get_obsd_product(struct text_object *, char *buf, size_t client_buffer_size);
#if defined(i386) || defined(__i386__)
typedef struct apm_power_info *apm_info_t;