1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-26 01:15:37 +00:00

Merge pull request #295 from smemsh/test-mailcap

let $DISPLAY be set for mailcap tests, and make standalone
This commit is contained in:
rkd77 2024-04-08 14:51:25 +02:00 committed by GitHub
commit 14c10000da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -73,6 +73,7 @@ option('dgi', type: 'boolean', value: false, description: 'DOS Gateway Interface
option('mujs', type: 'boolean', value: false, description: 'use mujs library') option('mujs', type: 'boolean', value: false, description: 'use mujs library')
option('codepoint', type: 'boolean', value: true, description: 'whether check codepoints on Linux console') option('codepoint', type: 'boolean', value: true, description: 'whether check codepoints on Linux console')
option('test', type: 'boolean', value: false, description: 'whether build test programs') option('test', type: 'boolean', value: false, description: 'whether build test programs')
option('test-mailcap', type: 'boolean', value: false, description: 'whether build test mailcap program')
option('doc', type: 'boolean', value: true, description: 'whether build documentation') option('doc', type: 'boolean', value: true, description: 'whether build documentation')
option('docdir', type: 'string', value: '', description: 'Documentation installation directory. Default $prefix/share/doc/elinks.') option('docdir', type: 'string', value: '', description: 'Documentation installation directory. Default $prefix/share/doc/elinks.')
option('apidoc', type: 'boolean', value: true, description: 'whether to generate API docs with doxygen') option('apidoc', type: 'boolean', value: true, description: 'whether to generate API docs with doxygen')

View File

@ -416,7 +416,7 @@ init_mailcap_map(void)
if (!mailcap_map) return NULL; if (!mailcap_map) return NULL;
/* Try to setup mailcap_path */ /* Try to setup mailcap_path */
path = get_mailcap_path(); path = (char *)get_mailcap_path();
if (!path || !*path) path = getenv("MAILCAP"); if (!path || !*path) path = getenv("MAILCAP");
if (!path) path = (char *)DEFAULT_MAILCAP_PATH; if (!path) path = (char *)DEFAULT_MAILCAP_PATH;
@ -809,6 +809,7 @@ main(int argc, char *argv[])
{ {
char *format = "description,ask,block,program"; char *format = "description,ask,block,program";
int has_gotten = 0; int has_gotten = 0;
int setenv_display = 0;
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
@ -826,6 +827,10 @@ main(int argc, char *argv[])
} else if (get_test_opt(&arg, "format", &i, argc, argv, "a string")) { } else if (get_test_opt(&arg, "format", &i, argc, argv, "a string")) {
format = arg; format = arg;
} else if (get_test_opt(&arg, "display", &i, argc, argv, "a string")) {
if (strcmp(arg, "1") == 0 || strcmp(arg, "yes") == 0)
setenv_display = 1;
} else if (get_test_opt(&arg, "get", &i, argc, argv, "a string")) { } else if (get_test_opt(&arg, "get", &i, argc, argv, "a string")) {
struct mime_handler *handler; struct mime_handler *handler;
@ -833,7 +838,7 @@ main(int argc, char *argv[])
printf("\n"); printf("\n");
has_gotten = 1; has_gotten = 1;
printf("type: %s\n", arg); printf("type: %s\n", arg);
handler = get_mime_handler_mailcap(arg, 0); handler = get_mime_handler_mailcap(arg, setenv_display);
if (!handler) continue; if (!handler) continue;
if (strstr(format, "description")) if (strstr(format, "description"))

View File

@ -10,7 +10,7 @@ endif
srcs += files('common.c', 'default.c') srcs += files('common.c', 'default.c')
if conf_data.get('CONFIG_MAILCAP') and get_option('test') if conf_data.get('CONFIG_MAILCAP') and (get_option('test-mailcap') or get_option('test'))
mailcap_cache_files = files('common.c', 'mailcap.c', meson.source_root()+'/src/osdep/osdep.c') mailcap_cache_files = files('common.c', 'mailcap.c', meson.source_root()+'/src/osdep/osdep.c')
if conf_data.get('CONFIG_NLS') and not conf_data.get('CONFIG_GETTEXT') if conf_data.get('CONFIG_NLS') and not conf_data.get('CONFIG_GETTEXT')