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

[mailcap] allow to run 'mailcap-cache' test with --display=0/1 or yes/no

the tests do not allow ever matching the entries with DISPLAY=:0 test,
since it's hardcoded to force $DISPLAY unset

leave default unchanged, (forced unset), but just add a command line
flag if user wants to match the entry with $DISPLAY set in mailcap
This commit is contained in:
Scott Mcdermott 2024-04-08 02:22:43 -07:00
parent afc5ac5deb
commit dbdd49718d

View File

@ -809,6 +809,7 @@ main(int argc, char *argv[])
{
char *format = "description,ask,block,program";
int has_gotten = 0;
int setenv_display = 0;
int 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")) {
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")) {
struct mime_handler *handler;
@ -833,7 +838,7 @@ main(int argc, char *argv[])
printf("\n");
has_gotten = 1;
printf("type: %s\n", arg);
handler = get_mime_handler_mailcap(arg, 0);
handler = get_mime_handler_mailcap(arg, setenv_display);
if (!handler) continue;
if (strstr(format, "description"))