Merge branch 'mc-4.6'

* mc-4.6:
  commandline: strip_escape: strip xterm OSC commands in $PS1
  src/main.c (main): create MC home directory with 700 mode instead of 755 one.
  src/main.c (main): create MC home directory (~/.mc) if absent.
This commit is contained in:
Sergei Trofimovich 2009-05-13 10:21:16 +03:00
commit a70a6e278e

View File

@ -758,6 +758,34 @@ strip_ctrl_codes (char *s)
if (*(++r) == '[') { if (*(++r) == '[') {
/* strchr() matches trailing binary 0 */ /* strchr() matches trailing binary 0 */
while (*(++r) && strchr ("0123456789;?", *r)); while (*(++r) && strchr ("0123456789;?", *r));
} else
if (*r == ']') {
/*
* Skip xterm's OSC (Operating System Command)
* http://www.xfree86.org/current/ctlseqs.html
* OSC P s ; P t ST
* OSC P s ; P t BEL
*/
char * new_r = r;
for (; *new_r; ++new_r)
{
switch (*new_r)
{
/* BEL */
case '\a':
r = new_r;
goto osc_out;
case ESC_CHAR:
/* ST */
if (*(new_r + 1) == '\\')
{
r = new_r + 1;
goto osc_out;
}
}
}
osc_out:;
} }
/* /*