• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3860 (tree)
Time2018-09-16 12:34:51
Authormagicant

Log Message

Trim blanks from alias-substituted word

The word parsed in the parse_word_as_wcs function is subject to alias
substitution. If the value of the alias substitution begins with a
blank, it should not be included in the final word.

Change Summary

Incremental Difference

--- yash/trunk/NEWS (revision 3859)
+++ yash/trunk/NEWS (revision 3860)
@@ -15,6 +15,10 @@
1515 = The default value of $PS1 has been changed.
1616 * The line number is now correctly counted in arithmetic
1717 expansions that contain newlines.
18+ * The variable name token in the for command and the word following
19+ a here-document redirection operator are now correctly parsed
20+ even when it resulted from an alias substitution whose value
21+ begins with a blank.
1822 . Updated the sample initialization script (yashrc):
1923 = The prompt strings are now defined with the $YASH_PS...
2024 variables.
--- yash/trunk/parser.c (revision 3859)
+++ yash/trunk/parser.c (revision 3860)
@@ -2014,8 +2014,10 @@
20142014 * This function never returns NULL, but may return an empty string. */
20152015 wchar_t *parse_word_as_wcs(parsestate_T *ps)
20162016 {
2017+ psubstitute_alias_recursive(ps, 0);
2018+
20172019 size_t startindex = ps->index;
2018- wordfree(parse_word(ps, true));
2020+ wordfree(parse_word(ps, false));
20192021 assert(startindex <= ps->index);
20202022 return xwcsndup(&ps->src.contents[startindex], ps->index - startindex);
20212023 }
Show on old repository browser