1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

1. If neither CONFIG_88_COLORS nor CONFIG_256_COLORS is defined,

then dump_to_file_256 is defined in dump.c but not used.
   If configure --enable-debug was used, then gcc warns about
   the unused function, and the warning stops the build.

2. The description of document.dump.color_mode ends with a
   newline, provoking a runtime warning from check_description
   in src/config/options.c.

3. options.inc has preprocessor directives inside macro arguments.
   That is not portable C.  xgettext (GNU gettext-tools) 0.14.3 is
   not smart enough to figure out the possible combinations, and
   copies an incorrect string to elinks.pot.
This commit is contained in:
Kalle Olavi Niemitalo 2006-03-13 19:06:02 +01:00 committed by Witold Filipczyk
parent 97d7a57b8a
commit 7927fb737a
2 changed files with 39 additions and 17 deletions

View File

@ -632,29 +632,43 @@ static struct option_info config_options_info[] = {
N_("Codepage used in dump output. 'System' stands for\n"
"a codepage determined by a selected locale.")),
INIT_OPT_INT("document.dump", N_("Color mode"),
"color_mode", 0, -1,
/* The #if directives cannot be inside the argument list of
* the INIT_OPT_INT macro; that wouldn't be standard C.
* And they especially cannot be inside the argument list of N_;
* xgettext (GNU gettext-tools) 0.14.3 wouldn't support that. */
#if defined(CONFIG_88_COLORS) && defined(CONFIG_256_COLORS)
3,
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
2,
#else
1,
#endif
-1,
INIT_OPT_INT("document.dump", N_("Color mode"),
"color_mode", 0, -1, 3, -1,
N_("Color mode for dumps:\n"
"-1 is standard dump mode\n"
"0 is mono mode\n"
"1 is 16 color mode\n"
#if defined(CONFIG_88_COLORS) && defined(CONFIG_256_COLORS)
"2 is 88 color mode\n"
"3 is 256 color mode\n"
#elif defined(CONFIG_88_COLORS)
"2 is 88 color mode\n"
#elif defined(CONFIG_256_COLORS)
"2 is 256 color mode\n"
#endif
)),
"3 is 256 color mode")),
#elif defined(CONFIG_88_COLORS) /* && !defined(CONFIG_256_COLORS) */
INIT_OPT_INT("document.dump", N_("Color mode"),
"color_mode", 0, -1, 2, -1,
N_("Color mode for dumps:\n"
"-1 is standard dump mode\n"
"0 is mono mode\n"
"1 is 16 color mode\n"
"2 is 88 color mode")),
#elif defined(CONFIG_256_COLORS) /* && !defined(CONFIG_88_COLORS) */
INIT_OPT_INT("document.dump", N_("Color mode"),
"color_mode", 0, -1, 2, -1,
N_("Color mode for dumps:\n"
"-1 is standard dump mode\n"
"0 is mono mode\n"
"1 is 16 color mode\n"
"2 is 256 color mode")),
#else /* !defined(CONFIG_88_COLORS) && !defined(CONFIG_256_COLORS) */
INIT_OPT_INT("document.dump", N_("Color mode"),
"color_mode", 0, -1, 1, -1,
N_("Color mode for dumps:\n"
"-1 is standard dump mode\n"
"0 is mono mode\n"
"1 is 16 color mode")),
#endif /* !defined(CONFIG_88_COLORS) && !defined(CONFIG_256_COLORS) */
INIT_OPT_STRING("document.dump", N_("Footer"),
"footer", 0, "",

View File

@ -51,7 +51,9 @@ static struct download dump_download;
static int dump_redir_count = 0;
static int dump_to_file_16(struct document *document, int fd);
#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
static int dump_to_file_256(struct document *document, int fd);
#endif
/* This dumps the given @cached's source onto @fd nothing more. It returns 0 if it
* all went fine and 1 if something isn't quite right and we should terminate
@ -521,6 +523,11 @@ fail:
return 0;
}
/* configure --enable-debug uses gcc -Wall -Werror, and -Wall includes
* -Wunused-function, so declaring or defining any unused function
* would break the build. */
#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
static int
write_color_256(unsigned char *str, unsigned char color, int fd, unsigned char *buf, int *bptr)
{
@ -648,6 +655,7 @@ fail:
return 0;
}
#endif /* defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) */
int
dump_to_file(struct document *document, int fd)