From dbdd49718d73e493bc1110950f0ea25f02879213 Mon Sep 17 00:00:00 2001 From: Scott Mcdermott Date: Mon, 8 Apr 2024 02:22:43 -0700 Subject: [PATCH] [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 --- src/mime/backend/mailcap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index 97ea6627..6939f506 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -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"))