From e91ec0d87aa31cb465fe8cf934d405ad56342eba Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 19 May 2010 17:15:41 +0100 Subject: 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. --- getht.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 getht.h (limited to 'getht.h') 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 +#include + +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); -- cgit v1.2.3