rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: trip took a wrong turn: dot -i
@ 1993-04-22  2:01 Paul Haahr
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Haahr @ 1993-04-22  2:01 UTC (permalink / raw)
  To: culliton; +Cc: rc

just to confirm Tom's previous note, rc-1.4 w/o readline does the
right thing here.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: trip took a wrong turn: dot -i
@ 1993-05-12  5:37 Byron Rakitzis
  0 siblings, 0 replies; 6+ messages in thread
From: Byron Rakitzis @ 1993-05-12  5:37 UTC (permalink / raw)
  To: culliton, rc

I've thought about it for a little while and I can't make up my
mind.

Here is my preference: readline should take a file descriptor as
an argument.

Ok, given that that is "impossible", I think the best way out may
be to make the rest of the prompt2 stuff in rc readline- and file-
descriptor-cognisant, i.e., by printing prompt2 if "!readline ||
fd != 0".

It's ugly, but I can rationalize it by saying that it's hiding behind
this grotesque #ifdef READLINE to begin with.

Byron.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: trip took a wrong turn: dot -i
@ 1993-05-11 12:15 rsalz
  0 siblings, 0 replies; 6+ messages in thread
From: rsalz @ 1993-05-11 12:15 UTC (permalink / raw)
  To: culliton, rc

>2) Tell readline to use the appropriate fd by setting rl_instream or
...
>Chet: Is there a better way to twist readline's tail?

Please don't do anything that affects the readline use.  If you do,
then I will have to muck up my editline drop-in replacement and I'd
rather not do that. :-)
	/r$


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: trip took a wrong turn: dot -i
@ 1993-05-10 22:56 Tom Culliton x2278
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Culliton x2278 @ 1993-05-10 22:56 UTC (permalink / raw)
  To: rc

First I encountered this problem with -i when I fixed trip.rc.

> For example on my system feeding the following script to rc makes it
> stop and wait for user commands but doesn't ever print the prompt!
> 
> ------------------------------------------------------------------------------
> #! /bin/rc
> echo 'This is test of ". -i"'
> echo 'First we set the prompt to something we''ll recognize'
> prompt=(PROMPT1 PROMPT2)
> echo 'we now try to go interactive'
> . -i /dev/tty
> echo 'end of interaction'
> ------------------------------------------------------------------------------

Then I narrowed it down to being readline related.

> My earlier message didn't mention that I'm using GNU readline with rc. 
> From looking at the code it seems like a bug in the section of input.c
> around line 118 which is conditionally included for READLINE.  If my
> brain was working better (or when it is) I might have a go at fixing
> it.

Now I understand exactly what is happening but can't decide what the
"right way" to fix it is.  Maybe Byron or Chet can make a suggestion.

Without READLINE defined there is some code in input.c and lex.c that
print the appropriate prompts if the global variable interactive is
TRUE.  With READLINE defined, they simply set the variable prompt which
gets passed to the readline function.  So far, so good.  However, if the
fd beig read is not stdin, readline is not called, and as a result no
prompt gets printed.  Blech!

I see two possible solutions. 

1) If we're not going to call readline, print the prompts, either where
they would be printed "normally" or in the code surrounding the readline
call.  This is simple but inconsistent.

2) Tell readline to use the appropriate fd by setting rl_instream or
some other means.  Unfortunately readline seems to want to deal in FILE
*'s rather than fd's, so a fdopen() might be required to get one, which
seems pretty silly because readline always does a fileno() on them!

Chet: Is there a better way to twist readline's tail?  Byron: Care to
state a preference?  I'll post a patch as soon as the choice becomes
clear.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: trip took a wrong turn: dot -i
@ 1993-04-21 23:55 Tom Culliton x2278
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Culliton x2278 @ 1993-04-21 23:55 UTC (permalink / raw)
  To: culliton, rc

My earlier message didn't mention that I'm using GNU readline with rc. 
From looking at the code it seems like a bug in the section of input.c
around line 118 which is conditionally included for READLINE.  If my
brain was working better (or when it is) I might have a go at fixing
it.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* trip took a wrong turn: dot -i
@ 1993-04-21 23:26 Tom Culliton x2278
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Culliton x2278 @ 1993-04-21 23:26 UTC (permalink / raw)
  To: rc

I was reading back through old messsages to the mailing list and came
across a comment about trip.rc having "~!" in four places where it
should have "!~".  Being a damned fool, I went and fixed it, which of
course made me very unhappy because it revealed a problem with '. -i'
not printing a prompt like it should.  AAARGH! (Why couldn't I leave
well enough alone?)

For example on my system feeding the following script to rc makes it
stop and wait for user commands but doesn't ever print the prompt!

------------------------------------------------------------------------------
#! /bin/rc
echo 'This is test of ". -i"'
echo 'First we set the prompt to something we''ll recognize'
prompt=(PROMPT1 PROMPT2)
echo 'we now try to go interactive'
. -i /dev/tty
echo 'end of interaction'
------------------------------------------------------------------------------

Anybody got a clue?

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1993-05-12  5:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-22  2:01 trip took a wrong turn: dot -i Paul Haahr
  -- strict thread matches above, loose matches on Subject: below --
1993-05-12  5:37 Byron Rakitzis
1993-05-11 12:15 rsalz
1993-05-10 22:56 Tom Culliton x2278
1993-04-21 23:55 Tom Culliton x2278
1993-04-21 23:26 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).