mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
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:
commit
a70a6e278e
28
src/util.c
28
src/util.c
@ -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:;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user