diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2012-07-07 14:55:37 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2012-07-07 14:55:37 -0400 |
commit | 4e59e679dc753f077bd2ab6f972b76fc16039d9e (patch) | |
tree | 38098ea1080e56220f82e19988b7e8e5c9890a6b /src | |
parent | 299c41fc25868e0eb82e46ca8e4188c70db57363 (diff) | |
download | lynx-snapshots-4e59e679dc753f077bd2ab6f972b76fc16039d9e.tar.gz |
snapshot of project "lynx", label v2-8-8dev_12e
Diffstat (limited to 'src')
-rw-r--r-- | src/LYMail.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/LYMail.c b/src/LYMail.c index ee0156ee..8e8bc81f 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMail.c,v 1.89 2012/07/06 21:18:09 tom Exp $ + * $LynxId: LYMail.c,v 1.90 2012/07/07 13:48:13 tom Exp $ */ #include <HTUtils.h> #include <HTParse.h> @@ -318,29 +318,42 @@ static void show_addresses(char *addresses) static void blat_option(FILE *fp, const char *option, const char *value) { if (non_empty(value)) { + char *result = malloc(strlen(option) + 4 + 4 * strlen(value)); + char *working = result; + + CTRACE((tfp, "blat_option(opt=\"%s\", value=\"%s\")\n", option, value)); + sprintf(working, "%s \"", option); + working += strlen(working); - fprintf(fp, "%s \"", option); while (*value != '\0') { unsigned ch = UCH(*value); switch (ch) { - case '\'': - fputs("\\\\", fp); + case '\\': + *working++ = '\\'; + *working++ = '\\'; break; case '"': - fputs("\"", fp); + *working++ = '\\'; + *working++ = '"'; break; default: if (ch < ' ' || ch > '~') { - fprintf(fp, "\\%03o", ch); + sprintf(working, "\\%03o", ch); } else { - fputc(ch, fp); + *working++ = ch; } break; } ++value; } - fprintf(fp, "\"\n"); + *working++ = '"'; + *working++ = '\n'; + *working = 0; + + CTRACE((tfp, "->%s", result)); + fputs(result, fp); + FREE(result); } } |