* util.c (name_quote): Don't quote ':', '~' and '@'. Quote '#'
and '~' only if it's the first character.
Этот коммит содержится в:
родитель
5cecc135e1
Коммит
2edd447426
@ -1,5 +1,8 @@
|
|||||||
2003-01-28 Pavel Roskin <proski@gnu.org>
|
2003-01-28 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* util.c (name_quote): Don't quote ':', '~' and '@'. Quote '#'
|
||||||
|
and '~' only if it's the first character.
|
||||||
|
|
||||||
* info.c (info_show_info): Cast nlink_t to int to avoid a
|
* info.c (info_show_info): Cast nlink_t to int to avoid a
|
||||||
warning if nlink_t is short.
|
warning if nlink_t is short.
|
||||||
* screen.c (string_file_nlinks): Likewise.
|
* screen.c (string_file_nlinks): Likewise.
|
||||||
|
81
src/util.c
81
src/util.c
@ -143,53 +143,58 @@ trim (char *s, char *d, int len)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Quote the filename for the purpose of inserting it into the command
|
||||||
|
* line. If quote_percent is 1, replace "%" with "%%" - the percent is
|
||||||
|
* processed by the mc command line.
|
||||||
|
*/
|
||||||
char *
|
char *
|
||||||
name_quote (const char *s, int quote_percent)
|
name_quote (const char *s, int quote_percent)
|
||||||
{
|
{
|
||||||
char *ret, *d;
|
char *ret, *d;
|
||||||
|
|
||||||
d = ret = g_malloc (strlen (s)*2 + 2 + 1);
|
d = ret = g_malloc (strlen (s) * 2 + 2 + 1);
|
||||||
if (*s == '-') {
|
if (*s == '-') {
|
||||||
*d++ = '.';
|
*d++ = '.';
|
||||||
*d++ = '/';
|
*d++ = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; *s; s++, d++) {
|
for (; *s; s++, d++) {
|
||||||
switch (*s)
|
switch (*s) {
|
||||||
{
|
case '%':
|
||||||
case '%':
|
if (quote_percent)
|
||||||
if (quote_percent)
|
*d++ = '%';
|
||||||
*d++ = '%';
|
break;
|
||||||
break;
|
case '\'':
|
||||||
case '\'':
|
case '\\':
|
||||||
case '\\':
|
case '\r':
|
||||||
case '\r':
|
case '\n':
|
||||||
case '\n':
|
case '\t':
|
||||||
case '\t':
|
case '"':
|
||||||
case '"':
|
case ';':
|
||||||
case ':':
|
case ' ':
|
||||||
case ';':
|
case '?':
|
||||||
case ' ':
|
case '|':
|
||||||
case '?':
|
case '[':
|
||||||
case '|':
|
case ']':
|
||||||
case '[':
|
case '{':
|
||||||
case ']':
|
case '}':
|
||||||
case '{':
|
case '<':
|
||||||
case '}':
|
case '>':
|
||||||
case '<':
|
case '`':
|
||||||
case '>':
|
case '!':
|
||||||
case '`':
|
case '$':
|
||||||
case '~':
|
case '&':
|
||||||
case '!':
|
case '*':
|
||||||
case '@':
|
case '(':
|
||||||
case '#':
|
case ')':
|
||||||
case '$':
|
*d++ = '\\';
|
||||||
case '^':
|
break;
|
||||||
case '&':
|
case '~':
|
||||||
case '*':
|
case '#':
|
||||||
case '(':
|
if (d == ret)
|
||||||
case ')':
|
|
||||||
*d++ = '\\';
|
*d++ = '\\';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*d = *s;
|
*d = *s;
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user