From 10b38146e8f10b52ce60e97ad3f2172b40a84db8 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Fri, 19 Mar 2021 13:46:13 +0100 Subject: [PATCH] gst-inspect: Allow overriding DEFAULT_LESS_OPTS with GST_LESS Part-of: --- tools/gst-inspect-1.0.1 | 11 +++++++++++ tools/gst-inspect.c | 11 +++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/gst-inspect-1.0.1 b/tools/gst-inspect-1.0.1 index 6cd5c665c9..6299f4c1d6 100644 --- a/tools/gst-inspect-1.0.1 +++ b/tools/gst-inspect-1.0.1 @@ -81,6 +81,17 @@ Enable printout of errors while loading \fIGStreamer\fP plugins .B \-\-gst\-plugin\-path=PATH Add directories separated with ':' to the plugin search path . +.SH "ENVIRONMENT VARIABLES" +.l +\fIgst\-inspect\-1.0\fP reads the following environment variables, in addition +to the generic \fIGStreamer\fP environment variables also described in +.BR gst\-launch\-1.0 (1): +.TP 8 +.B GST_LESS +Override the options passed to \fIless\fR (by default "RXF"). +.br +See \fBless\fR(1) for more information. +. .SH "SEE ALSO" .BR gst\-launch\-1.0 (1), .BR gst\-typefind\-1.0 (1) diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index e0d5a41ccb..3791ec1b3b 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -45,6 +45,9 @@ /* "R" : support color * "X" : do not clear the screen when leaving the pager * "F" : skip the pager if content fit into the screen + * + * Don't forget to update the manpage gst-inspect-1.0.1 + * after changing this default. */ #define DEFAULT_LESS_OPTS "RXF" @@ -1949,7 +1952,7 @@ redirect_stdout (void) { GError *error = NULL; gchar **argv; - const gchar *pager; + const gchar *pager, *less; gint stdin_fd; gchar **envp; @@ -1959,8 +1962,12 @@ redirect_stdout (void) argv = g_strsplit (pager, " ", 0); + less = g_getenv ("GST_LESS"); + if (less == NULL) + less = DEFAULT_LESS_OPTS; + envp = g_get_environ (); - envp = g_environ_setenv (envp, "LESS", DEFAULT_LESS_OPTS, TRUE); + envp = g_environ_setenv (envp, "LESS", less, TRUE); if (!g_spawn_async_with_pipes (NULL, argv, envp, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,