rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* A patch for prompting (was Re: trip took a wrong turn: dot -i)
@ 1993-05-13 17:59 Tom Culliton x2278
  0 siblings, 0 replies; only message in thread
From: Tom Culliton x2278 @ 1993-05-13 17:59 UTC (permalink / raw)
  To: rc

Here is my patch for the problem in input.c and lex.c.  Note that I
moved the function print_prompt2 from lex.c to input.c to keep the
variable istack static to input.c.  This patch is against version 1.4
"as released" and includes the one line patch I sent shortly after the
release.  With the patch applied the corrected (~! fixed to !~) trip.rc
completes successfully.

Tom

----------8<--------------------CUT HERE--------------------8<----------
*** lex.c.old	Mon May 25 14:11:51 1992
--- lex.c	Thu May 13 11:44:24 1993
***************
*** 339,354 ****
  		realbuf = ealloc(bufsize);
  }
  
- extern void print_prompt2() {
- 	lineno++;
- #ifdef READLINE
- 	prompt = prompt2;
- #else
- 	if (interactive)
- 		fprint(2, "%s", prompt2);
- #endif
- }
- 
  /*
     Scan in a pair of integers for redirections like >[2=1]. CLOSED represents a closed file
     descriptor (i.e., >[2=]) and UNSET represents an undesignated file descriptor (e.g.,
--- 339,344 ----
*** input.c.old	Mon May 25 15:31:28 1992
--- input.c	Thu May 13 12:08:17 1993
***************
*** 117,123 ****
  		while (1) {
  #ifdef READLINE
  			if (interactive && istack->fd == 0) {
! 				rlinebuf = readline(prompt);
  				if (rlinebuf == NULL) {
  					chars_in = 0;
  				} else {
--- 117,123 ----
  		while (1) {
  #ifdef READLINE
  			if (interactive && istack->fd == 0) {
! 				rlinebuf = rc_readline(prompt);
  				if (rlinebuf == NULL) {
  					chars_in = 0;
  				} else {
***************
*** 275,284 ****
  			}
  			if ((s = varlookup("prompt")) != NULL) {
  #ifdef READLINE
! 				prompt = s->w;
! #else
! 				fprint(2, "%s", s->w);
  #endif
  				prompt2 = (s->n == NULL ? "" : s->n->w);
  			}
  		}
--- 275,285 ----
  			}
  			if ((s = varlookup("prompt")) != NULL) {
  #ifdef READLINE
! 				if (istack->fd == 0)
! 					prompt = s->w;
! 				else
  #endif
+ 					fprint(2, "%s", s->w);
  				prompt2 = (s->n == NULL ? "" : s->n->w);
  			}
  		}
***************
*** 298,303 ****
--- 299,317 ----
  	unexcept(); /* eError */
  	return parsetree;
  }
+ 
+ extern void print_prompt2() {
+ 	lineno++;
+ 	if (interactive)
+ 	{
+ #ifdef READLINE
+ 		if (istack->fd == 0)
+ 			prompt = prompt2;
+ 		else
+ #endif
+ 			fprint(2, "%s", prompt2);
+ 	}
+ }
  
  /* parse a function imported from the environment */
  


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-05-13 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-13 17:59 A patch for prompting (was Re: trip took a wrong turn: dot -i) Tom Culliton x2278

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).