thermferm/rdconfig.c

changeset 92
116226a8c70a
parent 91
901ca9858a7a
child 95
2c28afc329a5
equal deleted inserted replaced
91:901ca9858a7a 92:116226a8c70a
416 } 416 }
417 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { 417 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
418 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); 418 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
419 return 1; 419 return 1;
420 } 420 }
421 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DURATION", "%d", tmp5->duration)) < 0) { 421 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "RESTTIME", "%d", tmp5->resttime)) < 0) {
422 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 422 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
423 return 1;
424 }
425 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STEPTIME", "%d", tmp5->steptime)) < 0) {
426 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
423 return 1; 427 return 1;
424 } 428 }
425 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET", "%.1f", tmp5->target)) < 0) { 429 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET", "%.1f", tmp5->target)) < 0) {
426 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 430 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
427 return 1; 431 return 1;
789 prof_step *step, *tmp; 793 prof_step *step, *tmp;
790 794
791 step = (prof_step *)malloc(sizeof(prof_step)); 795 step = (prof_step *)malloc(sizeof(prof_step));
792 step->next = NULL; 796 step->next = NULL;
793 step->version = 1; 797 step->version = 1;
794 step->duration = 0; 798 step->steptime = step->resttime = 0;
795 step->target = 20.0; 799 step->target = 20.0;
796 800
797 cur = cur->xmlChildrenNode; 801 cur = cur->xmlChildrenNode;
798 while (cur != NULL) { 802 while (cur != NULL) {
799 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { 803 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
803 return 1; 807 return 1;
804 } 808 }
805 step->version = 1; 809 step->version = 1;
806 xmlFree(key); 810 xmlFree(key);
807 } 811 }
808 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DURATION"))) { 812 if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESTTIME"))) {
809 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 813 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
810 if (sscanf((const char *)key, "%d", &ival) == 1) 814 if (sscanf((const char *)key, "%d", &ival) == 1)
811 step->duration = ival; 815 step->resttime = ival;
816 xmlFree(key);
817 }
818 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPTIME"))) {
819 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
820 if (sscanf((const char *)key, "%d", &ival) == 1)
821 step->steptime = ival;
812 xmlFree(key); 822 xmlFree(key);
813 } 823 }
814 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET"))) { 824 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET"))) {
815 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 825 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
816 if (sscanf((const char *)key, "%f", &val) == 1) 826 if (sscanf((const char *)key, "%f", &val) == 1)

mercurial