summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--download.c23
-rw-r--r--issue.h2
-rw-r--r--tocxml.c10
3 files changed, 8 insertions, 27 deletions
diff --git a/download.c b/download.c
index 6e83afb..6c9ccae 100644
--- a/download.c
+++ b/download.c
@@ -161,25 +161,10 @@ void downloadissue(CURL *curl_handle, char * directory, iss * issue, int force)
scanf("%s", newdir); /* TODO: incorporate tab-completion */
}
- /* not reliable - workaround until malloc is completed */
- if(!strncmp(issue->cover.uri, "http://www.", 11))
- {
- snprintf(filename,STR_MAX,"%s/cover.pdf", newdir);
- if(!force){
- testfile = fopen(filename, "r");
- if(!testfile)
- save_file(curl_handle, issue->cover.uri, filename);
- else
- {
- fclose(testfile);
- printf("Skipping download of cover\n");
- }
- }
- else
- save_file(curl_handle, issue->cover.uri, filename);
- }
-
- for(cur_section = issue->section; cur_section->number>0 && cur_section->number<=SEC_NO; cur_section++)
+ int count;
+ for(cur_section = issue->section, count = 0;
+ count <= issue->no_of_sections;
+ cur_section++, count++)
{
snprintf(filename,STR_MAX,"%s/section_%i.pdf", newdir, cur_section->number);
if(!force){
diff --git a/issue.h b/issue.h
index a0eda1f..f9aae18 100644
--- a/issue.h
+++ b/issue.h
@@ -19,7 +19,7 @@
*
*/
-#define SEC_NO 4
+#define SEC_NO 5
#define ITEM_NO 30
#define MED_NO 2
diff --git a/tocxml.c b/tocxml.c
index a909d5c..db9f9a3 100644
--- a/tocxml.c
+++ b/tocxml.c
@@ -102,7 +102,7 @@ iss ** parsetoc(char *filepath, int * iss_no, int * latest)
cnode = cnode->next;
}
}
- node = node->next;
+ node = node->next;
}
xmlFreeDoc(file);
@@ -128,12 +128,8 @@ int parseissue(xmlDocPtr file, xmlNodePtr node, iss * cur_issue, int * latest)
node = node->xmlChildrenNode;
while(node != NULL){
- if(!xmlStrcmp(node->name, (const xmlChar *) "cover"))
- {
- cur_section = &(cur_issue->cover);
- parsesection(file, node, cur_section);
- }
- else if(!xmlStrncmp(node->name, (char *) "section",7))
+ if(!xmlStrncmp(node->name, (char *) "section",7) ||
+ !xmlStrcmp(node->name, (const xmlChar *) "cover"))
{
no_of_sections++;
cur_section = &(cur_issue->section[no_of_sections]);