182 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "HOPADDITIONS")) < 0) { |
182 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "HOPADDITIONS")) < 0) { |
183 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterStartElement"); |
183 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterStartElement"); |
184 return 1; |
184 return 1; |
185 } |
185 } |
186 for (i = 0; i < 10; i++) { |
186 for (i = 0; i < 10; i++) { |
187 if (recipe->hops[i].name) { |
187 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "HOPADDITION")) < 0) { |
188 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "HOPADDITION")) < 0) { |
188 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterStartElement"); |
189 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterStartElement"); |
189 return 1; |
190 return 1; |
190 } |
191 } |
191 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", recipe->hops[i].name)) < 0) { |
192 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", recipe->hops[i].name)) < 0) { |
192 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); |
193 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); |
193 return 1; |
194 return 1; |
194 } |
195 } |
195 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP", "%s", recipe->hops[i].skip ? "YES":"NO")) < 0) { |
196 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BOILTIME", "%d", recipe->hops[i].boiltime)) < 0) { |
196 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); |
197 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); |
197 return 1; |
198 return 1; |
198 } |
199 } |
199 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BOILTIME", "%d", recipe->hops[i].boiltime)) < 0) { |
200 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
200 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); |
201 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterEndElement"); |
201 return 1; |
202 return 1; |
202 } |
203 } |
203 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
204 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterEndElement"); |
|
205 return 1; |
204 } |
206 } |
205 } |
207 } |
206 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
208 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
207 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterEndElement"); |
209 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterEndElement"); |
208 return 1; |
210 return 1; |
435 if ((!xmlStrcmp(s1cur->name, (const xmlChar *)"HOPADDITION"))) { |
437 if ((!xmlStrcmp(s1cur->name, (const xmlChar *)"HOPADDITION"))) { |
436 s2cur = s1cur->xmlChildrenNode; |
438 s2cur = s1cur->xmlChildrenNode; |
437 while (s2cur != NULL) { |
439 while (s2cur != NULL) { |
438 if ((!xmlStrcmp(s2cur->name, (const xmlChar *)"NAME"))) { |
440 if ((!xmlStrcmp(s2cur->name, (const xmlChar *)"NAME"))) { |
439 recipe->hops[i].name = (char *)xmlNodeListGetString(doc, s2cur->xmlChildrenNode, 1); |
441 recipe->hops[i].name = (char *)xmlNodeListGetString(doc, s2cur->xmlChildrenNode, 1); |
|
442 } |
|
443 if ((!xmlStrcmp(s2cur->name, (const xmlChar *)"SKIP"))) { |
|
444 key = xmlNodeListGetString(doc, s2cur->xmlChildrenNode, 1); |
|
445 for (j = 0; j < 2; j++) { |
|
446 if (! xmlStrcmp(key, (const xmlChar *)SKIPYN[j])) { |
|
447 recipe->hops[i].skip = j; |
|
448 break; |
|
449 } |
|
450 } |
|
451 xmlFree(key); |
440 } |
452 } |
441 if ((!xmlStrcmp(s2cur->name, (const xmlChar *)"BOILTIME"))) { |
453 if ((!xmlStrcmp(s2cur->name, (const xmlChar *)"BOILTIME"))) { |
442 key = xmlNodeListGetString(doc, s2cur->xmlChildrenNode, 1); |
454 key = xmlNodeListGetString(doc, s2cur->xmlChildrenNode, 1); |
443 if (sscanf((const char *)key, "%d", &ival) == 1) |
455 if (sscanf((const char *)key, "%d", &ival) == 1) |
444 recipe->hops[i].boiltime = ival; |
456 recipe->hops[i].boiltime = ival; |