summaryrefslogtreecommitdiff
path: root/getht.h
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-05-19 17:15:41 +0100
committerNick White <git@njw.me.uk>2010-05-19 17:15:41 +0100
commite91ec0d87aa31cb465fe8cf934d405ad56342eba (patch)
tree1709e437c0d8f144bec479975a777c6ae8580eba /getht.h
parent6cf58b46037cf04915fa507813ab7419db2e45ec (diff)
Switched to simpler build system, and fixed bugs
Now there's a proper build system in place, which is actually simple enough to understand. I also fixed plenty of warnings about the code (reminding me how badly I knew C when I wrote this). Hinduism today aren't indexing their new issues using the index file I was sourcing any more, so I don't expect to fix any more bugs or improve this much.
Diffstat (limited to 'getht.h')
-rw-r--r--getht.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/getht.h b/getht.h
new file mode 100644
index 0000000..4ec9b01
--- /dev/null
+++ b/getht.h
@@ -0,0 +1,92 @@
+/*
+ * This file is part of GetHT
+ *
+ * See COPYING file for copyright, license and warranty details.
+ *
+ */
+
+#define XML_TOC_URI "http://www.hinduismtoday.com/digital/htde_toc.xml"
+
+#define ISS_XML_FILE "htde_toc.xml"
+
+#define STR_MAX 512
+
+#include <curl/curl.h>
+#include <libxml/xmlmemory.h>
+
+struct proxy_options {
+ char type;
+ char auth;
+ char address[STR_MAX];
+ long port;
+ char user[STR_MAX];
+ char pass[STR_MAX];
+};
+
+struct config {
+ char toc_xml[STR_MAX];
+ char issue_uri[STR_MAX];
+
+ char save_path[STR_MAX];
+
+ struct proxy_options proxy;
+
+ int startup_check;
+
+ int verbose;
+ int quiet;
+
+ CURL *curl_handle;
+};
+
+typedef struct
+{
+ int year;
+ int firstmonth;
+ int lastmonth;
+} issdates;
+
+typedef struct
+{
+ int firstpage;
+ int lastpage;
+ char * title;
+} it;
+
+typedef struct
+{
+ char uri[512];
+ char title[512];
+ int number;
+ int size;
+ it ** item;
+ int no_of_items;
+} sec;
+
+typedef struct
+{
+ char preview_uri[512];
+ char title[512];
+ int size;
+ issdates date;
+ sec ** section;
+ int no_of_sections;
+} iss;
+
+iss ** parsetoc(char *filepath, int * iss_no);
+
+iss ** assignnew_iss(iss ** issue, int *no_of_issues);
+sec ** assignnew_sec(sec ** section, int * no_of_sections);
+it ** assignnew_it(it ** item, int * no_of_items);
+
+int updateconfig(char * getht_path, struct config * options);
+int loadconfig(char * getht_path, struct config * options);
+int writefreshconfig(char * getht_path, struct config * options);
+void showusage();
+void downloadissue(struct config * options, iss * issue, int force);
+char * getissuedir(struct config * options, iss * issue);
+void downloadsection(struct config * options, sec * section, char * downdir, int force);
+void list_issues(iss ** issue, int no_of_issues, int verbose);
+int save_file(char *uri, char *filepath, char *filetitle, long resume_offset, struct config * options);
+int ready_xml(char * filepath, char * rootnode, xmlDocPtr * file, xmlNodePtr * node);
+int issuesort(iss ** issue, int no_of_issues);