rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: "Markus Friedl (CIP 92)" <msfriedl@cip.informatik.uni-erlangen.de>
To: rc@hawkwind.utcs.toronto.edu (rc-mailing-list)
Subject: readline & history
Date: Mon, 8 Aug 1994 05:27:18 -0400	[thread overview]
Message-ID: <199408080927.AA00512@faui01.informatik.uni-erlangen.de> (raw)

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


             reply	other threads:[~1994-08-08  9:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-08-08  9:27 Markus Friedl (CIP 92) [this message]
1994-08-13  5:46 Rich Salz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199408080927.AA00512@faui01.informatik.uni-erlangen.de \
    --to=msfriedl@cip.informatik.uni-erlangen.de \
    --cc=rc@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).