| 29 | |
| 30 | |
| 31 | int xml_load(RIG *my_rig, const char *infilename) |
| 32 | { |
| 33 | #ifdef HAVE_XML2 |
| 34 | xmlDocPtr Doc; |
| 35 | xmlNodePtr node; |
| 36 | |
| 37 | /* load xlm Doc */ |
| 38 | Doc = xmlParseFile(infilename); |
| 39 | |
| 40 | if (Doc == NULL) |
| 41 | { |
| 42 | fprintf(stderr, "xmlParse failed\n"); |
| 43 | exit(2); |
| 44 | } |
| 45 | |
| 46 | node = xmlDocGetRootElement(Doc); |
| 47 | |
| 48 | if (node == NULL) |
| 49 | { |
| 50 | fprintf(stderr, "get root failed\n"); |
| 51 | exit(2); |
| 52 | } |
| 53 | |
| 54 | if (strcmp((char *) node->name, "hamlib")) |
| 55 | { |
| 56 | fprintf(stderr, "no hamlib tag found\n"); |
| 57 | exit(2); |
| 58 | } |
| 59 | |
| 60 | for (node = node->xmlChildrenNode; node != NULL; node = node->next) |
| 61 | { |
| 62 | if (xmlNodeIsText(node)) |
| 63 | { |
| 64 | continue; |
| 65 | } |
| 66 | |
| 67 | if (strcmp((char *) node->name, "channels") == 0) |
| 68 | { |
| 69 | break; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if (node == NULL) |
| 74 | { |
| 75 | fprintf(stderr, "no channels\n"); |
| 76 | exit(2); |
| 77 | } |
| 78 | |
| 79 | for (node = node->xmlChildrenNode; node != NULL; node = node->next) |
| 80 | { |
| 81 | channel_t chan; |
| 82 | int status; |
| 83 | |
| 84 | if (xmlNodeIsText(node)) |
| 85 | { |
| 86 | continue; |
| 87 | } |
| 88 |
no test coverage detected