thermferm/rdconfig.c

changeset 136
264e5ee5abfc
parent 106
1bd9a16f5061
child 158
f1b7e2ef90be
equal deleted inserted replaced
135:0882292322b3 136:264e5ee5abfc
439 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp4->uuid)) < 0) { 439 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp4->uuid)) < 0) {
440 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 440 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
441 return 1; 441 return 1;
442 } 442 }
443 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp4->name)) < 0) { 443 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp4->name)) < 0) {
444 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
445 return 1;
446 }
447 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUSY", "%d", tmp4->busy)) < 0) {
444 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 448 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
445 return 1; 449 return 1;
446 } 450 }
447 if (tmp4->steps) { 451 if (tmp4->steps) {
448 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) { 452 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) {
926 930
927 int parseProfile(xmlDocPtr doc, xmlNodePtr cur) 931 int parseProfile(xmlDocPtr doc, xmlNodePtr cur)
928 { 932 {
929 xmlChar *key; 933 xmlChar *key;
930 profiles_list *profile, *tmp; 934 profiles_list *profile, *tmp;
935 int ival;
931 936
932 profile = (profiles_list *)malloc(sizeof(profiles_list)); 937 profile = (profiles_list *)malloc(sizeof(profiles_list));
933 profile->next = NULL; 938 profile->next = NULL;
934 profile->version = 1; 939 profile->version = 1;
935 profile->uuid = profile->name = NULL; 940 profile->uuid = profile->name = NULL;
941 profile->busy = 0;
936 profile->steps = NULL; 942 profile->steps = NULL;
937 943
938 cur = cur->xmlChildrenNode; 944 cur = cur->xmlChildrenNode;
939 while (cur != NULL) { 945 while (cur != NULL) {
940 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { 946 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
949 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { 955 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
950 profile->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 956 profile->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
951 } 957 }
952 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { 958 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
953 profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 959 profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
960 }
961 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUSY"))) {
962 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
963 if (sscanf((const char *)key, "%d", &ival) == 1)
964 profile->busy = ival;
965 xmlFree(key);
954 } 966 }
955 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) { 967 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) {
956 parseSteps(doc, cur, &(profile)->steps); 968 parseSteps(doc, cur, &(profile)->steps);
957 } 969 }
958 cur = cur->next; 970 cur = cur->next;

mercurial