HTTrack Website Copier
Free software offline browser - FORUM
Subject: Re: Passing arguments to callback functions broken
Author: Xavier Roche
Date: 04/21/2007 15:01
 
> 4. Passing arguments
> like "httrack --wrapper
> /full/path/to/libfilename2.so,args", which is
> documented as the correct way to pass args in
> <http://www.httrack.com/html/plug.html>, doesn't work:

The full path versus-relative path depends on the operating system ; I guess
that with a correct LD_LIBRARY_PATH, it should work.

Regarding the arguments problem, yes, this is obviously a bug ; here's the
patch:

--- htscoremain.c.orig  2007-04-21 14:54:22.140808250 +0200
+++ htscoremain.c       2007-04-21 14:58:10.000000000 +0200
@@ -1248,7 +1248,17 @@
                 for(pos = a ; *pos != '\0' && *pos != '=' && *pos != ',' &&
*pos != ':' ; pos++);
                 /* httrack --wrapper callback[,foo] */
                 if (*pos == 0 || *pos == ',' || *pos == ':') {
-                  int ret = plug_wrapper(opt, argv[na + 1], argv[na + 1]);
+                  int ret;
+                  char *moduleName;
+                  if (*pos == ',' || *pos == ':') {
+                    *pos = '\0';
+                    moduleName = strdupt(argv[na + 1]);
+                    *pos = ',';   /* foce seperator to ',' */
+                  } else {
+                    moduleName = strdupt(argv[na + 1]);
+                  }
+                  ret = plug_wrapper(opt, moduleName, argv[na + 1]);
+                  freet(moduleName);
                   if (ret == 0) {
                     char BIGSTK tmp[1024 * 2];
                     sprintf(tmp, "option %%W : unable to plug the module %s
(returncode != 1)", a);

(fixed the the next release)

Thanks for the feedback!
 
Reply Create subthread


All articles

Subject Author Date
Passing arguments to callback functions broken?

04/18/2007 12:58
Re: Passing arguments to callback functions broken

04/21/2007 15:01
Re: Passing arguments to callback functions broken

04/23/2007 14:40
Re: Passing arguments to callback functions broken

04/23/2007 18:41




a

Created with FORUM 2.0.11