* 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>
|
||||
|
||||
* 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()
|
||||
and convert_from_input_c().
|
||||
* view.c: Include charset.h unconditionally, use new conversion
|
||||
|
3
src/TODO
3
src/TODO
@ -1,9 +1,6 @@
|
||||
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.
|
||||
|
||||
reimplement "-P" in a safer way (temp file instead of stdout) - possibly
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <string.h> /* strstr(), strcpy(), etc. */
|
||||
#include <signal.h> /* sigaction(), sigprocmask(), etc. */
|
||||
#include <sys/stat.h> /* Required by dir.h & panel.h below */
|
||||
#include <ctype.h> /* isalnum() */
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h> /* For pipe, fork, setsid, access etc */
|
||||
@ -769,19 +770,30 @@ subshell_name_quote (const char *s)
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
for (; *s; s++) {
|
||||
sprintf(d, "\\%03o", (unsigned char) *s);
|
||||
/* Must quote numbers, so that they are not glued to octals */
|
||||
if (isalpha ((unsigned char) *s)) {
|
||||
sprintf (d, "%c", (unsigned char) *s);
|
||||
d += 1;
|
||||
} else {
|
||||
sprintf (d, "\\%03o", (unsigned char) *s);
|
||||
d += 4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (; *s; s++) {
|
||||
sprintf(d, "\\0%03o", (unsigned char) *s);
|
||||
if (isalnum ((unsigned char) *s)) {
|
||||
sprintf (d, "%c", (unsigned char) *s);
|
||||
d += 1;
|
||||
} else {
|
||||
sprintf (d, "\\0%03o", (unsigned char) *s);
|
||||
d += 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (d, common_end, sizeof (common_end));
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user