Changeset 3245 for trunk


Ignore:
Timestamp:
Apr 30, 2007, 1:15:23 AM (18 years ago)
Author:
bird
Message:

Applied bash31-010

Location:
trunk/essentials/app-shells/bash
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/essentials/app-shells/bash/parse.y

    r3236 r3245  
    27192719#define P_DQUOTE        0x04
    27202720#define P_COMMAND       0x08    /* parsing a command, so look for comments */
     2721#define P_BACKQUOTE     0x10    /* parsing a backquoted command substitution */
    27212722
    27222723static char matched_pair_error;
     
    27282729{
    27292730  int count, ch, was_dollar, in_comment, check_comment;
    2730   int pass_next_character, nestlen, ttranslen, start_lineno;
     2731  int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
    27312732  char *ret, *nestret, *ttrans;
    27322733  int retind, retsize, rflags;
    27332734
    27342735  count = 1;
    2735   pass_next_character = was_dollar = in_comment = 0;
     2736  pass_next_character = backq_backslash = was_dollar = in_comment = 0;
    27362737  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
    27372738
     
    27452746  while (count)
    27462747    {
    2747 #if 0
    2748       ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
    2749 #else
    2750       ch = shell_getc (qc != '\'' && pass_next_character == 0);
    2751 #endif
     2748      ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
     2749
    27522750      if (ch == EOF)
    27532751        {
     
    27742772        }
    27752773      /* Not exactly right yet */
    2776       else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
     2774      else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
    27772775        in_comment = 1;
     2776
     2777      /* last char was backslash inside backquoted command substitution */
     2778      if (backq_backslash)
     2779        {
     2780          backq_backslash = 0;
     2781          /* Placeholder for adding special characters */
     2782        }
    27782783
    27792784      if (pass_next_character)          /* last char was backslash */
     
    28172822          if MBTEST((flags & P_ALLOWESC) && ch == '\\')
    28182823            pass_next_character++;
     2824          else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
     2825            backq_backslash++;
    28192826          continue;
    28202827        }
     
    29012908      else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
    29022909        {
    2903           nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
     2910          /* Add P_BACKQUOTE so backslash quotes the next character and
     2911             shell_getc does the right thing with \<newline>.  We do this for
     2912             a measure  of backwards compatibility -- it's not strictly the
     2913             right POSIX thing. */
     2914          nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
    29042915          goto add_nestret;
    29052916        }
  • trunk/essentials/app-shells/bash/patchlevel.h

    r3244 r3245  
    2626   looks for to find the patch level (for the sccs version string). */
    2727
    28 #define PATCHLEVEL 9
     28#define PATCHLEVEL 10
    2929
    3030#endif /* _PATCHLEVEL_H_ */
Note: See TracChangeset for help on using the changeset viewer.