Ticket #4597: 0003-Ticket-4597-export-MC_VERSION-to-subshell.patch

File 0003-Ticket-4597-export-MC_VERSION-to-subshell.patch, 1.6 KB (added by johannes, 6 days ago)
  • src/subshell/common.c

    From 2d1a52608bc2e64975e75dea7b760693031181dc Mon Sep 17 00:00:00 2001
    From: Johannes Altmanninger <aclopte@gmail.com>
    Date: Fri, 11 Oct 2024 08:26:48 +0200
    Subject: [PATCH 3/3] Ticket #4597: export MC_VERSION to subshell
    
    This lets fish know if we are running 4.8.33 or greater which means
    fish can use the kitty keyboard protocol without breaking mc.
    
    I have a slight preference for doing this instead of parsing
    "mc --version" because these version checks are currently hardcoded in
    fish's early startup; if we wanted to run external programs we should
    move that to a shell function but I don't see a strong reason to do so.
    
    Additionally, this approach does a better job of actually matching the
    running mc binary (I don't think there is a portable way of getting
    the "parent process executable path").
    
    Anyway, no strong opinion; either way works for me.
    ---
     src/subshell/common.c | 2 ++
     1 file changed, 2 insertions(+)
    
    diff --git a/src/subshell/common.c b/src/subshell/common.c
    index 85eef1181..739954bb1 100644
    a b  
    105105#include "lib/strutil.h" 
    106106#include "lib/mcconfig.h" 
    107107#include "lib/util.h" 
     108#include "mc-version.h" 
    108109#include "lib/widget.h" 
    109110 
    110111#include "src/filemanager/layout.h"     /* setup_cmdline() */ 
    init_subshell_child (const char *pty_name) 
    316317        g_snprintf (sid_str, sizeof (sid_str), "MC_SID=%ld", (long) mc_sid); 
    317318        putenv (g_strdup (sid_str)); 
    318319    } 
     320    putenv ((char *)"MC_VERSION=" MC_CURRENT_VERSION); 
    319321 
    320322    switch (mc_global.shell->type) 
    321323    {