brewco/rdrecipes.c

changeset 473
fdd30e935079
parent 464
4a624c071ca9
--- a/brewco/rdrecipes.c	Tue Dec 22 21:07:14 2015 +0100
+++ b/brewco/rdrecipes.c	Sat Dec 26 21:45:44 2015 +0100
@@ -118,6 +118,10 @@
 	    syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
 	    return 1;
 	}
+	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLTO", "%f", recipe->coolto)) < 0) {
+	    syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
+	    return 1;
+	}
 	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STARTTIME", "%d", (int)recipe->starttime)) < 0) {
 	    syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
 	    return 1;
@@ -333,6 +337,7 @@
     recipe = (a_recipe *)malloc(sizeof(a_recipe));
     memset(recipe, 0, sizeof(a_recipe));
     recipe->next = NULL;
+    recipe->coolto = 20.0;
 
     cur = cur->xmlChildrenNode;
     while (cur != NULL) {
@@ -351,6 +356,12 @@
 		recipe->boiltime = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLTO"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &fval) == 1)
+		recipe->coolto = fval;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"STARTTIME"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)

mercurial