OBJ(acpitemp, 0)
obj->data.i = open_acpi_temperature(arg);
END OBJ(acpiacadapter, 0)
+ if(arg) {
+#ifdef __linux__
+ if(strpbrk(arg, "/.") != NULL) {
+ /*
+ * a bit of paranoia. screen out funky paths
+ * i hope no device will have a '.' in its name
+ */
+ NORM_ERR("acpiacadapter: arg must not contain '/' or '.'");
+ } else
+ obj->data.opaque = strdup(arg);
+#else
+ NORM_ERR("acpiacadapter: arg is only used on linux");
+#endif
+ }
#endif /* !__OpenBSD__ */
END OBJ(freq, 0)
get_cpu_count();
obj->data.s = strndup(bat, text_buffer_size);
END OBJ(battery_bar, 0)
char bat[64];
- if (arg) {
- arg = scan_bar(obj, arg);
+
+ arg = scan_bar(obj, arg);
+ if (arg && strlen(arg)>0) {
sscanf(arg, "%63s", bat);
} else {
strcpy(bat, "BAT0");
scan_loadgraph_arg(obj, arg);
#endif /* X11 */
END OBJ(diskio, &update_diskio)
- parse_diskio_arg(obj, arg);
+ parse_diskio_arg(obj, dev_name(arg));
END OBJ(diskio_read, &update_diskio)
- parse_diskio_arg(obj, arg);
+ parse_diskio_arg(obj, dev_name(arg));
END OBJ(diskio_write, &update_diskio)
- parse_diskio_arg(obj, arg);
+ parse_diskio_arg(obj, dev_name(arg));
#ifdef X11
END OBJ(diskiograph, &update_diskio)
- parse_diskiograph_arg(obj, arg);
+ parse_diskiograph_arg(obj, dev_name(arg));
END OBJ(diskiograph_read, &update_diskio)
- parse_diskiograph_arg(obj, arg);
+ parse_diskiograph_arg(obj, dev_name(arg));
END OBJ(diskiograph_write, &update_diskio)
- parse_diskiograph_arg(obj, arg);
+ parse_diskiograph_arg(obj, dev_name(arg));
#endif /* X11 */
END OBJ(color, 0)
#ifdef X11
obj->sub = malloc(sizeof(struct text_object));
extract_variable_text_internal(obj->sub, arg);
END OBJ(nodename, 0)
+ END OBJ(nodename_short, 0)
END OBJ_ARG(cmdline_to_pid, 0, "cmdline_to_pid needs a command line as argument")
scan_cmdline_to_pid_arg(obj, arg, free_at_crash);
END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")
s = orig_p = p;
if (strcmp(p, const_p)) {
- DBGP("replaced all templates in text: input is\n'%s'\noutput is\n'%s'", const_p, p);
+ DBGP2("replaced all templates in text: input is\n'%s'\noutput is\n'%s'", const_p, p);
} else {
- DBGP("no templates to replace");
+ DBGP2("no templates to replace");
}
memset(retval, 0, sizeof(struct text_object));
}
/* copy variable to buffer */
- len = (p - s > text_buffer_size-1) ? text_buffer_size-1 : (p - s);
+ len = ((unsigned int) (p - s) > text_buffer_size - 1) ? text_buffer_size - 1 : (unsigned int) (p - s);
strncpy(buf, s, len);
buf[len] = '\0';
strfold(p, 1);
} else if (*p == '#') {
char c;
- if (remove_comment(p, &c) && p > orig_p && c == '\n') {
+ if (remove_comment(p, &c) && p >= orig_p && c == '\n') {
/* if remove_comment removed a newline, we need to 'back up' with p */
p--;
}
case OBJ_acpitemp:
close(data.i);
break;
+ case OBJ_acpiacadapter:
+ free(data.opaque);
+ break;
#endif /* !__OpenBSD__ */
#ifdef __linux__
case OBJ_i2c: