Ticket #1425 (new defect) — at Initial Version

Opened 11 years ago

Last modified 10 years ago

External editor won't open if there are spaces in EDITOR variable

Reported by: andreitch Owned by:
Priority: minor Milestone: 4.7.0-pre2
Component: mcedit Version: 4.6.2
Keywords: editor Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description

If there are spaces in the EDITOR environment variable, mc won't load it.

These first two examples work, but the last ones don't:

EDITOR=emacs mc
EDITOR=mcedit mc
EDITOR='emacs -nw' mc
EDITOR='mc -e' mc

I think it's a problem with my_system function (utilunix.c, line 128) when it calls execl and execlp. You can see by running this two little C programs that they don't work. The third one works as expected.

#include <unistd.h>

int main(int argc, char *argv[])
{
    execlp("sh", "sh", "emacs -nw", (char *)NULL);
    return 0;
}
#include <unistd.h>

int main(int argc, char *argv[])
{
    execl("sh", "sh", "-c", "emacs -nw", (char *)NULL);
    return 0;
}
#include <unistd.h>

int main(int argc, char *argv[])
{
    execlp("sh", "sh", "-c", "emacs -nw", (char *)NULL);
    return 0;
}

}}}

Note: See TracTickets for help on using tickets.