rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re:  readline & history
@ 1994-08-13  5:46 Rich Salz
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Salz @ 1994-08-13  5:46 UTC (permalink / raw)
  To: rc-owner, rc

>With the current version of rc I am not able to use the $history-
>file with the readline-interface (i.e. CTRL-p, CTRL-r, ...).
>The following patch forces rc to add the contents of the file
>to the history list.
>
>any comments?

If you do this then you cannot use the small editline library since
it does not have the using_history() and read_history() functions.

Do you really want to suck your whole history file into your
shell's address space?

Ick.
	/r$


^ permalink raw reply	[flat|nested] 2+ messages in thread
* readline & history
@ 1994-08-08  9:27 Markus Friedl (CIP 92)
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Friedl (CIP 92) @ 1994-08-08  9:27 UTC (permalink / raw)
  To: rc-mailing-list

Hi!

With the current version of rc I am not able to use the $history-
file with the readline-interface (i.e. CTRL-p, CTRL-r, ...).
The following patch forces rc to add the contents of the file
to the history list.

any comments?

cu
--markus

===================================================================
RCS file: RCS/input.c,v
retrieving revision 1.3
diff -u -r1.3 input.c
--- 1.3	1994/06/22 08:31:07
+++ input.c	1994/08/07 21:39:33
@@ -23,6 +23,8 @@
 #ifdef READLINE
 extern char *readline(char *);
 extern void add_history(char *);
+extern int  read_history(char *);
+extern void using_history(void);
 static char *rlinebuf;
 #endif
 
@@ -256,6 +258,9 @@
 
 extern Node *doit(bool execit) {
 	bool eof;
+#ifdef READLINE
+	bool doinithist = TRUE;
+#endif
 	Jbwrap j;
 	Estack e1, e2;
 	Edata jerror;
@@ -277,6 +282,18 @@
 			dashell = FALSE;
 			b_dot(fname);
 		}
+#ifdef READLINE
+		if (doinithist && interactive) {
+			List *hist;
+			if (hist = varlookup("history")){
+				using_history();
+				read_history(hist->w);
+			} else {
+				fprint(2, "history not defined\n");
+			}
+			doinithist = FALSE;
+		}
+#endif
 		if (interactive) {
 			List *s;
 			if (!dashen && fnlookup("prompt") != NULL) {
-- 
Markus Friedl
msfriedl@cip.informatik.uni-erlangen.de


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

end of thread, other threads:[~1994-08-13  5:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-08-13  5:46 readline & history Rich Salz
  -- strict thread matches above, loose matches on Subject: below --
1994-08-08  9:27 Markus Friedl (CIP 92)

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).