From MAILER-DAEMON Fri May 02 10:34:49 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JrwLZ-0002Ve-C9 for mharc-getht-commit@gnu.org; Fri, 02 May 2008 10:34:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JrwLY-0002V6-GB for getht-commit@nongnu.org; Fri, 02 May 2008 10:34:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JrwLX-0002Uj-AF for getht-commit@nongnu.org; Fri, 02 May 2008 10:34:48 -0400 Received: from [199.232.76.173] (port=43057 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JrwLX-0002Uc-4g for getht-commit@nongnu.org; Fri, 02 May 2008 10:34:47 -0400 Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JrwLV-0004gC-VF for getht-commit@nongnu.org; Fri, 02 May 2008 10:34:46 -0400 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id D0F63104559 for ; Fri, 2 May 2008 10:34:42 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 02 May 2008 10:34:42 -0400 X-Sasl-enc: Zsqkm5EeFGCSUohO4xAdQqAFAVgfNElGVqm81BWBhO2I 1209738881 Received: from localhost (unknown [194.80.176.253]) by mail.messagingengine.com (Postfix) with ESMTPSA id E76382C109 for ; Fri, 2 May 2008 10:34:41 -0400 (EDT) Date: Fri, 2 May 2008 15:33:05 +0100 From: Nick To: getht-commit@nongnu.org Message-ID: <20080502143304.GA19457@grace.lamp.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Getht-commit] arch commit: getht--mainline--0.1--patch-46 X-BeenThere: getht-commit@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: getht-general@nongnu.org List-Id: Repository Commit List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2008 14:34:48 -0000 Revision: getht--mainline--0.1--patch-46 Archive: getht@sv.gnu.org Creator: Nick White Date: Fri May 2 15:32:27 BST 2008 Standard-date: 2008-05-02 14:32:27 GMT Modified-files: src/download.c src/getht.c New-patches: getht@sv.gnu.org/getht--mainline--0.1--patch-46 Summary: Fixed resume bug, improved download output Keywords: Fixed bug in resume which caused forced redownloads to create invalid pdfs Changed download output to ensure one line per download (rather than a separate one for progress) Changed download output to display name of file rather than url downloading Removed obselete testfile variable Changed variable name of filename->filepath M src/download.c M src/getht.c * modified files --- orig/src/download.c +++ mod/src/download.c @@ -43,17 +43,18 @@ extern char proxy_pass[STR_MAX]; extern CURL *main_curl_handle; -int save_file(CURL *curl_handle, char *uri, char *filepath, long resume_offset) +int save_file(CURL *curl_handle, char *uri, char *filepath, char *filetitle, long resume_offset) /* Save the file *uri to *filepath */ { - printf("Downloading %s\n",uri); + printf("Downloading %s ",filetitle); + fflush(stdout); if(!curl_handle) curl_handle = main_curl_handle; if(curl_handle) { FILE *file; - file = fopen(filepath, "a"); + file = fopen(filepath, resume_offset?"a":"w"); if(!file) { fprintf(stderr,"Error: cannot open file %s for writing.\n",filepath); @@ -100,7 +101,7 @@ fclose(file); - printf("\n"); + printf("\rDownloaded %s \n",filetitle); } else { fprintf(stderr,"Error: curl failed to initialise.\n"); @@ -126,7 +127,7 @@ else frac = 0; - printf("\rDownload progress: %3.0lf%% ", frac); + printf("\b\b\b\b\b\b\b: %3.0lf%% ", frac); fflush(stdout); return 0; @@ -185,12 +186,12 @@ sec * cur_section; char newdir[STR_MAX]; char filename[STR_MAX]; - FILE * testfile; + char filepath[STR_MAX]; snprintf(newdir,STR_MAX,"%s/%i_%i-%i",directory, issue->date.year,issue->date.firstmonth,issue->date.lastmonth); - printf("Downloading issue entitled '%s' to '%s'\n",issue->title,newdir); + printf("Downloading %s to %s\n",issue->title, newdir); if(!opendir(newdir)) if(mkdir(newdir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) @@ -204,12 +205,13 @@ { cur_section = issue->section[count]; - snprintf(filename,STR_MAX,"%s/section_%i.pdf", newdir, cur_section->number); + snprintf(filename,STR_MAX,"section_%i.pdf", cur_section->number); + snprintf(filepath,STR_MAX,"%s/%s", newdir, filename); if(!force){ struct stat fileinfo; /* see if local file exists */ - if(stat(filename, &fileinfo)) - save_file(curl_handle, cur_section->uri, filename, 0); + if(stat(filepath, &fileinfo)) + save_file(curl_handle, cur_section->uri, filepath, filename, 0); else { /* get size of local file */ @@ -222,12 +224,12 @@ /* if size of local file != size of remote file, resume */ if(remotesize > 0 && localsize < remotesize) - save_file(curl_handle, cur_section->uri, filename, localsize); + save_file(curl_handle, cur_section->uri, filepath, filename, localsize); else printf("Skipping download of completed section %i\n", cur_section->number); } } else - save_file(curl_handle, cur_section->uri, filename, 0); + save_file(curl_handle, cur_section->uri, filepath, filename, 0); } } --- orig/src/getht.c +++ mod/src/getht.c @@ -203,7 +203,7 @@ int update_contents_files() /* Returns 0 on success, 1 on failure */ { - if(save_file(NULL, issue_uri, issue_xml, 0)) + if(save_file(NULL, issue_uri, issue_xml, "contents", 0)) return 1; else return 0; From MAILER-DAEMON Fri May 02 21:04:33 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Js6Ay-0007p4-Ty for mharc-getht-commit@gnu.org; Fri, 02 May 2008 21:04:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Js6Ax-0007oz-F5 for getht-commit@nongnu.org; Fri, 02 May 2008 21:04:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Js6At-0007k9-NM for getht-commit@nongnu.org; Fri, 02 May 2008 21:04:30 -0400 Received: from [199.232.76.173] (port=35456 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Js6At-0007k4-HO for getht-commit@nongnu.org; Fri, 02 May 2008 21:04:27 -0400 Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Js6At-00083p-7K for getht-commit@nongnu.org; Fri, 02 May 2008 21:04:27 -0400 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id C80DE104DDB for ; Fri, 2 May 2008 21:04:26 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 02 May 2008 21:04:26 -0400 X-Sasl-enc: 4boXJAg1yTybP+YoBiupnsSLP8/klLHV0b2ZjL+9U9H6 1209776665 Received: from localhost (unknown [194.80.176.253]) by mail.messagingengine.com (Postfix) with ESMTPSA id EEB5415A03 for ; Fri, 2 May 2008 21:04:25 -0400 (EDT) Date: Sat, 3 May 2008 02:02:46 +0100 From: Nick To: getht-commit@nongnu.org Message-ID: <20080503010246.GA8275@grace.lamp.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Getht-commit] arch commit: getht--mainline--0.1--patch-47 X-BeenThere: getht-commit@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: getht-general@nongnu.org List-Id: Repository Commit List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2008 01:04:32 -0000 Revision: getht--mainline--0.1--patch-47 Archive: getht@sv.gnu.org Creator: Nick White Date: Sat May 3 02:01:32 BST 2008 Standard-date: 2008-05-03 01:01:32 GMT Modified-files: src/getht.c New-patches: getht@sv.gnu.org/getht--mainline--0.1--patch-47 Summary: Removed extraneous xml string variable Keywords: Removed variable already serviced by a DEFINE M src/getht.c * modified files --- orig/src/getht.c +++ mod/src/getht.c @@ -36,7 +36,6 @@ int proxy_auth; char proxy_user[STR_MAX]; char proxy_pass[STR_MAX]; char issue_xml[STR_MAX]; -char issue_uri[STR_MAX]; CURL *main_curl_handle; int main(int argc, char *argv[]) @@ -57,8 +56,6 @@ snprintf(issue_xml,STR_MAX,"%s/%s",getht_path,ISS_XML_FILE); - strncpy(issue_uri,XML_TOC_URI,STR_MAX); - snprintf(save_path,STR_MAX,"%s/hinduism_today",getenv("HOME")); int downall = 0; @@ -75,7 +72,7 @@ proxy_pass[0] = '\0'; if(loadconfig(getht_path, &save_path, &update) != 0) - writefreshconfig(getht_path, &save_path, &update, &issue_uri); + writefreshconfig(getht_path, &save_path, &update, XML_TOC_URI); if(!opendir(save_path)) if(mkdir(save_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) @@ -203,7 +200,7 @@ int update_contents_files() /* Returns 0 on success, 1 on failure */ { - if(save_file(NULL, issue_uri, issue_xml, "contents", 0)) + if(save_file(NULL, XML_TOC_URI, issue_xml, "contents", 0)) return 1; else return 0; From MAILER-DAEMON Fri May 02 21:15:23 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Js6LT-0003tr-Ir for mharc-getht-commit@gnu.org; Fri, 02 May 2008 21:15:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Js6LS-0003sG-0v for getht-commit@nongnu.org; Fri, 02 May 2008 21:15:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Js6LR-0003rK-3j for getht-commit@nongnu.org; Fri, 02 May 2008 21:15:21 -0400 Received: from [199.232.76.173] (port=45372 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Js6LQ-0003r8-W0 for getht-commit@nongnu.org; Fri, 02 May 2008 21:15:21 -0400 Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Js6LQ-0001Vv-Q9 for getht-commit@nongnu.org; Fri, 02 May 2008 21:15:20 -0400 Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 46A52104C7C for ; Fri, 2 May 2008 21:15:20 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 02 May 2008 21:15:20 -0400 X-Sasl-enc: J9o+4/a6dc7jq1f7kusuwO8CBoxf7ksbs10k8BMchjYm 1209777319 Received: from localhost (unknown [194.80.176.253]) by mail.messagingengine.com (Postfix) with ESMTPSA id B4B1B36973 for ; Fri, 2 May 2008 21:15:19 -0400 (EDT) Date: Sat, 3 May 2008 02:13:40 +0100 From: Nick To: getht-commit@nongnu.org Message-ID: <20080503011340.GA8433@grace.lamp.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Getht-commit] arch commit: getht--mainline--0.1--patch-48 X-BeenThere: getht-commit@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: getht-general@nongnu.org List-Id: Repository Commit List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2008 01:15:22 -0000 Revision: getht--mainline--0.1--patch-48 Archive: getht@sv.gnu.org Creator: Nick White Date: Sat May 3 02:12:44 BST 2008 Standard-date: 2008-05-03 01:12:44 GMT Modified-files: src/getht.c New-patches: getht@sv.gnu.org/getht--mainline--0.1--patch-48 Summary: Reverted from previous silly commit Keywords: Last commit was based on a false assumption of mine, this undoes it. M src/getht.c * modified files --- orig/src/getht.c +++ mod/src/getht.c @@ -36,7 +36,8 @@ int proxy_auth; char proxy_user[STR_MAX]; char proxy_pass[STR_MAX]; char issue_xml[STR_MAX]; -CURL *main_curl_handle; +char issue_uri[STR_MAX]; +CURL *main_curl_handle; int main(int argc, char *argv[]) { @@ -56,6 +57,8 @@ snprintf(issue_xml,STR_MAX,"%s/%s",getht_path,ISS_XML_FILE); + strncpy(issue_uri,XML_TOC_URI,STR_MAX); + snprintf(save_path,STR_MAX,"%s/hinduism_today",getenv("HOME")); int downall = 0; @@ -72,7 +75,7 @@ proxy_pass[0] = '\0'; if(loadconfig(getht_path, &save_path, &update) != 0) - writefreshconfig(getht_path, &save_path, &update, XML_TOC_URI); + writefreshconfig(getht_path, &save_path, &update, &issue_uri); if(!opendir(save_path)) if(mkdir(save_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) @@ -200,7 +203,7 @@ int update_contents_files() /* Returns 0 on success, 1 on failure */ { - if(save_file(NULL, XML_TOC_URI, issue_xml, "contents", 0)) + if(save_file(NULL, issue_uri, issue_xml, "contents", 0)) return 1; else return 0; From MAILER-DAEMON Fri May 02 22:18:27 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Js7KV-0001St-OS for mharc-getht-commit@gnu.org; Fri, 02 May 2008 22:18:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Js7KU-0001So-LR for getht-commit@nongnu.org; Fri, 02 May 2008 22:18:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Js7KS-0001Sc-NI for getht-commit@nongnu.org; Fri, 02 May 2008 22:18:25 -0400 Received: from [199.232.76.173] (port=58749 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Js7KS-0001SZ-K4 for getht-commit@nongnu.org; Fri, 02 May 2008 22:18:24 -0400 Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Js7KS-0000wA-Kc for getht-commit@nongnu.org; Fri, 02 May 2008 22:18:24 -0400 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 205C310498C for ; Fri, 2 May 2008 22:18:20 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 02 May 2008 22:18:20 -0400 X-Sasl-enc: mZ7E8pU6ACXje7j7YvxnpMw7XvovDy8ccXHLd/BboLzv 1209781099 Received: from localhost (unknown [194.80.176.253]) by mail.messagingengine.com (Postfix) with ESMTPSA id 5BBB41E04F for ; Fri, 2 May 2008 22:18:19 -0400 (EDT) Date: Sat, 3 May 2008 03:16:39 +0100 From: Nick To: getht-commit@nongnu.org Message-ID: <20080503021639.GA10678@grace.lamp.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Getht-commit] arch commit: getht--mainline--0.1--patch-50 X-BeenThere: getht-commit@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: getht-general@nongnu.org List-Id: Repository Commit List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2008 02:18:26 -0000 Revision: getht--mainline--0.1--patch-50 Archive: getht@sv.gnu.org Creator: Nick White Date: Sat May 3 03:14:24 BST 2008 Standard-date: 2008-05-03 02:14:24 GMT Modified-files: src/Makefile.am src/getht.h New-patches: getht@sv.gnu.org/getht--mainline--0.1--patch-50 Summary: Corrected minor make error Keywords: (from last commit - not sure if it went smoothly) Altered name of issuepath config variable to savepath, in config.ini as well as code Altered name of issue_xml config variable to toc_xml Removed unnecessary variable definitions from header (new commit) Corrected introduced Makefile error Added (currently unused) config options structure M src/getht.h M src/Makefile.am * modified files --- orig/src/Makefile.am +++ mod/src/Makefile.am @@ -4,4 +4,4 @@ getht_SOURCES = config.c cli.c download.c getht.c issuemem.c \ tocxml.c xml.c \ - config.h getht.h issue.h version.h + getht.h issue.h version.h --- orig/src/getht.h +++ mod/src/getht.h @@ -26,3 +26,23 @@ #define ISS_XML_FILE "htde_toc.xml" #define STR_MAX 512 + +#include + +struct config { + char * proxytype; + char * proxyauth; + char proxy_addr[STR_MAX]; + long proxy_port; + char proxy_user[STR_MAX]; + char proxy_pass[STR_MAX]; + + char toc_xml[STR_MAX]; + char issue_uri[STR_MAX]; + + char save_path[STR_MAX]; + + int startup_check; + + CURL *curl_handle; +};