diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-03-30 00:29:50 +0000 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-03-30 00:29:50 +0000 |
commit | 04fd5be50c369e986053e7bfcc4b9eb2fa5ac937 (patch) | |
tree | 840e3e3dca02952345abbb2614b27ddbb0025bd5 /src | |
parent | baa72f144c15896a40c794b967854f0508459a20 (diff) | |
download | lynx-snapshots-04fd5be50c369e986053e7bfcc4b9eb2fa5ac937.tar.gz |
snapshot of project "lynx", label v2-9-0dev_10d
Diffstat (limited to 'src')
-rw-r--r-- | src/HTFWriter.c | 48 | ||||
-rw-r--r-- | src/LYOptions.c | 5 | ||||
-rw-r--r-- | src/LYReadCFG.c | 3 | ||||
-rw-r--r-- | src/LYrcFile.c | 6 | ||||
-rw-r--r-- | src/LYrcFile.h | 3 |
5 files changed, 54 insertions, 11 deletions
diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 0ff5a56c..cf5226ad 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFWriter.c,v 1.119 2019/08/25 22:57:03 tom Exp $ + * $LynxId: HTFWriter.c,v 1.120 2022/03/28 00:04:50 tom Exp $ * * FILE WRITER HTFWrite.h * =========== @@ -310,6 +310,21 @@ static void HTFWriter_free(HTStream *me) path[len - 4] = '\0'; (void) remove(path); } + } else if (len > 3 && !strcasecomp(&path[len - 2], "br")) { +#ifdef USE_BROTLI + if (!skip_loadfile) { + use_zread = YES; + } else +#endif /* USE_BROTLI */ + { + char FIXME[1024]; + + sprintf(FIXME, "brotli -d -j -f %s", path); + path[len - 3] = '\0'; + (void) remove(path); + system(FIXME); + } + CTRACE((tfp, "FIXME %s@%d\n", __FILE__, __LINE__)); } else if (len > 2 && !strcasecomp(&path[len - 1], "Z")) { path[len - 2] = '\0'; (void) remove(path); @@ -813,7 +828,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres, /* * Make command to delete file. */ - me->remove_command = 0; + me->remove_command = NULL; HTAddParam(&(me->remove_command), REMOVE_COMMAND, 1, fnam); HTEndParam(&(me->remove_command), REMOVE_COMMAND, 1); @@ -980,7 +995,7 @@ HTStream *HTSaveToFile(HTPresentation *pres, /* * Make command to delete file. */ - ret_obj->remove_command = 0; + ret_obj->remove_command = NULL; HTAddParam(&(ret_obj->remove_command), REMOVE_COMMAND, 1, fnam); HTEndParam(&(ret_obj->remove_command), REMOVE_COMMAND, 1); @@ -1156,6 +1171,13 @@ HTStream *HTCompressed(HTPresentation *pres, compress_suffix = "bz2"; } break; + case cftBrotli: + if ((program = HTGetProgramPath(ppBROTLI)) != NULL) { + StrAllocCopy(uncompress_mask, program); + StrAllocCat(uncompress_mask, " -d %s"); + compress_suffix = "br"; + } + break; case cftCompress: if ((program = HTGetProgramPath(ppUNCOMPRESS)) != NULL) { /* @@ -1300,10 +1322,22 @@ HTStream *HTCompressed(HTPresentation *pres, /* * Make command to process file. - FM */ -#ifdef USE_BZLIB - if (compress_suffix[0] == 'b' /* must be bzip2 */ +#ifdef USE_BROTLI + if (compress_suffix[0] == 'b' /* e.g., ".br" */ + && compress_suffix[1] == 'r' && !me->viewer_command) { /* + * We won't call brotli externally, so we don't need to supply a + * command for it. + */ + StrAllocCopy(me->end_command, ""); + } else +#endif +#ifdef USE_BZLIB + if (compress_suffix[0] == 'b' /* must be bzip2 */ + && compress_suffix[1] == 'z' + && !me->viewer_command) { + /* * We won't call bzip2 externally, so we don't need to supply a command * for it. */ @@ -1322,7 +1356,7 @@ HTStream *HTCompressed(HTPresentation *pres, } else #endif /* USE_ZLIB */ { - me->end_command = 0; + me->end_command = NULL; HTAddParam(&(me->end_command), uncompress_mask, 1, fnam); HTEndParam(&(me->end_command), uncompress_mask, 1); } @@ -1331,7 +1365,7 @@ HTStream *HTCompressed(HTPresentation *pres, /* * Make command to delete file. - FM */ - me->remove_command = 0; + me->remove_command = NULL; HTAddParam(&(me->remove_command), REMOVE_COMMAND, 1, fnam); HTEndParam(&(me->remove_command), REMOVE_COMMAND, 1); diff --git a/src/LYOptions.c b/src/LYOptions.c index 9208d994..58c2f882 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1,4 +1,4 @@ -/* $LynxId: LYOptions.c,v 1.183 2021/07/05 21:17:42 tom Exp $ */ +/* $LynxId: LYOptions.c,v 1.184 2021/07/30 00:17:54 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <HTTP.h> /* 'reloading' flag */ @@ -2490,6 +2490,9 @@ static OptValues encoding_values[] = #if defined(USE_BZLIB) || defined(BZIP2_PATH) {encodingBZIP2, N_("bzip2"), "encoding_bzip2"}, #endif +#if defined(USE_BROTLI) || defined(BROTLI_PATH) + {encodingBROTLI, N_("brotli"), "encoding_brotli"}, +#endif {encodingALL, N_("All"), "encoding_all"}, END_OPTIONS }; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 18bc34cf..e4ab7962 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYReadCFG.c,v 1.199 2021/06/09 21:49:32 tom Exp $ + * $LynxId: LYReadCFG.c,v 1.200 2021/07/29 22:52:55 tom Exp $ */ #ifndef NO_RULES #include <HTRules.h> @@ -1460,6 +1460,7 @@ static Config_Type Config_Table [] = PARSE_LST(RC_BROKEN_FTP_EPSV, broken_ftp_epsv), PARSE_LST(RC_BROKEN_FTP_RETR, broken_ftp_retr), #endif + PARSE_PRG(RC_BROTLI_PATH, ppBROTLI), PARSE_PRG(RC_BZIP2_PATH, ppBZIP2), PARSE_SET(RC_CASE_SENSITIVE_ALWAYS_ON, LYcase_sensitive), PARSE_FUN(RC_CHARACTER_SET, character_set_fun), diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 06b843a5..be089175 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,4 +1,4 @@ -/* $LynxId: LYrcFile.c,v 1.105 2021/07/05 20:29:10 tom Exp $ */ +/* $LynxId: LYrcFile.c,v 1.106 2022/03/27 23:01:26 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <LYUtils.h> @@ -120,6 +120,9 @@ Config_Enum tbl_preferred_encoding[] = { #if defined(USE_BZLIB) || defined(BZIP2_PATH) { "bzip2", encodingBZIP2 }, #endif +#if defined(USE_BROTLI) || defined(BROTLI_PATH) + { "br", encodingBROTLI }, +#endif { "all", encodingALL }, { NULL, -1 } }; @@ -234,6 +237,7 @@ BOOL LYgetEnum(Config_Enum * table, const char *name, return TRUE; } } + CTRACE((tfp, "LYgetEnum: no match found for \"%s\"\n", name)); return FALSE; /* no match */ } diff --git a/src/LYrcFile.h b/src/LYrcFile.h index f23c87ff..1285a216 100644 --- a/src/LYrcFile.h +++ b/src/LYrcFile.h @@ -1,5 +1,5 @@ /* - * $LynxId: LYrcFile.h,v 1.58 2021/07/05 20:23:51 tom Exp $ + * $LynxId: LYrcFile.h,v 1.59 2021/07/29 22:53:37 tom Exp $ */ #ifndef LYRCFILE_H #define LYRCFILE_H @@ -33,6 +33,7 @@ #define RC_BOOKMARK_FILE "bookmark_file" #define RC_BROKEN_FTP_EPSV "broken_ftp_epsv" #define RC_BROKEN_FTP_RETR "broken_ftp_retr" +#define RC_BROTLI_PATH "brotli_path" #define RC_BZIP2_PATH "bzip2_path" #define RC_CASE_SENSITIVE_ALWAYS_ON "case_sensitive_always_on" #define RC_CASE_SENSITIVE_SEARCHING "case_sensitive_searching" |