alias to determine whether or not to add a trailing space instead
of testing against a space only. These are the non-shell-metacharacters
that can delimit words. Used together with PST_ENDALIAS
+
+ 1/17
+ ----
+parse.y
+ - shell_getc: keep track of whether the last character read from
+ shell_input_line is an unquoted backslash and don't add a space to
+ the end of an alias if the alias value ends in an unquoted backslash.
+ From an austin-group mailing list discussion message from
+ Harald van Dijk <ag@gigawatt.nl>
+
+ 1/20
+ ----
+general.c
+ - check_identifier: make sure CHECK_WORD is non-zero before we check
+ whether or not the word consists of all digits. This allows function
+ names to consist solely of digits when not in posix mode. From a
+ report by Andrey Butirsky <butirsky@gmail.com>
static int bash_complete_command __P((int, int));
static int bash_possible_command_completions __P((int, int));
-static int completion_glob_pattern __P((const char *));
+static int completion_glob_pattern __P((char *));
static char *glob_complete_word __P((const char *, int));
static int bash_glob_completion_internal __P((int));
static int bash_glob_complete_word __P((int, int));
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
- if (!matches && completion_glob_pattern (text))
+ if (!matches && completion_glob_pattern ((char *)text))
{
matches = rl_completion_matches (text, glob_complete_word);
/* A glob expression that matches more than one filename is problematic.
glob_matches = (char **)NULL;
}
- globpat = completion_glob_pattern (hint_text);
+ globpat = completion_glob_pattern ((char *)hint_text);
/* If this is an absolute program name, do not check it against
aliases, reserved words, functions or builtins. We must check
static int
completion_glob_pattern (string)
- const char *string;
+ char *string;
{
register int c;
char *send;
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options and actions should
-apply to completion on the inital non-assignment word on the line, or after
+apply to completion on the initial non-assignment word on the line, or after
a command delimiter such as \fB;\fP or \fB|\fP, which is usually command
name completion.
If multiple options are supplied, the \fB\-D\fP option takes precedence
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options should
-apply to completion on the inital non-assignment word on the line,
+apply to completion on the initial non-assignment word on the line,
or after a command delimiter such as \fB;\fP or \fB|\fP, which is usually
command name completion.
.sp 1
@itemx $@{@var{parameter}%%@var{word}@}
The @var{word}
is expanded to produce a pattern and matched according to the rules
-described below (@pxref{Pattern Matching}). If the pattern matches
+described below (@pxref{Pattern Matching}).
If the pattern matches a trailing portion of the expanded value of
@var{parameter}, then the result of the expansion is the value of
@var{parameter} with the shortest matching pattern (the @samp{%} case)
}
/* Make sure that WORD is a valid shell identifier, i.e.
- does not contain a dollar sign, nor is quoted in any way. Nor
- does it consist of all digits. If CHECK_WORD is non-zero,
+ does not contain a dollar sign, nor is quoted in any way.
+ If CHECK_WORD is non-zero,
the word is checked to ensure that it consists of only letters,
- digits, and underscores. */
+ digits, and underscores, and does not consist of all digits. */
int
check_identifier (word, check_word)
WORD_DESC *word;
int check_word;
{
- if ((word->flags & (W_HASDOLLAR|W_QUOTED)) || all_digits (word->word))
+ if (word->flags & (W_HASDOLLAR|W_QUOTED)) /* XXX - HASDOLLAR? */
{
internal_error (_("`%s': not a valid identifier"), word->word);
return (0);
}
- else if (check_word && legal_identifier (word->word) == 0)
+ else if (check_word && (all_digits (word->word) || legal_identifier (word->word) == 0))
{
internal_error (_("`%s': not a valid identifier"), word->word);
return (0);
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options and actions should
-apply to completion on the inital non-assignment word on the line, or after a
+apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
If multiple options are supplied, the @option{-D} option takes precedence
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options should
-apply to completion on the inital non-assignment word on the line, or after a
+apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
shell_ungetc when we're at the start of a line. */
static int eol_ungetc_lookahead = 0;
+static int unquoted_backslash = 0;
+
static int
shell_getc (remove_quoted_newline)
int remove_quoted_newline;
}
next_alias_char:
+if (shell_input_line_index == 0)
+ unquoted_backslash = 0;
+
uc = shell_input_line[shell_input_line_index];
if (uc)
+{
+unquoted_backslash = unquoted_backslash == 0 && uc == '\\';
shell_input_line_index++;
+}
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
/* If UC is NULL, we have reached the end of the current input string. If
shell_input_line_index > 0 &&
shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
shell_input_line[shell_input_line_index-1] != '\n' &&
+ unquoted_backslash == 0 &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 0
+#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
ok 3
ok 4
bar
+bad
+0
+<|cat>
"
foo
+
+alias foo=$'echo bad \t'
+foo
+
+# this should probably just echo a blank line to stdout
+alias foo='echo 0'
+foo>&2
+
+alias a='printf "<%s>\n" \'
+a|cat