Hi All,
I have had a re-think on the patch I submitted. It works for examples such as:-
<retrieve>
<from>http://foo.com/bar.deb</from>
<to>/tmp/</to>
</retrieve>
However, it will not work for examples such as:-
<retrieve>
<from>http://foo.com/bar.txt</from>
<to>/tmp/foo.txt</to>
</retrieve>
Below is another improved patch. However my c skills are very, very
rusty. I can not remember the last time I did some c. Please can
someone review my 1337 coding, before it is submitted to the svn
repository.
Regards,
Brendan
Index: makemodule.c
===================================================================
--- makemodule.c (revision 2471)
+++ makemodule.c (working copy)
@@ -550,7 +550,17 @@
gchar *http_s = "http://";
if (strncmp(r->from,http_s,strlen(http_s)) == 0) {
- gchar *cmdline = g_strdup_printf("wget
-P %s/%s %s",module->dirname,r->to,r->from);
+ #If the last charactor of r->from is a
/ then we need wget -P else wget -O
+ char * pch;
+ char wgetopt;
+ pch=strrchr(r->from,'/');
+ if (pch-r->from == strlen(r->from)-1) {
+ wgetopt='P';
+ }
+ else {
+ wgetopt='O';
+ }
+ gchar *cmdline = g_strdup_printf("wget
-%c %s/%s %s",wgetopt,module->dirname,r->to,r->from);
if (!ExecuteCommand(cmdline)) {
fprintf(stderr,"Warning:
unable to execute retrieval: %s\n",r->from);
}
|