Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 523742 | Differences between
and this patch

Collapse All | Expand All

(-)a/bash/parse.y (-8 / +20 lines)
Lines 264-272 Link Here
264
264
265
/* Variables to manage the task of reading here documents, because we need to
265
/* Variables to manage the task of reading here documents, because we need to
266
   defer the reading until after a complete command has been collected. */
266
   defer the reading until after a complete command has been collected. */
267
static REDIRECT *redir_stack[10];
267
static REDIRECT **redir_stack;
268
int need_here_doc;
268
int need_here_doc;
269
269
270
/* Pushes REDIR onto redir_stack, resizing it as needed. */
271
static void
272
push_redir_stack (REDIRECT *redir)
273
{
274
  /* Guard against oveflow. */
275
  if (need_here_doc + 1 > INT_MAX / sizeof (*redir_stack))
276
    abort ();
277
  redir_stack = xrealloc (redir_stack,
278
			  (need_here_doc + 1) * sizeof (*redir_stack));
279
  redir_stack[need_here_doc++] = redir;
280
}
281
270
/* Where shell input comes from.  History expansion is performed on each
282
/* Where shell input comes from.  History expansion is performed on each
271
   line when the shell is interactive. */
283
   line when the shell is interactive. */
272
static char *shell_input_line = (char *)NULL;
284
static char *shell_input_line = (char *)NULL;
Lines 519-560 Link Here
519
			  source.dest = 0;
531
			  source.dest = 0;
520
			  redir.filename = $2;
532
			  redir.filename = $2;
521
			  $$ = make_redirection (source, r_reading_until, redir, 0);
533
			  $$ = make_redirection (source, r_reading_until, redir, 0);
522
			  redir_stack[need_here_doc++] = $$;
534
			  push_redir_stack ($$);
523
			}
535
			}
524
	|	NUMBER LESS_LESS WORD
536
	|	NUMBER LESS_LESS WORD
525
			{
537
			{
526
			  source.dest = $1;
538
			  source.dest = $1;
527
			  redir.filename = $3;
539
			  redir.filename = $3;
528
			  $$ = make_redirection (source, r_reading_until, redir, 0);
540
			  $$ = make_redirection (source, r_reading_until, redir, 0);
529
			  redir_stack[need_here_doc++] = $$;
541
			  push_redir_stack ($$);
530
			}
542
			}
531
	|	REDIR_WORD LESS_LESS WORD
543
	|	REDIR_WORD LESS_LESS WORD
532
			{
544
			{
533
			  source.filename = $1;
545
			  source.filename = $1;
534
			  redir.filename = $3;
546
			  redir.filename = $3;
535
			  $$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN);
547
			  $$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN);
536
			  redir_stack[need_here_doc++] = $$;
548
			  push_redir_stack ($$);
537
			}
549
			}
538
	|	LESS_LESS_MINUS WORD
550
	|	LESS_LESS_MINUS WORD
539
			{
551
			{
540
			  source.dest = 0;
552
			  source.dest = 0;
541
			  redir.filename = $2;
553
			  redir.filename = $2;
542
			  $$ = make_redirection (source, r_deblank_reading_until, redir, 0);
554
			  $$ = make_redirection (source, r_deblank_reading_until, redir, 0);
543
			  redir_stack[need_here_doc++] = $$;
555
			  push_redir_stack ($$);
544
			}
556
			}
545
	|	NUMBER LESS_LESS_MINUS WORD
557
	|	NUMBER LESS_LESS_MINUS WORD
546
			{
558
			{
547
			  source.dest = $1;
559
			  source.dest = $1;
548
			  redir.filename = $3;
560
			  redir.filename = $3;
549
			  $$ = make_redirection (source, r_deblank_reading_until, redir, 0);
561
			  $$ = make_redirection (source, r_deblank_reading_until, redir, 0);
550
			  redir_stack[need_here_doc++] = $$;
562
			  push_redir_stack ($$);
551
			}
563
			}
552
	|	REDIR_WORD  LESS_LESS_MINUS WORD
564
	|	REDIR_WORD  LESS_LESS_MINUS WORD
553
			{
565
			{
554
			  source.filename = $1;
566
			  source.filename = $1;
555
			  redir.filename = $3;
567
			  redir.filename = $3;
556
			  $$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN);
568
			  $$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN);
557
			  redir_stack[need_here_doc++] = $$;
569
			  push_redir_stack ($$);
558
			}
570
			}
559
	|	LESS_LESS_LESS WORD
571
	|	LESS_LESS_LESS WORD
560
			{
572
			{
Lines 4757-4763 Link Here
4757
    case CASE:
4769
    case CASE:
4758
    case SELECT:
4770
    case SELECT:
4759
    case FOR:
4771
    case FOR:
4760
      if (word_top < MAX_CASE_NEST)
4772
      if (word_top + 1 < MAX_CASE_NEST)
4761
	word_top++;
4773
	word_top++;
4762
      word_lineno[word_top] = line_number;
4774
      word_lineno[word_top] = line_number;
4763
      break;
4775
      break;

Return to bug 523742