mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* user.c (check_patterns): Ignore invalid shell_patterns and
let user see them in the menu. The error message was too vague.
This commit is contained in:
parent
da7e82d253
commit
cf31b0aacd
@ -1,3 +1,8 @@
|
||||
2002-09-26 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* user.c (check_patterns): Ignore invalid shell_patterns and
|
||||
let user see them in the menu. The error message was too vague.
|
||||
|
||||
2002-09-26 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* util.c (mc_mkstemps): Really return NULL in the filename in the
|
||||
|
31
src/user.c
31
src/user.c
@ -266,23 +266,30 @@ expand_format (WEdit * edit_widget, char c, int quote)
|
||||
return g_strdup ("");
|
||||
}
|
||||
|
||||
/* Checks for shell patterns definition */
|
||||
/*
|
||||
* Check for the "shell_patterns" directive. If it's found and valid,
|
||||
* interpret it and move the pointer past the directive. Return the
|
||||
* current pointer.
|
||||
*/
|
||||
static char *
|
||||
check_patterns (char *p)
|
||||
{
|
||||
static const char def_name[] = "shell_patterns=";
|
||||
int value;
|
||||
char *p0 = p;
|
||||
|
||||
if (strncmp (p, def_name, sizeof (def_name) - 1) == 0) {
|
||||
p += sizeof (def_name) - 1;
|
||||
value = *p++ - '0';
|
||||
if (value == 0 || value == 1)
|
||||
easy_patterns = value;
|
||||
else
|
||||
message (1, MSG_ERROR,
|
||||
_(" Invalid shell pattern definition \"%c\". "),
|
||||
value + '0');
|
||||
}
|
||||
if (strncmp (p, def_name, sizeof (def_name) - 1) != 0)
|
||||
return p0;
|
||||
|
||||
p += sizeof (def_name) - 1;
|
||||
if (*p == '1')
|
||||
easy_patterns = 1;
|
||||
else if (*p == '0')
|
||||
easy_patterns = 0;
|
||||
else
|
||||
return p0;
|
||||
|
||||
/* Skip spaces */
|
||||
p++;
|
||||
while (*p == '\n' || *p == '\t' || *p == ' ')
|
||||
p++;
|
||||
return p;
|
||||
|
Loading…
Reference in New Issue
Block a user