diff -rupN -x '*.o' -x '*.a' -x '*.so*' -x '*libs*' httrack-3.48.19/src/htscoremain.c httrack-3.48.19-local/src/htscoremain.c --- httrack-3.48.19/src/htscoremain.c 2014-07-28 14:46:38.000000000 -0600 +++ httrack-3.48.19-local/src/htscoremain.c 2014-11-29 18:10:50.000000000 -0700 @@ -1380,11 +1380,23 @@ static int hts_main_internal(int argc, c htsmain_free(); return -1; } - StringCopy(opt->savename_userdef, argv[na]); - if (StringLength(opt->savename_userdef) > 0) - opt->savename_type = -1; // userdef! - else - opt->savename_type = 0; // -N "" : par défaut + const char html_key[] = "?html?"; + const int html_key_len = strlen(html_key); + if (strncmp(argv[na], html_key, html_key_len) == 0) { + // Starts with HTML indicator, so is structure for HTML pages + const char* userdef_html = argv[na] + html_key_len; + StringCopy(opt->savename_userdef_html, userdef_html); + if (StringLength(opt->savename_userdef_html) > 0) { + opt->savename_type = -1; // userdef! + printf("Got HTML file save pattern: '%s'\n", userdef_html); + } + } else { + StringCopy(opt->savename_userdef, argv[na]); + if (StringLength(opt->savename_userdef) > 0) + opt->savename_type = -1; // userdef! + else + opt->savename_type = 0; // -N "" : par défaut + } } } else { sscanf(com + 1, "%d", &opt->savename_type); diff -rupN -x '*.o' -x '*.a' -x '*.so*' -x '*libs*' httrack-3.48.19/src/htshelp.c httrack-3.48.19-local/src/htshelp.c --- httrack-3.48.19/src/htshelp.c 2014-06-10 13:11:03.000000000 -0600 +++ httrack-3.48.19-local/src/htshelp.c 2014-11-29 17:55:16.000000000 -0700 @@ -720,6 +720,7 @@ void help(const char *app, int more) { infomsg(" '%q' small query string MD5 (16 bits, 4 ascii bytes)"); infomsg(" '%s?' Short name version (ex: %sN)"); infomsg(" '%[param]' param variable in query string"); + infomsg(" '?html?' Use the following structure pattern for HTML files only"); infomsg (" '%[param:before:after:empty:notfound]' advanced variable extraction"); infomsg("Details: User-defined option N and advanced variable extraction"); diff -rupN -x '*.o' -x '*.a' -x '*.so*' -x '*libs*' httrack-3.48.19/src/htsname.c httrack-3.48.19-local/src/htsname.c --- httrack-3.48.19/src/htsname.c 2014-07-06 02:24:08.000000000 -0600 +++ httrack-3.48.19-local/src/htsname.c 2014-11-29 18:14:43.000000000 -0700 @@ -767,6 +767,13 @@ int url_savename(lien_adrfilsave *const // ajouter nom du site éventuellement en premier if (opt->savename_type == -1) { // utiliser savename_userdef! (%h%p/%n%q.%t) const char *a = StringBuff(opt->savename_userdef); + if (StringLength(opt->savename_userdef_html) > 0 && + ((ext_chg != 0) ? (ishtml_ext(ext) == 1) : (ishtml(opt, fil) == 1))) { + a = StringBuff(opt->savename_userdef_html); + hts_log_print(opt, LOG_DEBUG, "Using userdef_html: %s", a); + } else { + hts_log_print(opt, LOG_DEBUG, "Using userdef: %s", a); + } char *b = afs->save; /*char *nom_pos=NULL,*dot_pos=NULL; // Position nom et point */ diff -rupN -x '*.o' -x '*.a' -x '*.so*' -x '*libs*' httrack-3.48.19/src/htsopt.h httrack-3.48.19-local/src/htsopt.h --- httrack-3.48.19/src/htsopt.h 2014-07-06 02:00:54.000000000 -0600 +++ httrack-3.48.19-local/src/htsopt.h 2014-11-29 17:00:59.000000000 -0700 @@ -328,6 +328,7 @@ struct httrackp { int savename_83; // conversion 8-3 pour les noms de fichiers int savename_type; // type de noms: structure originale/html-images en un seul niveau String savename_userdef; // structure userdef (ex: %h%p/%n%q.%t) + String savename_userdef_html; // structure userdef for HTML files (ex: %h%p/%n%q.%t) /* XXX added */ int savename_delayed; // delayed type check int delayed_cached; // delayed type check can be cached to speedup updates int mimehtml; // MIME-html