Changes between Version 2 and Version 3 of Ticket #3692, comment 5


Ignore:
Timestamp:
09/28/16 05:44:13 (6 years ago)
Author:
alllexx88
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3692, comment 5

    v2 v3  
    1212 
    1313{{{ 
     14#!c 
    1415#include <stdio.h> 
    1516#include <glib.h> 
     
    7778{ 
    7879    int exit_status; 
    79     char* argv[4]; 
    80  
    81     argv[0] = mc_shell->path; 
    82     argv[1] = "-c"; 
    83     argv[2] = command; 
    84     argv[3] = NULL; 
     80    char* argv[] = {mc_shell->path, "-c", command, NULL}; 
    8581 
    8682    return g_spawn_sync (NULL, argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, 
     
    169165       output for dash / BusyBox ash ("/a/") during first run, and if it doesn't match - 
    170166       test again to compare to BusyBox pre 1.20 broken printf output ("7a7") */ 
    171     command1 = g_strdup_printf ("str=$( (printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\nexit 0\\n\" | %s -i 1>/dev/null) 3>&1); if [ \"$str\" = \"/a/\" ]; then exit 0; else exit 1; fi", mc_shell->path); 
    172     command2 = g_strdup_printf ("str=$( (printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\nexit 0\\n\" | %s -i 1>/dev/null) 3>&1); if [ \"$str\" = \"7a7\" ]; then exit 0; else exit 1; fi", mc_shell->path); 
     167    command1 = g_strdup_printf ("str=$( (" 
     168                   "printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\n" 
     169                    "exit 0\\n\" | %s -i 1>/dev/null) 3>&1); " 
     170                 "if [ \"$str\" = \"/a/\" ]; then " 
     171                     "exit 0; " 
     172                 "else " 
     173                     "exit 1; " 
     174                 "fi", mc_shell->path); 
     175    command2 = g_strdup_printf ("str=$( (" 
     176                   "printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\n" 
     177                    "exit 0\\n\" | %s -i 1>/dev/null) 3>&1); " 
     178                 "if [ \"$str\" = \"7a7\" ]; then " 
     179                     "exit 0; " 
     180                 "else " 
     181                     "exit 1; " 
     182                 "fi", mc_shell->path); 
    173183 
    174184    if (mc_shell_command_success (mc_shell, command1, NULL)) 
     
    202212    return 0; 
    203213} 
    204  
    205214}}} 
    206215 
     
    243252 
    244253P.S. I should note that on my system `/bin/csh` is actually `bsd-csh`, so it's detected as unsupported correctly. 
     254 
     255P.P.S. And also I forgot to mention that `/opt/bin/ash` and `/opt/bin/hush` are different `busybox` binaries: `/opt/bin/ash` has `ash` as `sh`, and `/opt/bin/hush` -- `hush`