From 1ecdfbe3b855b1f13bcddccc20135f7e35f171a6 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Mon, 19 Mar 2012 13:00:51 +0000 Subject: httrack 3.43.12 --- libtest/Makefile.in | 3 + libtest/callbacks-example-baselinks.c | 236 ++++++++--------- libtest/callbacks-example-changecontent.c | 118 ++++----- libtest/callbacks-example-contentfilter.c | 300 ++++++++++----------- libtest/callbacks-example-displayheader.c | 132 +++++----- libtest/callbacks-example-filename.c | 172 ++++++------ libtest/callbacks-example-filename2.c | 260 +++++++++---------- libtest/callbacks-example-filenameiisbug.c | 138 +++++----- libtest/callbacks-example-listlinks.c | 266 +++++++++---------- libtest/callbacks-example-log.c | 228 ++++++++-------- libtest/callbacks-example-simple.c | 178 ++++++------- libtest/example.c | 402 ++++++++++++++--------------- libtest/example.h | 68 ++--- libtest/readme.txt | 112 ++++---- 14 files changed, 1308 insertions(+), 1305 deletions(-) (limited to 'libtest') diff --git a/libtest/Makefile.in b/libtest/Makefile.in index f807ce2..95683d4 100644 --- a/libtest/Makefile.in +++ b/libtest/Makefile.in @@ -59,6 +59,7 @@ DEFAULT_CFLAGS = @DEFAULT_CFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -83,6 +84,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -92,6 +94,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ diff --git a/libtest/callbacks-example-baselinks.c b/libtest/callbacks-example-baselinks.c index 63b5175..246c921 100755 --- a/libtest/callbacks-example-baselinks.c +++ b/libtest/callbacks-example-baselinks.c @@ -1,118 +1,118 @@ -/* - HTTrack external callbacks example : enforce a constant base href - Can be useful to make copies of site's archives using site's URL base href as root reference - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local function definitions */ -static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file); -static int check_detectedlink(t_hts_callbackarg *carg, httrackp* opt, char* link); -static int check_detectedlink_end(t_hts_callbackarg *carg, httrackp *opt); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Check args */ - fprintf(stderr, "Plugged..\n"); - if (arg == NULL || *arg == '\0' || strlen(arg) >= HTS_URLMAXSIZE / 2) { - fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); - fprintf(stderr, "usage: httrack --wrapper modulename,base\n"); - fprintf(stderr, "example: httrack --wrapper callback,http://www.example.com/\n"); - return 0; /* failed */ - } else { - char *callbacks_userdef = strdup(arg); /* userdef */ - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, check_html, process_file, callbacks_userdef); - CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, callbacks_userdef); - CHAIN_FUNCTION(opt, end, check_detectedlink_end, callbacks_userdef); - - fprintf(stderr, "Using root '%s'\n", callbacks_userdef); - } - - return 1; /* success */ -} - -static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file) { - char* prevBase; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { - return 0; /* Abort */ - } - } - - /* Disable base href, if any */ - if ( ( prevBase = strstr(html, " +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local function definitions */ +static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file); +static int check_detectedlink(t_hts_callbackarg *carg, httrackp* opt, char* link); +static int check_detectedlink_end(t_hts_callbackarg *carg, httrackp *opt); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Check args */ + fprintf(stderr, "Plugged..\n"); + if (arg == NULL || *arg == '\0' || strlen(arg) >= HTS_URLMAXSIZE / 2) { + fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); + fprintf(stderr, "usage: httrack --wrapper modulename,base\n"); + fprintf(stderr, "example: httrack --wrapper callback,http://www.example.com/\n"); + return 0; /* failed */ + } else { + char *callbacks_userdef = strdup(arg); /* userdef */ + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, check_html, process_file, callbacks_userdef); + CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, callbacks_userdef); + CHAIN_FUNCTION(opt, end, check_detectedlink_end, callbacks_userdef); + + fprintf(stderr, "Using root '%s'\n", callbacks_userdef); + } + + return 1; /* success */ +} + +static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file) { + char* prevBase; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { + return 0; /* Abort */ + } + } + + /* Disable base href, if any */ + if ( ( prevBase = strstr(html, "_init and _exit call (httrack >> 3.31) - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local function definitions */ -static int postprocess(t_hts_callbackarg *carg, httrackp *opt, - char** html, int* len, - const char* url_address, const char* url_file); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* -module entry point -*/ +/* + HTTrack external callbacks example : display all incoming request headers + Example of _init and _exit call (httrack >> 3.31) + .c file + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local function definitions */ +static int postprocess(t_hts_callbackarg *carg, httrackp *opt, + char** html, int* len, + const char* url_address, const char* url_file); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* +module entry point +*/ EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { const char *arg = strchr(argv, ','); if (arg != NULL) arg++; - - /* Plug callback functions */ + + /* Plug callback functions */ CHAIN_FUNCTION(opt, postprocess, postprocess, NULL); - return 1; /* success */ -} - -static int postprocess(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { - char *old = *html; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, postprocess) != NULL) { - if (CALLBACKARG_PREV_FUN(carg, postprocess)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { - /* Modified *html */ - old = *html; - } - } - - /* Process */ - *html = strdup(*html); - hts_free(old); - - return 1; -} + return 1; /* success */ +} + +static int postprocess(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { + char *old = *html; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, postprocess) != NULL) { + if (CALLBACKARG_PREV_FUN(carg, postprocess)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { + /* Modified *html */ + old = *html; + } + } + + /* Process */ + *html = strdup(*html); + hts_free(old); + + return 1; +} diff --git a/libtest/callbacks-example-contentfilter.c b/libtest/callbacks-example-contentfilter.c index 069a99f..489f24c 100755 --- a/libtest/callbacks-example-contentfilter.c +++ b/libtest/callbacks-example-contentfilter.c @@ -1,150 +1,150 @@ -/* - HTTrack external callbacks example : crawling html pages depending on content - Example of _init and _exit call (httrack >> 3.31) - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback,stringtofind,stringtofind.. .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local function definitions */ -static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename); -static int end(t_hts_callbackarg *carg, httrackp *opt); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* TOLOWER */ -#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a -#define TOLOWER(a) ( TOLOWER_( (a) ) ) - -/* - This sample just crawls pages that contains certain keywords, and skips the other ones -*/ - -typedef struct t_my_userdef { - char stringfilter[8192]; - char* stringfilters[128]; -} t_my_userdef; - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Check args */ - if (arg == NULL || *arg == '\0') { - fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); - fprintf(stderr, "usage: httrack --wrapper callback,stringtofind,stringtofind..\n"); - fprintf(stderr, "example: httrack --wrapper callback,apple,orange,lemon\n"); - return 0; - } else { - t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */ - char * const stringfilter = userdef->stringfilter; - char** const stringfilters = userdef->stringfilters; - /* */ - char* a = stringfilter; - int i = 0; - fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg); - fprintf(stderr, "** callback example: crawling pages only if specific keywords are found\n"); - - /* stringfilters = split(arg, ','); */ - strcpy(stringfilter, arg); - while(a != NULL) { - stringfilters[i] = a; - a = strchr(a, ','); - if (a != NULL) { - *a = '\0'; - a ++; - } - fprintf(stderr, "** callback info: will crawl pages with '%s' in them\n", stringfilters[i]); - i++; - } - stringfilters[i++] = NULL; - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, check_html, process, userdef); - CHAIN_FUNCTION(opt, end, end, userdef); - } - - return 1; /* success */ -} - -static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - char * const stringfilter = userdef->stringfilter; - char** const stringfilters = userdef->stringfilters; - /* */ - int i = 0; - int getIt = 0; - char* pos; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, address, filename)) { - return 0; /* Abort */ - } - } - - /* Process */ - if (strcmp(address, "primary") == 0 && strcmp(filename, "/primary") == 0) /* primary page (list of links) */ - return 1; - while(stringfilters[i] != NULL && ! getIt) { - if ( ( pos = strstr(html, stringfilters[i]) ) != NULL) { - int j; - getIt = 1; - fprintf(stderr, "** callback info: found '%s' keyword in '%s%s', crawling this page!\n", stringfilters[i], address, filename); - fprintf(stderr, "** details:\n(..)"); - for(j = 0; j < 72 && pos[j] ; j++) { - if (pos[j] > 32) - fprintf(stderr, "%c", pos[j]); - else - fprintf(stderr, "?"); - } - fprintf(stderr, "(..)\n"); - } - i++; - } - if (getIt) { - return 1; /* success */ - } else { - fprintf(stderr, "** callback info: won't parse '%s%s' (no specified keywords found)\n", address, filename); - return 0; /* this page sucks, don't parse it */ - } -} - -static int end(t_hts_callbackarg *carg, httrackp *opt) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - fprintf(stderr, "** info: wrapper_exit() called!\n"); - if (userdef != NULL) { - free(userdef); - userdef = NULL; - } - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} +/* + HTTrack external callbacks example : crawling html pages depending on content + Example of _init and _exit call (httrack >> 3.31) + .c file + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback,stringtofind,stringtofind.. .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local function definitions */ +static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename); +static int end(t_hts_callbackarg *carg, httrackp *opt); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* TOLOWER */ +#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a +#define TOLOWER(a) ( TOLOWER_( (a) ) ) + +/* + This sample just crawls pages that contains certain keywords, and skips the other ones +*/ + +typedef struct t_my_userdef { + char stringfilter[8192]; + char* stringfilters[128]; +} t_my_userdef; + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Check args */ + if (arg == NULL || *arg == '\0') { + fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); + fprintf(stderr, "usage: httrack --wrapper callback,stringtofind,stringtofind..\n"); + fprintf(stderr, "example: httrack --wrapper callback,apple,orange,lemon\n"); + return 0; + } else { + t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */ + char * const stringfilter = userdef->stringfilter; + char** const stringfilters = userdef->stringfilters; + /* */ + char* a = stringfilter; + int i = 0; + fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg); + fprintf(stderr, "** callback example: crawling pages only if specific keywords are found\n"); + + /* stringfilters = split(arg, ','); */ + strcpy(stringfilter, arg); + while(a != NULL) { + stringfilters[i] = a; + a = strchr(a, ','); + if (a != NULL) { + *a = '\0'; + a ++; + } + fprintf(stderr, "** callback info: will crawl pages with '%s' in them\n", stringfilters[i]); + i++; + } + stringfilters[i++] = NULL; + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, check_html, process, userdef); + CHAIN_FUNCTION(opt, end, end, userdef); + } + + return 1; /* success */ +} + +static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + char * const stringfilter = userdef->stringfilter; + char** const stringfilters = userdef->stringfilters; + /* */ + int i = 0; + int getIt = 0; + char* pos; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, address, filename)) { + return 0; /* Abort */ + } + } + + /* Process */ + if (strcmp(address, "primary") == 0 && strcmp(filename, "/primary") == 0) /* primary page (list of links) */ + return 1; + while(stringfilters[i] != NULL && ! getIt) { + if ( ( pos = strstr(html, stringfilters[i]) ) != NULL) { + int j; + getIt = 1; + fprintf(stderr, "** callback info: found '%s' keyword in '%s%s', crawling this page!\n", stringfilters[i], address, filename); + fprintf(stderr, "** details:\n(..)"); + for(j = 0; j < 72 && pos[j] ; j++) { + if (pos[j] > 32) + fprintf(stderr, "%c", pos[j]); + else + fprintf(stderr, "?"); + } + fprintf(stderr, "(..)\n"); + } + i++; + } + if (getIt) { + return 1; /* success */ + } else { + fprintf(stderr, "** callback info: won't parse '%s%s' (no specified keywords found)\n", address, filename); + return 0; /* this page sucks, don't parse it */ + } +} + +static int end(t_hts_callbackarg *carg, httrackp *opt) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + fprintf(stderr, "** info: wrapper_exit() called!\n"); + if (userdef != NULL) { + free(userdef); + userdef = NULL; + } + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-displayheader.c b/libtest/callbacks-example-displayheader.c index a8333b3..ae1efd4 100755 --- a/libtest/callbacks-example-displayheader.c +++ b/libtest/callbacks-example-displayheader.c @@ -1,66 +1,66 @@ -/* - HTTrack external callbacks example : display all incoming request headers - Example of _init and _exit call (httrack >> 3.31) - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local function definitions */ -static int process(t_hts_callbackarg *carg, httrackp *opt, - char* buff, const char* adr, const char* fil, - const char* referer_adr, const char* referer_fil, - htsblk* incoming); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, receivehead, process, NULL); - - return 1; /* success */ -} - -static int process(t_hts_callbackarg *carg, httrackp *opt, - char* buff, const char* adr, const char* fil, - const char* referer_adr, const char* referer_fil, - htsblk* incoming) { - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, receivehead) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, receivehead)(CALLBACKARG_PREV_CARG(carg), opt, buff, adr, fil, referer_adr, referer_fil, incoming)) { - return 0; /* Abort */ - } - } - - /* Process */ - printf("[ %s%s ]\n%s\n", adr, fil, buff); - - return 1; /* success */ -} +/* + HTTrack external callbacks example : display all incoming request headers + Example of _init and _exit call (httrack >> 3.31) + .c file + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local function definitions */ +static int process(t_hts_callbackarg *carg, httrackp *opt, + char* buff, const char* adr, const char* fil, + const char* referer_adr, const char* referer_fil, + htsblk* incoming); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, receivehead, process, NULL); + + return 1; /* success */ +} + +static int process(t_hts_callbackarg *carg, httrackp *opt, + char* buff, const char* adr, const char* fil, + const char* referer_adr, const char* referer_fil, + htsblk* incoming) { + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, receivehead) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, receivehead)(CALLBACKARG_PREV_CARG(carg), opt, buff, adr, fil, referer_adr, referer_fil, incoming)) { + return 0; /* Abort */ + } + } + + /* Process */ + printf("[ %s%s ]\n%s\n", adr, fil, buff); + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-filename.c b/libtest/callbacks-example-filename.c index a6c7fa1..361ebb0 100755 --- a/libtest/callbacks-example-filename.c +++ b/libtest/callbacks-example-filename.c @@ -1,86 +1,86 @@ -/* - HTTrack external callbacks example : changing the destination filename - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local function definitions */ -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* Options settings */ -#include "htsopt.h" - -/* TOLOWER */ -#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a -#define TOLOWER(a) ( TOLOWER_( (a) ) ) - -/* - This sample just changes the destination filenames to ROT-13 equivalent ; that is, - a -> n - b -> o - c -> p - d -> q - .. - n -> a - o -> b - .. - - -> - This sample can be improved, for example, to make a map of a website. -*/ - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, savename, mysavename, NULL); - - return 1; /* success */ -} - -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { - char* a; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { - return 0; /* Abort */ - } - } - - /* Process */ - for(a = save ; *a != 0 ; a++) { - char c = TOLOWER(*a); - if (c >= 'a' && c <= 'z') - *a = ( ( ( c - 'a' ) + 13 ) % 26 ) + 'a'; // ROT-13 - } - - return 1; /* success */ -} +/* + HTTrack external callbacks example : changing the destination filename + .c file + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local function definitions */ +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* Options settings */ +#include "htsopt.h" + +/* TOLOWER */ +#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a +#define TOLOWER(a) ( TOLOWER_( (a) ) ) + +/* + This sample just changes the destination filenames to ROT-13 equivalent ; that is, + a -> n + b -> o + c -> p + d -> q + .. + n -> a + o -> b + .. + + -> + This sample can be improved, for example, to make a map of a website. +*/ + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, savename, mysavename, NULL); + + return 1; /* success */ +} + +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { + char* a; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { + return 0; /* Abort */ + } + } + + /* Process */ + for(a = save ; *a != 0 ; a++) { + char c = TOLOWER(*a); + if (c >= 'a' && c <= 'z') + *a = ( ( ( c - 'a' ) + 13 ) % 26 ) + 'a'; // ROT-13 + } + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-filename2.c b/libtest/callbacks-example-filename2.c index a66420e..2683b7b 100755 --- a/libtest/callbacks-example-filename2.c +++ b/libtest/callbacks-example-filename2.c @@ -1,130 +1,130 @@ -/* - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback,string1,string2 .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Function definitions */ -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); -static int myend(t_hts_callbackarg *carg, httrackp *opt); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* TOLOWER */ -#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a -#define TOLOWER(a) ( TOLOWER_( (a) ) ) - -/* - This sample just replaces all occurences of "string1" into "string2" - string1 and string2 are passed in the callback string: - httrack --wrapper save-name=callback:mysavename,string1,string2 .. -*/ - -typedef struct t_my_userdef { - char string1[256]; - char string2[256]; -} t_my_userdef; - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Check args */ - if (arg == NULL || *arg == '\0' || strchr(arg, ',') == NULL) { - fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); - fprintf(stderr, "usage: httrack --wrapper save-name=callback:mysavename,string1,string2\n"); - fprintf(stderr, "example: httrack --wrapper save-name=callback:mysavename,foo,bar\n"); - return 0; /* failed */ - } else { - char *pos = strchr(arg, ','); - t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); - char * const string1 = userdef->string1; - char * const string2 = userdef->string2; - - /* Split args */ - fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg); - fprintf(stderr, "** callback example: changing destination filename word by another one\n"); - string1[0] = string1[1] = '\0'; - strncat(string1, arg, pos - arg); - strcpy(string2, pos + 1); - fprintf(stderr, "** callback info: will replace %s by %s in filenames!\n", string1, string2); - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, savename, mysavename, userdef); - CHAIN_FUNCTION(opt, end, myend, userdef); - } - - return 1; /* success */ -} - -static int myend(t_hts_callbackarg *carg, httrackp *opt) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - - fprintf(stderr, "** info: wrapper_exit() called!\n"); - if (userdef != NULL) { - free(userdef); - userdef = NULL; - } - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} - -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - char * const string1 = userdef->string1; - char * const string2 = userdef->string2; - /* */ - char *buff, *a, *b; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { - return 0; /* Abort */ - } - } - - /* Process */ - buff = strdup(save); - a = buff; - b = save; - *b = '\0'; /* the "save" variable points to a buffer with "sufficient" space */ - while(*a) { - if (strncmp(a, string1, (int)strlen(string1)) == 0) { - strcat(b, string2); - b += strlen(b); - a += strlen(string1); - } else { - *b++ = *a++; - *b = '\0'; - } - } - free(buff); - - return 1; /* success */ -} +/* + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback,string1,string2 .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Function definitions */ +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); +static int myend(t_hts_callbackarg *carg, httrackp *opt); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* TOLOWER */ +#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a +#define TOLOWER(a) ( TOLOWER_( (a) ) ) + +/* + This sample just replaces all occurences of "string1" into "string2" + string1 and string2 are passed in the callback string: + httrack --wrapper save-name=callback:mysavename,string1,string2 .. +*/ + +typedef struct t_my_userdef { + char string1[256]; + char string2[256]; +} t_my_userdef; + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Check args */ + if (arg == NULL || *arg == '\0' || strchr(arg, ',') == NULL) { + fprintf(stderr, "** callback error: arguments expected or bad arguments\n"); + fprintf(stderr, "usage: httrack --wrapper save-name=callback:mysavename,string1,string2\n"); + fprintf(stderr, "example: httrack --wrapper save-name=callback:mysavename,foo,bar\n"); + return 0; /* failed */ + } else { + char *pos = strchr(arg, ','); + t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); + char * const string1 = userdef->string1; + char * const string2 = userdef->string2; + + /* Split args */ + fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg); + fprintf(stderr, "** callback example: changing destination filename word by another one\n"); + string1[0] = string1[1] = '\0'; + strncat(string1, arg, pos - arg); + strcpy(string2, pos + 1); + fprintf(stderr, "** callback info: will replace %s by %s in filenames!\n", string1, string2); + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, savename, mysavename, userdef); + CHAIN_FUNCTION(opt, end, myend, userdef); + } + + return 1; /* success */ +} + +static int myend(t_hts_callbackarg *carg, httrackp *opt) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + + fprintf(stderr, "** info: wrapper_exit() called!\n"); + if (userdef != NULL) { + free(userdef); + userdef = NULL; + } + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} + +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + char * const string1 = userdef->string1; + char * const string2 = userdef->string2; + /* */ + char *buff, *a, *b; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { + return 0; /* Abort */ + } + } + + /* Process */ + buff = strdup(save); + a = buff; + b = save; + *b = '\0'; /* the "save" variable points to a buffer with "sufficient" space */ + while(*a) { + if (strncmp(a, string1, (int)strlen(string1)) == 0) { + strcat(b, string2); + b += strlen(b); + a += strlen(string1); + } else { + *b++ = *a++; + *b = '\0'; + } + } + free(buff); + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-filenameiisbug.c b/libtest/callbacks-example-filenameiisbug.c index 59c42f5..bd882cf 100755 --- a/libtest/callbacks-example-filenameiisbug.c +++ b/libtest/callbacks-example-filenameiisbug.c @@ -1,69 +1,69 @@ -/* - HTTrack external callbacks example : changing folder names ending with ".com" - with ".c0m" as a workaround of IIS bug (see KB 275601) - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Function definitions */ -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - CHAIN_FUNCTION(opt, savename, mysavename, NULL); - return 1; /* success */ -} - -/* - Replaces all "offending" IIS extensions (exe, dll..) with "nice" ones -*/ -static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { - static const char* iisBogus[] = { ".com", ".exe", ".dll", ".sh", NULL }; - static const char* iisBogusReplace[] = { ".c0m", ".ex3", ".dl1", ".5h", NULL }; /* MUST be the same sizes */ - char* a; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { - return 0; /* Abort */ - } - } - - /* Process */ - for(a = save ; *a != '\0' ; a++) { - int i; - for(i = 0 ; iisBogus[i] != NULL ; i++) { - int j; - for(j = 0 ; iisBogus[i][j] == a[j] && iisBogus[i][j] != '\0' ; j++); - if (iisBogus[i][j] == '\0' && ( a[j] == '\0' || a[j] == '/' || a[j] == '\\' ) ) { - strncpy(a, iisBogusReplace[i], strlen(iisBogusReplace[i])); - break; - } - } - } - - return 1; /* success */ -} +/* + HTTrack external callbacks example : changing folder names ending with ".com" + with ".c0m" as a workaround of IIS bug (see KB 275601) + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Function definitions */ +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + CHAIN_FUNCTION(opt, savename, mysavename, NULL); + return 1; /* success */ +} + +/* + Replaces all "offending" IIS extensions (exe, dll..) with "nice" ones +*/ +static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) { + static const char* iisBogus[] = { ".com", ".exe", ".dll", ".sh", NULL }; + static const char* iisBogusReplace[] = { ".c0m", ".ex3", ".dl1", ".5h", NULL }; /* MUST be the same sizes */ + char* a; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) { + return 0; /* Abort */ + } + } + + /* Process */ + for(a = save ; *a != '\0' ; a++) { + int i; + for(i = 0 ; iisBogus[i] != NULL ; i++) { + int j; + for(j = 0 ; iisBogus[i][j] == a[j] && iisBogus[i][j] != '\0' ; j++); + if (iisBogus[i][j] == '\0' && ( a[j] == '\0' || a[j] == '/' || a[j] == '\\' ) ) { + strncpy(a, iisBogusReplace[i], strlen(iisBogusReplace[i])); + break; + } + } + } + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-listlinks.c b/libtest/callbacks-example-listlinks.c index 9aef247..e602bd2 100755 --- a/libtest/callbacks-example-listlinks.c +++ b/libtest/callbacks-example-listlinks.c @@ -1,133 +1,133 @@ -/* - HTTrack external callbacks example - .c file - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -#include -#include -#include - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Function definitions */ -static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file); -static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link); -static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats); -static int end(t_hts_callbackarg *carg, httrackp *opt); - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); - -/* - This sample just lists all links in documents with the parent link: - -> - This sample can be improved, for example, to make a map of a website. -*/ - -typedef struct t_my_userdef { - char currentURLBeingParsed[2048]; -} t_my_userdef; - -/* -module entry point -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - t_my_userdef *userdef; - /* */ - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* Create user-defined structure */ - userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */ - userdef->currentURLBeingParsed[0] = '\0'; - - /* Plug callback functions */ - CHAIN_FUNCTION(opt, check_html, process_file, userdef); - CHAIN_FUNCTION(opt, end, end, userdef); - CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, userdef); - CHAIN_FUNCTION(opt, loop, check_loop, userdef); - - return 1; /* success */ -} - -static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - char * const currentURLBeingParsed = userdef->currentURLBeingParsed; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { - return 0; /* Abort */ - } - } - - /* Process */ - printf("now parsing %s%s..\n", url_address, url_file); - strcpy(currentURLBeingParsed, url_address); - strcat(currentURLBeingParsed, url_file); - - return 1; /* success */ -} - -static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - char * const currentURLBeingParsed = userdef->currentURLBeingParsed; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, linkdetected) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, linkdetected)(CALLBACKARG_PREV_CARG(carg), opt, link)) { - return 0; /* Abort */ - } - } - - /* Process */ - printf("[%s] -> [%s]\n", currentURLBeingParsed, link); - - return 1; /* success */ -} - -static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats) { - static int fun_animation=0; - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, loop) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, loop)(CALLBACKARG_PREV_CARG(carg), opt, back, back_max, back_index, lien_tot, lien_ntot, stat_time, stats)) { - return 0; /* Abort */ - } - } - - /* Process */ - printf("%c\r", "/-\\|"[(fun_animation++)%4]); - return 1; -} - -static int end(t_hts_callbackarg *carg, httrackp *opt) { - t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); - fprintf(stderr, "** info: wrapper_exit() called!\n"); - if (userdef != NULL) { - free(userdef); - userdef = NULL; - } - - /* Call parent functions if multiple callbacks are chained. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} +/* + HTTrack external callbacks example + .c file + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +#include +#include +#include + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Function definitions */ +static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file); +static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link); +static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats); +static int end(t_hts_callbackarg *carg, httrackp *opt); + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); + +/* + This sample just lists all links in documents with the parent link: + -> + This sample can be improved, for example, to make a map of a website. +*/ + +typedef struct t_my_userdef { + char currentURLBeingParsed[2048]; +} t_my_userdef; + +/* +module entry point +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + t_my_userdef *userdef; + /* */ + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* Create user-defined structure */ + userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */ + userdef->currentURLBeingParsed[0] = '\0'; + + /* Plug callback functions */ + CHAIN_FUNCTION(opt, check_html, process_file, userdef); + CHAIN_FUNCTION(opt, end, end, userdef); + CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, userdef); + CHAIN_FUNCTION(opt, loop, check_loop, userdef); + + return 1; /* success */ +} + +static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + char * const currentURLBeingParsed = userdef->currentURLBeingParsed; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) { + return 0; /* Abort */ + } + } + + /* Process */ + printf("now parsing %s%s..\n", url_address, url_file); + strcpy(currentURLBeingParsed, url_address); + strcat(currentURLBeingParsed, url_file); + + return 1; /* success */ +} + +static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + char * const currentURLBeingParsed = userdef->currentURLBeingParsed; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, linkdetected) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, linkdetected)(CALLBACKARG_PREV_CARG(carg), opt, link)) { + return 0; /* Abort */ + } + } + + /* Process */ + printf("[%s] -> [%s]\n", currentURLBeingParsed, link); + + return 1; /* success */ +} + +static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats) { + static int fun_animation=0; + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, loop) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, loop)(CALLBACKARG_PREV_CARG(carg), opt, back, back_max, back_index, lien_tot, lien_ntot, stat_time, stats)) { + return 0; /* Abort */ + } + } + + /* Process */ + printf("%c\r", "/-\\|"[(fun_animation++)%4]); + return 1; +} + +static int end(t_hts_callbackarg *carg, httrackp *opt) { + t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg); + fprintf(stderr, "** info: wrapper_exit() called!\n"); + if (userdef != NULL) { + free(userdef); + userdef = NULL; + } + + /* Call parent functions if multiple callbacks are chained. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} diff --git a/libtest/callbacks-example-log.c b/libtest/callbacks-example-log.c index 2834d05..068fda4 100755 --- a/libtest/callbacks-example-log.c +++ b/libtest/callbacks-example-log.c @@ -1,114 +1,114 @@ -/* - HTTrack external callbacks example : dumy plugin, aimed to log for debugging purpose - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -/* system includes */ -#include -#include -#include - -/* standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); -EXTERNAL_FUNCTION int hts_unplug(httrackp *opt); - -/* local function called as "check_html" callback */ -static int process_file(t_hts_callbackarg *carg, httrackp *opt, - char* html, int len, const char* url_address, const char* url_file) { - void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ - char *fmt; - - /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ - if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, - html, len, url_address, url_file)) { - return 0; /* abort */ - } - } - - /* log */ - fprintf(stderr, "* parsing file %s%s\n", url_address, url_file); - fmt = malloc(strlen(url_address) + strlen(url_file) + 128); - sprintf(fmt, " parsing file %s%s", url_address, url_file); - hts_log(opt, "log-wrapper-info", fmt); - free(fmt); - - return 1; /* success */ -} - -static int start_of_mirror(t_hts_callbackarg *carg, httrackp *opt) { - const char *arginfo = (char*) CALLBACKARG_USERDEF(carg); - - fprintf(stderr, "* mirror start\n"); - hts_log(opt, arginfo, "mirror started"); - - /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - /* status is ok on our side, return other callabck's status */ - return CALLBACKARG_PREV_FUN(carg, start)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} - -/* local function called as "end" callback */ -static int end_of_mirror(t_hts_callbackarg *carg, httrackp *opt) { - const char *arginfo = (char*) CALLBACKARG_USERDEF(carg); - - fprintf(stderr, "* mirror end\n"); - hts_log(opt, arginfo, "mirror ended"); - - /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - /* status is ok on our side, return other callabck's status */ - return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} - -/* -module entry point -the function name and prototype MUST match this prototype -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - /* optional argument passed in the commandline we won't be using here */ - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* plug callback functions */ - if (arg == NULL) - arg = "log-wrapper-info"; - hts_log(opt, arg, "* plugging functions"); - CHAIN_FUNCTION(opt, check_html, process_file, (char*) arg); - CHAIN_FUNCTION(opt, start, start_of_mirror, (char*) arg); - CHAIN_FUNCTION(opt, end, end_of_mirror, (char*) arg); - - hts_log(opt, arg, "* module successfully plugged"); - return 1; /* success */ -} - -/* -module exit point -the function name and prototype MUST match this prototype -*/ -EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) { - hts_log(opt, "log-wrapper-info", "* module successfully unplugged"); - return 1; -} +/* + HTTrack external callbacks example : dumy plugin, aimed to log for debugging purpose + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +/* system includes */ +#include +#include +#include + +/* standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); +EXTERNAL_FUNCTION int hts_unplug(httrackp *opt); + +/* local function called as "check_html" callback */ +static int process_file(t_hts_callbackarg *carg, httrackp *opt, + char* html, int len, const char* url_address, const char* url_file) { + void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ + char *fmt; + + /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ + if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, + html, len, url_address, url_file)) { + return 0; /* abort */ + } + } + + /* log */ + fprintf(stderr, "* parsing file %s%s\n", url_address, url_file); + fmt = malloc(strlen(url_address) + strlen(url_file) + 128); + sprintf(fmt, " parsing file %s%s", url_address, url_file); + hts_log(opt, "log-wrapper-info", fmt); + free(fmt); + + return 1; /* success */ +} + +static int start_of_mirror(t_hts_callbackarg *carg, httrackp *opt) { + const char *arginfo = (char*) CALLBACKARG_USERDEF(carg); + + fprintf(stderr, "* mirror start\n"); + hts_log(opt, arginfo, "mirror started"); + + /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + /* status is ok on our side, return other callabck's status */ + return CALLBACKARG_PREV_FUN(carg, start)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} + +/* local function called as "end" callback */ +static int end_of_mirror(t_hts_callbackarg *carg, httrackp *opt) { + const char *arginfo = (char*) CALLBACKARG_USERDEF(carg); + + fprintf(stderr, "* mirror end\n"); + hts_log(opt, arginfo, "mirror ended"); + + /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + /* status is ok on our side, return other callabck's status */ + return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} + +/* +module entry point +the function name and prototype MUST match this prototype +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + /* optional argument passed in the commandline we won't be using here */ + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* plug callback functions */ + if (arg == NULL) + arg = "log-wrapper-info"; + hts_log(opt, arg, "* plugging functions"); + CHAIN_FUNCTION(opt, check_html, process_file, (char*) arg); + CHAIN_FUNCTION(opt, start, start_of_mirror, (char*) arg); + CHAIN_FUNCTION(opt, end, end_of_mirror, (char*) arg); + + hts_log(opt, arg, "* module successfully plugged"); + return 1; /* success */ +} + +/* +module exit point +the function name and prototype MUST match this prototype +*/ +EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) { + hts_log(opt, "log-wrapper-info", "* module successfully unplugged"); + return 1; +} diff --git a/libtest/callbacks-example-simple.c b/libtest/callbacks-example-simple.c index e1f835a..42bf8cd 100755 --- a/libtest/callbacks-example-simple.c +++ b/libtest/callbacks-example-simple.c @@ -1,89 +1,89 @@ -/* - HTTrack external callbacks example : print all downloaded html documents - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1 - With MS-Visual C++: - cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib - - Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback - - How to use: - httrack --wrapper mycallback .. -*/ - -/* system includes */ -#include -#include -#include - -/* standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* external functions */ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); -EXTERNAL_FUNCTION int hts_unplug(httrackp *opt); - -/* local function called as "check_html" callback */ -static int process_file(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt, - /*other parameters are callback-specific*/ - char* html, int len, const char* url_address, const char* url_file) { - void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ - - /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ - if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { - if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, - html, len, url_address, url_file)) { - return 0; /* abort */ - } - } - - printf("file %s%s content: %s\n", url_address, url_file, html); - return 1; /* success */ -} - -/* local function called as "end" callback */ -static int end_of_mirror(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt) { - void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ - - /* processing */ - fprintf(stderr, "That's all, folks!\n"); - - /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ - if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { - /* status is ok on our side, return other callabck's status */ - return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); - } - - return 1; /* success */ -} - -/* -module entry point -the function name and prototype MUST match this prototype -*/ -EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { - /* optional argument passed in the commandline we won't be using here */ - const char *arg = strchr(argv, ','); - if (arg != NULL) - arg++; - - /* plug callback functions */ - CHAIN_FUNCTION(opt, check_html, process_file, /*optional user-defined arg*/NULL); - CHAIN_FUNCTION(opt, end, end_of_mirror, /*optional user-defined arg*/NULL); - - return 1; /* success */ -} - -/* -module exit point -the function name and prototype MUST match this prototype -*/ -EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) { - fprintf(stderr, "Module unplugged"); - - return 1; /* success */ -} +/* + HTTrack external callbacks example : print all downloaded html documents + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack2 + With MS-Visual C++: + cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.lib + + Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback + + How to use: + httrack --wrapper mycallback .. +*/ + +/* system includes */ +#include +#include +#include + +/* standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* external functions */ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv); +EXTERNAL_FUNCTION int hts_unplug(httrackp *opt); + +/* local function called as "check_html" callback */ +static int process_file(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt, + /*other parameters are callback-specific*/ + char* html, int len, const char* url_address, const char* url_file) { + void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ + + /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ + if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) { + if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, + html, len, url_address, url_file)) { + return 0; /* abort */ + } + } + + printf("file %s%s content: %s\n", url_address, url_file, html); + return 1; /* success */ +} + +/* local function called as "end" callback */ +static int end_of_mirror(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt) { + void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/ + + /* processing */ + fprintf(stderr, "That's all, folks!\n"); + + /* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */ + if (CALLBACKARG_PREV_FUN(carg, end) != NULL) { + /* status is ok on our side, return other callabck's status */ + return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt); + } + + return 1; /* success */ +} + +/* +module entry point +the function name and prototype MUST match this prototype +*/ +EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) { + /* optional argument passed in the commandline we won't be using here */ + const char *arg = strchr(argv, ','); + if (arg != NULL) + arg++; + + /* plug callback functions */ + CHAIN_FUNCTION(opt, check_html, process_file, /*optional user-defined arg*/NULL); + CHAIN_FUNCTION(opt, end, end_of_mirror, /*optional user-defined arg*/NULL); + + return 1; /* success */ +} + +/* +module exit point +the function name and prototype MUST match this prototype +*/ +EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) { + fprintf(stderr, "Module unplugged"); + + return 1; /* success */ +} diff --git a/libtest/example.c b/libtest/example.c index df6e503..21f7254 100644 --- a/libtest/example.c +++ b/libtest/example.c @@ -1,201 +1,201 @@ -/* - HTTrack library example - .c file - - Prerequisites: - - install winhttrack - - set the proper path in the project settings (especially for the httrack lib and dll) - - How to build: (callback.so or callback.dll) - With GNU-GCC: - gcc -I/usr/include/httrack -O -g3 -Wall -D_REENTRANT -o example example.c -lhttrack1 - With MS-Visual C++: - cl -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.exe" callbacks-example.c wsock32.lib libhttrack.lib -*/ - -#include -#include -#include -#ifdef _WIN32 -#include -#endif - -/* Standard httrack module includes */ -#include "httrack-library.h" -#include "htsopt.h" -#include "htsdefines.h" - -/* Local definitions */ -#include "example.h" - -/* - * Name: main - * Description: main() function - * Parameters: None - * Should return: error status -*/ -int main(void) { - /* - First, ask for an URL - Note: For the test, option r2 (mirror max depth=1) and --testscan (no index, no cache, do not store, no log files) - */ - char _argv[][256] = {"httrack_test" , "" , "-r3" , "--testscan" , "" }; - char* argv[] = {NULL , NULL , NULL , NULL , NULL}; - int argc = 0; - httrackp *opt; - int ret; - while(strlen(_argv[argc])) { - argv[argc]=_argv[argc]; - argc++; - } - argv[argc]=NULL; - printf("HTTrackLib test program\n"); - printf("Enter URL (example: www.foobar.com/index.html) :"); - scanf("%s",argv[1]); - printf("Test: 1 depth\n"); - - /* Initialize the library */ -#ifdef _WIN32 - { - WORD wVersionRequested; // requested version WinSock API - WSADATA wsadata; // Windows Sockets API data - int stat; - wVersionRequested = 0x0101; - stat = WSAStartup( wVersionRequested, &wsadata ); - if (stat != 0) { - printf("Winsock not found!\n"); - return; - } else if (LOBYTE(wsadata.wVersion) != 1 && HIBYTE(wsadata.wVersion) != 1) { - printf("WINSOCK.DLL does not support version 1.1\n"); - WSACleanup(); - return; - } - } -#endif - hts_init(); - - /* Create option settings and set callbacks (wrappers) */ - opt = hts_create_opt(); - - CHAIN_FUNCTION(opt, init, httrack_wrapper_init, NULL); - CHAIN_FUNCTION(opt, uninit, httrack_wrapper_uninit, NULL); - CHAIN_FUNCTION(opt, start, httrack_wrapper_start, NULL); - CHAIN_FUNCTION(opt, end, httrack_wrapper_end, NULL); - CHAIN_FUNCTION(opt, chopt, httrack_wrapper_chopt, NULL); - CHAIN_FUNCTION(opt, preprocess, httrack_wrapper_preprocesshtml, NULL); - CHAIN_FUNCTION(opt, postprocess, httrack_wrapper_postprocesshtml, NULL); - CHAIN_FUNCTION(opt, check_html, httrack_wrapper_checkhtml, NULL); - CHAIN_FUNCTION(opt, query, httrack_wrapper_query, NULL); - CHAIN_FUNCTION(opt, query2, httrack_wrapper_query2, NULL); - CHAIN_FUNCTION(opt, query3, httrack_wrapper_query3, NULL); - CHAIN_FUNCTION(opt, loop, httrack_wrapper_loop, NULL); - CHAIN_FUNCTION(opt, check_link, httrack_wrapper_check, NULL); - CHAIN_FUNCTION(opt, check_mime, httrack_wrapper_check_mime, NULL); - CHAIN_FUNCTION(opt, pause, httrack_wrapper_pause, NULL); - CHAIN_FUNCTION(opt, filesave, httrack_wrapper_filesave, NULL); - CHAIN_FUNCTION(opt, filesave2, httrack_wrapper_filesave2, NULL); - CHAIN_FUNCTION(opt, linkdetected, httrack_wrapper_linkdetected, NULL); - CHAIN_FUNCTION(opt, linkdetected2, httrack_wrapper_linkdetected2, NULL); - CHAIN_FUNCTION(opt, xfrstatus, httrack_wrapper_xfrstatus, NULL); - CHAIN_FUNCTION(opt, savename, httrack_wrapper_savename, NULL); - CHAIN_FUNCTION(opt, sendhead, httrack_wrapper_sendheader, NULL); - CHAIN_FUNCTION(opt, receivehead, httrack_wrapper_receiveheader, NULL); - - /* Then, launch the mirror */ - ret = hts_main2(argc, argv, opt); - - /* Wait for a key */ - printf("\nPress ENTER key to exit\n"); - scanf("%s",argv[1]); - - /* Clear option state */ - hts_free_opt(opt); - hts_uninit(); -#ifdef _WIN32 - WSACleanup(); -#endif - - /* That's all! */ - return 0; -} - - -/* CALLBACK FUNCTIONS */ - -/* Initialize the Winsock */ -static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg) { - printf("Engine started\n"); -} -static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg) { - printf("Engine exited\n"); -} -static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt) { - printf("Start of mirror\n"); - return 1; -} -static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt) { - return 1; -} -static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt) { - printf("End of mirror\n"); - return 1; -} -static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file) { - printf("Parsing html file: http://%s%s\n",url_address,url_file); - return 1; -} -static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats) { - /* printf("..httrack_wrapper_loop called\n"); */ - return 1; -} -static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question) { - /* Answer is No */ - return "N"; -} -static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question) { - /* Answer is No */ - return "N"; -} -static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question) { - /* Answer is "" */ - return ""; -} -static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status) { - printf("Link status tested: http://%s%s\n",adr,fil); - return -1; -} -static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile) { - /* Wait until lockfile is removed.. */ -} -static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file) { -} -static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link) { - printf("Link detected: %s\n",link); - return 1; -} -static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back) { - return 1; -} -static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { - return 1; -} -static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { - return 1; -} -static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status) { - return -1; -} -static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated) { -} -static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag) { - return 1; -} -static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save) { - return 1; -} -static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing) { - return 1; -} -static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming) { - return 1; -} +/* + HTTrack library example + .c file + + Prerequisites: + - install winhttrack + - set the proper path in the project settings (especially for the httrack lib and dll) + + How to build: (callback.so or callback.dll) + With GNU-GCC: + gcc -I/usr/include/httrack -O -g3 -Wall -D_REENTRANT -o example example.c -lhttrack2 + With MS-Visual C++: + cl -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.exe" callbacks-example.c wsock32.lib libhttrack.lib +*/ + +#include +#include +#include +#ifdef _WIN32 +#include +#endif + +/* Standard httrack module includes */ +#include "httrack-library.h" +#include "htsopt.h" +#include "htsdefines.h" + +/* Local definitions */ +#include "example.h" + +/* + * Name: main + * Description: main() function + * Parameters: None + * Should return: error status +*/ +int main(void) { + /* + First, ask for an URL + Note: For the test, option r2 (mirror max depth=1) and --testscan (no index, no cache, do not store, no log files) + */ + char _argv[][256] = {"httrack_test" , "" , "-r3" , "--testscan" , "" }; + char* argv[] = {NULL , NULL , NULL , NULL , NULL}; + int argc = 0; + httrackp *opt; + int ret; + while(strlen(_argv[argc])) { + argv[argc]=_argv[argc]; + argc++; + } + argv[argc]=NULL; + printf("HTTrackLib test program\n"); + printf("Enter URL (example: www.foobar.com/index.html) :"); + scanf("%s",argv[1]); + printf("Test: 1 depth\n"); + + /* Initialize the library */ +#ifdef _WIN32 + { + WORD wVersionRequested; // requested version WinSock API + WSADATA wsadata; // Windows Sockets API data + int stat; + wVersionRequested = 0x0101; + stat = WSAStartup( wVersionRequested, &wsadata ); + if (stat != 0) { + printf("Winsock not found!\n"); + return; + } else if (LOBYTE(wsadata.wVersion) != 1 && HIBYTE(wsadata.wVersion) != 1) { + printf("WINSOCK.DLL does not support version 1.1\n"); + WSACleanup(); + return; + } + } +#endif + hts_init(); + + /* Create option settings and set callbacks (wrappers) */ + opt = hts_create_opt(); + + CHAIN_FUNCTION(opt, init, httrack_wrapper_init, NULL); + CHAIN_FUNCTION(opt, uninit, httrack_wrapper_uninit, NULL); + CHAIN_FUNCTION(opt, start, httrack_wrapper_start, NULL); + CHAIN_FUNCTION(opt, end, httrack_wrapper_end, NULL); + CHAIN_FUNCTION(opt, chopt, httrack_wrapper_chopt, NULL); + CHAIN_FUNCTION(opt, preprocess, httrack_wrapper_preprocesshtml, NULL); + CHAIN_FUNCTION(opt, postprocess, httrack_wrapper_postprocesshtml, NULL); + CHAIN_FUNCTION(opt, check_html, httrack_wrapper_checkhtml, NULL); + CHAIN_FUNCTION(opt, query, httrack_wrapper_query, NULL); + CHAIN_FUNCTION(opt, query2, httrack_wrapper_query2, NULL); + CHAIN_FUNCTION(opt, query3, httrack_wrapper_query3, NULL); + CHAIN_FUNCTION(opt, loop, httrack_wrapper_loop, NULL); + CHAIN_FUNCTION(opt, check_link, httrack_wrapper_check, NULL); + CHAIN_FUNCTION(opt, check_mime, httrack_wrapper_check_mime, NULL); + CHAIN_FUNCTION(opt, pause, httrack_wrapper_pause, NULL); + CHAIN_FUNCTION(opt, filesave, httrack_wrapper_filesave, NULL); + CHAIN_FUNCTION(opt, filesave2, httrack_wrapper_filesave2, NULL); + CHAIN_FUNCTION(opt, linkdetected, httrack_wrapper_linkdetected, NULL); + CHAIN_FUNCTION(opt, linkdetected2, httrack_wrapper_linkdetected2, NULL); + CHAIN_FUNCTION(opt, xfrstatus, httrack_wrapper_xfrstatus, NULL); + CHAIN_FUNCTION(opt, savename, httrack_wrapper_savename, NULL); + CHAIN_FUNCTION(opt, sendhead, httrack_wrapper_sendheader, NULL); + CHAIN_FUNCTION(opt, receivehead, httrack_wrapper_receiveheader, NULL); + + /* Then, launch the mirror */ + ret = hts_main2(argc, argv, opt); + + /* Wait for a key */ + printf("\nPress ENTER key to exit\n"); + scanf("%s",argv[1]); + + /* Clear option state */ + hts_free_opt(opt); + hts_uninit(); +#ifdef _WIN32 + WSACleanup(); +#endif + + /* That's all! */ + return 0; +} + + +/* CALLBACK FUNCTIONS */ + +/* Initialize the Winsock */ +static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg) { + printf("Engine started\n"); +} +static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg) { + printf("Engine exited\n"); +} +static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt) { + printf("Start of mirror\n"); + return 1; +} +static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt) { + return 1; +} +static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt) { + printf("End of mirror\n"); + return 1; +} +static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file) { + printf("Parsing html file: http://%s%s\n",url_address,url_file); + return 1; +} +static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats) { + /* printf("..httrack_wrapper_loop called\n"); */ + return 1; +} +static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question) { + /* Answer is No */ + return "N"; +} +static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question) { + /* Answer is No */ + return "N"; +} +static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question) { + /* Answer is "" */ + return ""; +} +static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status) { + printf("Link status tested: http://%s%s\n",adr,fil); + return -1; +} +static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile) { + /* Wait until lockfile is removed.. */ +} +static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file) { +} +static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link) { + printf("Link detected: %s\n",link); + return 1; +} +static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back) { + return 1; +} +static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { + return 1; +} +static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) { + return 1; +} +static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status) { + return -1; +} +static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated) { +} +static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag) { + return 1; +} +static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save) { + return 1; +} +static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing) { + return 1; +} +static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming) { + return 1; +} diff --git a/libtest/example.h b/libtest/example.h index 57bf15d..b1d8e38 100644 --- a/libtest/example.h +++ b/libtest/example.h @@ -1,34 +1,34 @@ -/* - HTTrack library example - .h file -*/ - -#ifdef __WIN32 -#define CDECL __cdecl -#else -#define CDECL -#endif - -static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg); -static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg); -static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt); -static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt); -static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt); -static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file); -static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats); -static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question); -static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question); -static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question); -static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status); -static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile); -static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file); -static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link); -static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back); -static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file); -static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file); -static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status); -static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated); -static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag); -static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save); -static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing); -static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming); +/* + HTTrack library example + .h file +*/ + +#ifdef __WIN32 +#define CDECL __cdecl +#else +#define CDECL +#endif + +static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg); +static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg); +static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt); +static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt); +static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt); +static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file); +static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats); +static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question); +static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question); +static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question); +static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status); +static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile); +static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file); +static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link); +static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back); +static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file); +static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file); +static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status); +static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated); +static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag); +static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save); +static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing); +static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming); diff --git a/libtest/readme.txt b/libtest/readme.txt index c204e29..6c19b12 100644 --- a/libtest/readme.txt +++ b/libtest/readme.txt @@ -1,56 +1,56 @@ -HTTrack library example ------------------------ - -Here is an example of how to integrate HTTrack Website Copier into a project -to use it as a "core library". - - -Important Notice: ----------------- - -These sources are covered by the GNU General Public License (see below) -(Projects based on these sources must follow the GPL, too) - - -Copyright notice: ----------------- - -HTTrack Website Copier, Offline Browser for Windows and Unix -Copyright (C) Xavier Roche and other contributors - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -======================================================================== - MAKEFILE PROJECT : libtest Project Overview -======================================================================== - -AppWizard has created this libtest project for you. - -This file contains a summary of what you will find in each of the files that -make up your libtest project. - - -libtest.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -This project allows you to build/clean/rebuild from within Visual Studio by calling the commands you have input -in the wizard. The build command can be nmake or any other tool you use. - -This project does not contain any files, so there are none displayed in Solution Explorer. - -///////////////////////////////////////////////////////////////////////////// +HTTrack library example +----------------------- + +Here is an example of how to integrate HTTrack Website Copier into a project +to use it as a "core library". + + +Important Notice: +---------------- + +These sources are covered by the GNU General Public License (see below) +(Projects based on these sources must follow the GPL, too) + + +Copyright notice: +---------------- + +HTTrack Website Copier, Offline Browser for Windows and Unix +Copyright (C) Xavier Roche and other contributors + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +======================================================================== + MAKEFILE PROJECT : libtest Project Overview +======================================================================== + +AppWizard has created this libtest project for you. + +This file contains a summary of what you will find in each of the files that +make up your libtest project. + + +libtest.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +This project allows you to build/clean/rebuild from within Visual Studio by calling the commands you have input +in the wizard. The build command can be nmake or any other tool you use. + +This project does not contain any files, so there are none displayed in Solution Explorer. + +///////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3