Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/modules/temperature
Modified Files:
e_mod_main.c
Log Message:
Don't use sscanf
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/e/src/modules/temperature/e_mod_main.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- e_mod_main.c 8 Oct 2005 15:06:36 -0000 1.43
+++ e_mod_main.c 25 Oct 2005 10:41:28 -0000 1.44
@@ -1059,21 +1059,29 @@
{
char *name;
+ ret = 1;
while ((name = ecore_list_next(therms)))
{
- char units[32];
+ char *p, *q;
FILE *f;
-
snprintf(buf, sizeof(buf),
"/proc/acpi/thermal_zone/%s/temperature", name);
f = fopen(buf, "rb");
if (f)
{
fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0;
- units[0] = 0;
- if (sscanf(buf, "%*[^:]: %i %20s", &temp, units) == 2)
- ret = 1;
fclose(f);
+ p = strchr(buf, ':');
+ if (!p)
+ {
+ ret = 0;
+ continue;
+ }
+ p++;
+ while (*p == ' ') p++;
+ q = strchr(p, ' ');
+ if (q) *q = 0;
+ temp = atoi(p);
}
}
ecore_list_destroy(therms);
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs