* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
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
+ }
+ if(! obj->data.opaque)
+ obj->data.opaque = strdup("AC");
#endif /* !__OpenBSD__ */
END OBJ(freq, 0)
get_cpu_count();
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';
case OBJ_acpitemp:
close(data.i);
break;
+ case OBJ_acpiacadapter:
+ free(data.opaque);
+ break;
#endif /* !__OpenBSD__ */
#ifdef __linux__
case OBJ_i2c: