Added option '-%t', preserving the original file type (which may produce non-browseable file locally)

This commit is contained in:
Xavier Roche
2013-09-03 17:43:22 +00:00
parent 5bd7e12eae
commit fd69106947
4 changed files with 8 additions and 1 deletions

View File

@@ -1919,6 +1919,11 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
}
break;
case 't': /* do not change type (ending) of filenames according to the MIME type */
opt->no_type_change = 1;
if (*(com+1)=='0') { opt->no_type_change = 0; com++; }
break;
default:{
char s[HTS_CDLMAXSIZE + 256];

View File

@@ -5464,6 +5464,7 @@ HTSEXT_API httrackp *hts_create_opt(void) {
opt->extdepth = 0; // mais pas à l'extérieur
opt->seeker = 1; // down
opt->urlmode = 2; // relatif par défaut
opt->no_type_change = 0; // change file types
opt->debug = 0; // pas de débug en plus
opt->getmode = 3; // linear scan
opt->maxsite = -1; // taille max site (aucune)

View File

@@ -764,7 +764,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
}
// Changer extension?
// par exemple, php3 sera sauvé en html, cgi en html ou gif, xbm etc.. selon les cas
if (ext_chg) { // changer ext
if (ext_chg && !opt->no_type_change) { // changer ext
char *a = fil + strlen(fil) - 1;
if ((opt->debug > 1) && (opt->log != NULL)) {

View File

@@ -289,6 +289,7 @@ struct httrackp {
int depth; // nombre de niveaux de récursion
int extdepth; // nombre de niveaux de récursion à l'éxtérieur
int urlmode; // liens relatifs etc
int no_type_change; // do not change file type according to MIME
int debug; // mode débug log
int getmode; // sauver html, images..
FILE *log; // fichier log