diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2013-05-30 19:04:51 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2013-05-30 19:04:51 +0000 |
commit | 850f165f4ac90a6e6687c392ddfdd0c6a05b3fe5 (patch) | |
tree | 7cac2f01468639c4ab63fe523c17d7638e8cd2ac /src/htscoremain.c | |
parent | 01af2a5e73f53ebf8a092e4bda77cd1326c1da11 (diff) |
Added hts_unescape_entities(), a rewrite of the HTML entities decoder.
Fixed HTML entities decoding which was done before charset decoding.
Diffstat (limited to 'src/htscoremain.c')
-rw-r--r-- | src/htscoremain.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/htscoremain.c b/src/htscoremain.c index b918ed0..534c469 100644 --- a/src/htscoremain.c +++ b/src/htscoremain.c @@ -2342,6 +2342,23 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) { htsmain_free(); return 0; break; + case '6': // entities: httrack -#6 + if (++na < argc) { + char *const s = strdup(argv[na]); + if (s != NULL && hts_unescape_entities(s, s, strlen(s)) == 0) { + printf("%s\n", s); + free(s); + } else { + fprintf(stderr, "invalid string '%s'\n", argv[na]); + } + na += 1; + } else { + fprintf(stderr, + "Option #6 needs to be followed by a string"); + } + htsmain_free(); + return 0; + break; case '!': if (na + 1 >= argc) { HTS_PANIC_PRINTF |