* subshell.c (subshell_name_quote): Don't quote numbers and
letters if possible and safe.
Этот коммит содержится в:
родитель
cc0811a2ff
Коммит
2c3b0c50b6
@ -1,5 +1,8 @@
|
|||||||
2002-10-30 Pavel Roskin <proski@gnu.org>
|
2002-10-30 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* subshell.c (subshell_name_quote): Don't quote numbers and
|
||||||
|
letters if possible and safe.
|
||||||
|
|
||||||
* charset.h: Provide new inline functions convert_to_display_c()
|
* charset.h: Provide new inline functions convert_to_display_c()
|
||||||
and convert_from_input_c().
|
and convert_from_input_c().
|
||||||
* view.c: Include charset.h unconditionally, use new conversion
|
* view.c: Include charset.h unconditionally, use new conversion
|
||||||
|
3
src/TODO
3
src/TODO
@ -1,9 +1,6 @@
|
|||||||
Before 4.6.0-pre2
|
Before 4.6.0-pre2
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Use paranoid quoting in subshell_name_quote() only when absolutely
|
|
||||||
necessary - it's slow, especially in UTF-8 locales.
|
|
||||||
|
|
||||||
Don't allow stdout and stderr from extfs scripts pollute the screen.
|
Don't allow stdout and stderr from extfs scripts pollute the screen.
|
||||||
|
|
||||||
reimplement "-P" in a safer way (temp file instead of stdout) - possibly
|
reimplement "-P" in a safer way (temp file instead of stdout) - possibly
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <string.h> /* strstr(), strcpy(), etc. */
|
#include <string.h> /* strstr(), strcpy(), etc. */
|
||||||
#include <signal.h> /* sigaction(), sigprocmask(), etc. */
|
#include <signal.h> /* sigaction(), sigprocmask(), etc. */
|
||||||
#include <sys/stat.h> /* Required by dir.h & panel.h below */
|
#include <sys/stat.h> /* Required by dir.h & panel.h below */
|
||||||
|
#include <ctype.h> /* isalnum() */
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h> /* For pipe, fork, setsid, access etc */
|
# include <unistd.h> /* For pipe, fork, setsid, access etc */
|
||||||
@ -752,8 +753,8 @@ subshell_name_quote (const char *s)
|
|||||||
|
|
||||||
/* Prevent interpreting leading `-' as a switch for `cd' */
|
/* Prevent interpreting leading `-' as a switch for `cd' */
|
||||||
if (*s == '-') {
|
if (*s == '-') {
|
||||||
*d++ = '.';
|
*d++ = '.';
|
||||||
*d++ = '/';
|
*d++ = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* echo in tcsh doesn't understand the "-e" option */
|
/* echo in tcsh doesn't understand the "-e" option */
|
||||||
@ -769,17 +770,28 @@ subshell_name_quote (const char *s)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Print every character in octal format with the leading backslash.
|
* Print every character in octal format with the leading backslash.
|
||||||
* tcsh and zsh may require 4-digit octals, bash doesn't like them.
|
* tcsh and zsh may require 4-digit octals, bash < 2.05b doesn't like them.
|
||||||
*/
|
*/
|
||||||
if (subshell_type == BASH) {
|
if (subshell_type == BASH) {
|
||||||
for (; *s; s++) {
|
for (; *s; s++) {
|
||||||
sprintf(d, "\\%03o", (unsigned char) *s);
|
/* Must quote numbers, so that they are not glued to octals */
|
||||||
d += 4;
|
if (isalpha ((unsigned char) *s)) {
|
||||||
|
sprintf (d, "%c", (unsigned char) *s);
|
||||||
|
d += 1;
|
||||||
|
} else {
|
||||||
|
sprintf (d, "\\%03o", (unsigned char) *s);
|
||||||
|
d += 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (; *s; s++) {
|
for (; *s; s++) {
|
||||||
sprintf(d, "\\0%03o", (unsigned char) *s);
|
if (isalnum ((unsigned char) *s)) {
|
||||||
d += 5;
|
sprintf (d, "%c", (unsigned char) *s);
|
||||||
|
d += 1;
|
||||||
|
} else {
|
||||||
|
sprintf (d, "\\0%03o", (unsigned char) *s);
|
||||||
|
d += 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user