Up-to-date with cornell's last RCS version
authorChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 3 Jul 1992 15:24:08 +0000 (07:24 -0800)
committerChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 3 Jul 1992 15:24:08 +0000 (07:24 -0800)
SCCS-vsn: lib/libedit/chared.c 5.2
SCCS-vsn: lib/libedit/chared.h 5.3
SCCS-vsn: lib/libedit/common.c 5.2
SCCS-vsn: lib/libedit/el.c 5.2
SCCS-vsn: lib/libedit/el.h 5.2
SCCS-vsn: lib/libedit/emacs.c 5.2
SCCS-vsn: lib/libedit/hist.c 5.2
SCCS-vsn: lib/libedit/hist.h 5.3
SCCS-vsn: lib/libedit/history.c 5.3
SCCS-vsn: lib/libedit/key.c 5.2
SCCS-vsn: lib/libedit/key.h 5.2
SCCS-vsn: lib/libedit/map.c 5.2
SCCS-vsn: lib/libedit/map.h 5.2
SCCS-vsn: lib/libedit/parse.c 5.2
SCCS-vsn: lib/libedit/parse.h 5.2
SCCS-vsn: lib/libedit/prompt.c 5.2
SCCS-vsn: lib/libedit/prompt.h 5.3
SCCS-vsn: lib/libedit/read.c 5.2
SCCS-vsn: lib/libedit/refresh.c 5.2
SCCS-vsn: lib/libedit/refresh.h 5.3
SCCS-vsn: lib/libedit/search.c 5.2
SCCS-vsn: lib/libedit/search.h 5.3
SCCS-vsn: lib/libedit/sig.c 5.2
SCCS-vsn: lib/libedit/sig.h 5.3
SCCS-vsn: lib/libedit/sys.h 5.2
SCCS-vsn: lib/libedit/term.c 5.2
SCCS-vsn: lib/libedit/term.h 5.3
SCCS-vsn: lib/libedit/termcap.h 5.2
SCCS-vsn: lib/libedit/TEST/test.c 5.3
SCCS-vsn: lib/libedit/tty.c 5.2
SCCS-vsn: lib/libedit/tokenizer.c 5.2
SCCS-vsn: lib/libedit/tokenizer.h 5.2
SCCS-vsn: lib/libedit/tty.h 5.3
SCCS-vsn: lib/libedit/vi.c 5.2
SCCS-vsn: lib/libedit/histedit.h 5.3

35 files changed:
usr/src/lib/libedit/TEST/test.c
usr/src/lib/libedit/chared.c
usr/src/lib/libedit/chared.h
usr/src/lib/libedit/common.c
usr/src/lib/libedit/el.c
usr/src/lib/libedit/el.h
usr/src/lib/libedit/emacs.c
usr/src/lib/libedit/hist.c
usr/src/lib/libedit/hist.h
usr/src/lib/libedit/histedit.h
usr/src/lib/libedit/history.c
usr/src/lib/libedit/key.c
usr/src/lib/libedit/key.h
usr/src/lib/libedit/map.c
usr/src/lib/libedit/map.h
usr/src/lib/libedit/parse.c
usr/src/lib/libedit/parse.h
usr/src/lib/libedit/prompt.c
usr/src/lib/libedit/prompt.h
usr/src/lib/libedit/read.c
usr/src/lib/libedit/refresh.c
usr/src/lib/libedit/refresh.h
usr/src/lib/libedit/search.c
usr/src/lib/libedit/search.h
usr/src/lib/libedit/sig.c
usr/src/lib/libedit/sig.h
usr/src/lib/libedit/sys.h
usr/src/lib/libedit/term.c
usr/src/lib/libedit/term.h
usr/src/lib/libedit/termcap.h
usr/src/lib/libedit/tokenizer.c
usr/src/lib/libedit/tokenizer.h
usr/src/lib/libedit/tty.c
usr/src/lib/libedit/tty.h
usr/src/lib/libedit/vi.c

index a2426e4..781b22b 100644 (file)
@@ -14,12 +14,12 @@ char copyright[] =
  All rights reserved.\n";
 #endif /* not lint */
 
  All rights reserved.\n";
 #endif /* not lint */
 
-#ifndef lint
-static char sccsid[] = "@(#)test.c     5.2 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)test.c     5.3 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.test.c: A little test program
+ * test.c: A little test program
  */
 #include "sys.h"
 #include <stdio.h>
  */
 #include "sys.h"
 #include <stdio.h>
@@ -124,6 +124,7 @@ main(argc, argv)
     el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
     el_set(el, EL_BIND, "^I", "ed-complete", NULL);/* Bind tab to it   */
     el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
     el_set(el, EL_BIND, "^I", "ed-complete", NULL);/* Bind tab to it   */
+
     /*
      * Bind j, k in vi command mode to previous and next line, instead
      * of previous and next history.
     /*
      * Bind j, k in vi command mode to previous and next line, instead
      * of previous and next history.
@@ -131,6 +132,11 @@ main(argc, argv)
     el_set(el, EL_BIND, "-a", "k", "ed-prev-line", NULL);
     el_set(el, EL_BIND, "-a", "j", "ed-next-line", NULL);
 
     el_set(el, EL_BIND, "-a", "k", "ed-prev-line", NULL);
     el_set(el, EL_BIND, "-a", "j", "ed-next-line", NULL);
 
+    /*
+     * Source the user's defaults file.
+     */
+    el_source(el, NULL);
+
     while ((buf = el_gets(el, &num)) != NULL && num != 0)  {
        int ac;
        char **av;
     while ((buf = el_gets(el, &num)) != NULL && num != 0)  {
        int ac;
        char **av;
index 9859141..6c80f3a 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)chared.c   5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)chared.c   5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /* 
 
 /* 
- * el.chared.c: Character editor utilities
+ * chared.c: Character editor utilities
  */
 #include "sys.h"
 
  */
 #include "sys.h"
 
@@ -430,6 +430,7 @@ ch_init(el)
     el->el_state.argument  = 1;
     el->el_state.lastcmd   = ED_UNASSIGNED;
 
     el->el_state.argument  = 1;
     el->el_state.lastcmd   = ED_UNASSIGNED;
 
+    el->el_chared.c_macro.nline     = NULL;
     el->el_chared.c_macro.level     = -1;
     el->el_chared.c_macro.macro     = (char **) el_malloc(EL_MAXMACRO * 
                                                          sizeof(char *));
     el->el_chared.c_macro.level     = -1;
     el->el_chared.c_macro.macro     = (char **) el_malloc(EL_MAXMACRO * 
                                                          sizeof(char *));
index a45504c..51420ba 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)chared.h    5.2 (Berkeley) %G%
+ *     @(#)chared.h    5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -39,6 +39,7 @@
 typedef struct c_macro_t {
     int    level;
     char **macro;
 typedef struct c_macro_t {
     int    level;
     char **macro;
+    char  *nline;
 } c_macro_t;
 
 /* 
 } c_macro_t;
 
 /* 
@@ -100,9 +101,9 @@ typedef struct el_chared_t {
 #define MODE_REPLACE   1
 #define MODE_REPLACE_1 2
 
 #define MODE_REPLACE   1
 #define MODE_REPLACE_1 2
 
+#include "common.h"
 #include "vi.h"
 #include "emacs.h"
 #include "vi.h"
 #include "emacs.h"
-#include "common.h"
 #include "search.h"
 #include "fcns.h"
 
 #include "search.h"
 #include "fcns.h"
 
index 91fa502..b3925dd 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)common.c   5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)common.c   5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.common.c: Common Editor functions
+ * common.c: Common Editor functions
  */
 #include "sys.h"
 #include "el.h"
  */
 #include "sys.h"
 #include "el.h"
index dc76d96..fa20484 100644 (file)
@@ -8,15 +8,18 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)el.c       5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)el.c       5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
  * el.c: EditLine interface functions
  */
 #include "sys.h"
 
 
 /*
  * el.c: EditLine interface functions
  */
 #include "sys.h"
 
+#include <sys/types.h>
+#include <sys/param.h>
+#include <string.h>
 #include <stdlib.h>
 #if __STDC__
 # include <stdarg.h>
 #include <stdlib.h>
 #if __STDC__
 # include <stdarg.h>
@@ -147,6 +150,10 @@ el_set(va_alist)
        rv = prompt_set(el, va_arg(va, el_pfunc_t));
        break;
 
        rv = prompt_set(el, va_arg(va, el_pfunc_t));
        break;
 
+    case EL_TERMINAL:
+       rv = term_set(el, va_arg(va, char *));
+       break;
+
     case EL_EDITOR:
        rv = map_set_editor(el, va_arg(va, char *));
        break;
     case EL_EDITOR:
        rv = map_set_editor(el, va_arg(va, char *));
        break;
@@ -179,22 +186,22 @@ el_set(va_alist)
 
            case EL_TELLTC:
                argv[0] = "telltc";
 
            case EL_TELLTC:
                argv[0] = "telltc";
-               rv = term_telltc(el, i, va_arg(va, char **));
+               rv = term_telltc(el, i, argv);
                break;
 
            case EL_SETTC:
                argv[0] = "settc";
                break;
 
            case EL_SETTC:
                argv[0] = "settc";
-               rv = term_settc(el, i, va_arg(va, char **));
+               rv = term_settc(el, i, argv);
                break;
 
            case EL_ECHOTC:
                argv[0] = "echotc";
                break;
 
            case EL_ECHOTC:
                argv[0] = "echotc";
-               rv = term_echotc(el, i, va_arg(va, char **));
+               rv = term_echotc(el, i, argv);
                break;
 
            case EL_SETTY:
                argv[0] = "setty";
                break;
 
            case EL_SETTY:
                argv[0] = "setty";
-               rv = tty_stty(el, i, va_arg(va, char **));
+               rv = tty_stty(el, i, argv);
                break;
 
            default:
                break;
 
            default:
@@ -241,6 +248,44 @@ el_line(el)
     return (const LineInfo *) &el->el_line;
 }
 
     return (const LineInfo *) &el->el_line;
 }
 
+static const char elpath[] = "/.editrc";
+
+/* el_source():
+ *     Source a file
+ */
+public int
+el_source(el, fname)
+    EditLine *el;
+    const char *fname;
+{
+    char path[MAXPATHLEN];
+    FILE *fp;
+    char *ptr;
+
+    if (fname == NULL) {
+       fname = &elpath[1];
+       if ((fp = fopen(fname, "r")) == NULL) {
+           if ((ptr = getenv("HOME")) == NULL) 
+               return -1;
+           fname = strncpy(path, ptr, MAXPATHLEN);
+           (void) strncat(path, elpath, MAXPATHLEN);
+           path[MAXPATHLEN-1] = '\0';
+       }
+    }
+
+    if ((fp = fopen(fname, "r")) == NULL) 
+       return -1;
+
+    while ((ptr = fgetline(fp, NULL)) != NULL)
+       if (parse_line(el, ptr) == -1) {
+           (void) fclose(fp);
+           return -1;
+       }
+
+    (void) fclose(fp);
+    return 0;
+}
+
 
 /* el_resize():
  *     Called from program when terminal is resized
 
 /* el_resize():
  *     Called from program when terminal is resized
index 58ed985..630d9d3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)el.h        5.1 (Berkeley) %G%
+ *     @(#)el.h        5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -67,13 +67,13 @@ typedef struct el_state_t {
 
 #include "tty.h"
 #include "prompt.h"
 
 #include "tty.h"
 #include "prompt.h"
+#include "key.h"
 #include "term.h"
 #include "refresh.h"
 #include "chared.h"
 #include "common.h"
 #include "search.h"
 #include "hist.h"
 #include "term.h"
 #include "refresh.h"
 #include "chared.h"
 #include "common.h"
 #include "search.h"
 #include "hist.h"
-#include "key.h"
 #include "map.h"
 #include "parse.h"
 #include "sig.h"
 #include "map.h"
 #include "parse.h"
 #include "sig.h"
index 65f9be2..7543e9e 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)emacs.c    5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)emacs.c    5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /* 
 
 /* 
- * el.emacs.c: Emacs functions
+ * emacs.c: Emacs functions
  */
 #include "sys.h"
 #include "el.h"
  */
 #include "sys.h"
 #include "el.h"
index d9fe387..4dfac00 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)hist.c     5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)hist.c     5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.hist.c: History access functions
+ * hist.c: History access functions
  */
 #include "sys.h"
 #include <stdlib.h>
  */
 #include "sys.h"
 #include <stdlib.h>
index a146cca..2c2b0dc 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hist.h      5.2 (Berkeley) %G%
+ *     @(#)hist.h      5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 974bad2..f7acd28 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)histedit.h  5.2 (Berkeley) %G%
+ *     @(#)histedit.h  5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -33,21 +33,6 @@ typedef struct lineinfo {
     const char *lastchar;
 } LineInfo;
 
     const char *lastchar;
 } LineInfo;
 
-/*
- * el_set/el_get parameters
- */
-#define EL_PROMPT      0
-#define EL_FILE                1
-#define EL_TERMINAL    2
-#define EL_EDITOR      3
-#define EL_SIGNAL      4
-#define        EL_BIND         5
-#define        EL_TELLTC       6
-#define        EL_SETTC        7
-#define        EL_ECHOTC       8
-#define        EL_SETTY        9
-#define        EL_ADDFN        10
-#define EL_HIST                11
 
 /*
  * EditLine editor function return codes.
 
 /*
  * EditLine editor function return codes.
@@ -88,6 +73,27 @@ int           el_parse       __P((EditLine *, int, char **));
  */
 int             el_set         __P((EditLine *, int, ...));
 
  */
 int             el_set         __P((EditLine *, int, ...));
 
+/*
+ * el_set/el_get parameters
+ */
+#define EL_PROMPT      0       /* , el_pfunc_t);               */
+#define EL_TERMINAL    1       /* , const char *);             */
+#define EL_EDITOR      2       /* , const char *);             */
+#define EL_SIGNAL      3       /* , int);                      */
+#define        EL_BIND         4       /* , const char *, ..., NULL);  */
+#define        EL_TELLTC       5       /* , const char *, ..., NULL);  */
+#define        EL_SETTC        6       /* , const char *, ..., NULL);  */
+#define        EL_ECHOTC       7       /* , const char *, ..., NULL);  */
+#define        EL_SETTY        8       /* , const char *, ..., NULL);  */
+#define        EL_ADDFN        9       /* , const char *, const char * */
+                               /* , el_func_t);                */
+#define EL_HIST                10      /* , hist_fun_t, const char *); */
+
+/*
+ * Source named file or $PWD/.editrc or $HOME/.editrc
+ */
+int            el_source       __P((EditLine *, const char *));
+
 /*
  * Must be called when the terminal changes size; If EL_SIGNAL
  * is set this is done automatically otherwise it is the responsibility
 /*
  * Must be called when the terminal changes size; If EL_SIGNAL
  * is set this is done automatically otherwise it is the responsibility
index 9162a1c..daa99c9 100644 (file)
@@ -8,9 +8,9 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)history.c  5.2 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)history.c  5.3 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
  * hist.c: History access functions
 
 /*
  * hist.c: History access functions
index a4cb883..12eb20a 100644 (file)
@@ -8,13 +8,13 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)key.c      5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)key.c      5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.key.c: This module contains the procedures for maintaining
- *           the extended-key map.
+ * key.c: This module contains the procedures for maintaining
+ *       the extended-key map.
  *
  *      An extended-key (key) is a sequence of keystrokes introduced 
  *     with an sequence introducer and consisting of an arbitrary 
  *
  *      An extended-key (key) is a sequence of keystrokes introduced 
  *     with an sequence introducer and consisting of an arbitrary 
@@ -62,8 +62,6 @@ private       int            node__delete     __P((key_node_t **, char *));
 private        int            node_lookup      __P((EditLine *, char *, key_node_t *,
                                             int));
 private        int            node_enum        __P((EditLine *, key_node_t *, int));
 private        int            node_lookup      __P((EditLine *, char *, key_node_t *,
                                             int));
 private        int            node_enum        __P((EditLine *, key_node_t *, int));
-private        void           key_kprint       __P((EditLine *, char *, 
-                                            key_value_t *, int));
 private        int            key__decode_char __P((char *, int, int));
 
 #define KEY_BUFSIZ     EL_BUFSIZ
 private        int            key__decode_char __P((char *, int, int));
 
 #define KEY_BUFSIZ     EL_BUFSIZ
@@ -132,35 +130,8 @@ protected void
 key_reset(el)
     EditLine *el;
 {
 key_reset(el)
     EditLine *el;
 {
-    static char strA[] = {033, '[', 'A', '\0'};
-    static char strB[] = {033, '[', 'B', '\0'};
-    static char strC[] = {033, '[', 'C', '\0'};
-    static char strD[] = {033, '[', 'D', '\0'};
-    static char stOA[] = {033, 'O', 'A', '\0'};
-    static char stOB[] = {033, 'O', 'B', '\0'};
-    static char stOC[] = {033, 'O', 'C', '\0'};
-    static char stOD[] = {033, 'O', 'D', '\0'};
-
     node__put(el->el_key.map);
     el->el_key.map = NULL;
     node__put(el->el_key.map);
     el->el_key.map = NULL;
-       key_add(el, strA, key_map_cmd(el, ED_PREV_HISTORY), XK_CMD);
-       key_add(el, strB, key_map_cmd(el, ED_NEXT_HISTORY), XK_CMD);
-       key_add(el, strC, key_map_cmd(el, ED_NEXT_CHAR),    XK_CMD);
-       key_add(el, strD, key_map_cmd(el, ED_PREV_CHAR),    XK_CMD);
-       key_add(el, stOA, key_map_cmd(el, ED_PREV_HISTORY), XK_CMD);
-       key_add(el, stOB, key_map_cmd(el, ED_NEXT_HISTORY), XK_CMD);
-       key_add(el, stOC, key_map_cmd(el, ED_NEXT_CHAR),    XK_CMD);
-       key_add(el, stOD, key_map_cmd(el, ED_PREV_CHAR),    XK_CMD);
-    if (el->el_map.type == MAP_VI) {
-       key_add(el, &strA[1], key_map_cmd(el, ED_PREV_HISTORY), XK_CMD);
-       key_add(el, &strB[1], key_map_cmd(el, ED_NEXT_HISTORY), XK_CMD);
-       key_add(el, &strC[1], key_map_cmd(el, ED_NEXT_CHAR),    XK_CMD);
-       key_add(el, &strD[1], key_map_cmd(el, ED_PREV_CHAR),    XK_CMD);
-       key_add(el, &stOA[1], key_map_cmd(el, ED_PREV_HISTORY), XK_CMD);
-       key_add(el, &stOB[1], key_map_cmd(el, ED_NEXT_HISTORY), XK_CMD);
-       key_add(el, &stOC[1], key_map_cmd(el, ED_NEXT_CHAR),    XK_CMD);
-       key_add(el, &stOD[1], key_map_cmd(el, ED_PREV_CHAR),    XK_CMD);
-    }
     return;
 }
 
     return;
 }
 
@@ -583,7 +554,7 @@ node_enum(el, ptr, cnt)
  *     Print the specified key and its associated
  *     function specified by val
  */
  *     Print the specified key and its associated
  *     function specified by val
  */
-private void
+protected void
 key_kprint(el, key, val, ntype)
     EditLine      *el;
     char          *key;
 key_kprint(el, key, val, ntype)
     EditLine      *el;
     char          *key;
index 699f406..2c4d22c 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)key.h       5.1 (Berkeley) %G%
+ *     @(#)key.h       5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -47,6 +47,8 @@ protected void                key_clear       __P((EditLine *, el_action_t *,
                                             char *));
 protected int          key_delete      __P((EditLine *, char *));
 protected void         key_print       __P((EditLine *, char *));
                                             char *));
 protected int          key_delete      __P((EditLine *, char *));
 protected void         key_print       __P((EditLine *, char *));
+protected void         key_kprint      __P((EditLine *, char *, 
+                                            key_value_t *, int));
 protected char                *key__decode_str __P((char *, char *, char *));
 
 #endif /* _h_el_key */
 protected char                *key__decode_str __P((char *, char *, char *));
 
 #endif /* _h_el_key */
index 76142e4..6378255 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)map.c      5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)map.c      5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.map.c: Editor function definitions 
+ * map.c: Editor function definitions 
  */
 #include "sys.h"
 #include <stdlib.h>
  */
 #include "sys.h"
 #include <stdlib.h>
@@ -306,7 +306,7 @@ private el_action_t  el_map_vi_insert[] = {
     /*   6 */  ED_INSERT,              /* ^F */
     /*   7 */  ED_INSERT,              /* ^G */
     /*   8 */  VI_DELETE_PREV_CHAR,    /* ^H */   /* BackSpace key */
     /*   6 */  ED_INSERT,              /* ^F */
     /*   7 */  ED_INSERT,              /* ^G */
     /*   8 */  VI_DELETE_PREV_CHAR,    /* ^H */   /* BackSpace key */
-    /*   9 */  ED_UNASSIGNED,          /* ^I */   /* Tab Key  */
+    /*   9 */  ED_INSERT,              /* ^I */   /* Tab Key  */
     /*  10 */  ED_NEWLINE,             /* ^J */
     /*  11 */  ED_INSERT,              /* ^K */
     /*  12 */  ED_INSERT,              /* ^L */
     /*  10 */  ED_NEWLINE,             /* ^J */
     /*  11 */  ED_INSERT,              /* ^K */
     /*  12 */  ED_INSERT,              /* ^L */
@@ -346,7 +346,7 @@ private el_action_t  el_map_vi_insert[] = {
     /*  13 */  ED_NEWLINE,             /* ^M */
     /*  14 */  ED_NEXT_HISTORY,        /* ^N */
     /*  15 */  ED_TTY_FLUSH_OUTPUT,    /* ^O */
     /*  13 */  ED_NEWLINE,             /* ^M */
     /*  14 */  ED_NEXT_HISTORY,        /* ^N */
     /*  15 */  ED_TTY_FLUSH_OUTPUT,    /* ^O */
-    /*  16 */  ED_PREV_HISTORY,                /* ^P */
+    /*  16 */  ED_PREV_HISTORY,        /* ^P */
     /*  17 */  ED_TTY_START_OUTPUT,    /* ^Q */
     /*  18 */  ED_REDISPLAY,           /* ^R */
     /*  19 */  ED_TTY_STOP_OUTPUT,     /* ^S */
     /*  17 */  ED_TTY_START_OUTPUT,    /* ^Q */
     /*  18 */  ED_REDISPLAY,           /* ^R */
     /*  19 */  ED_TTY_STOP_OUTPUT,     /* ^S */
@@ -1000,7 +1000,7 @@ map_init_vi(el)
        map_init_nls(el);
 #endif
 
        map_init_nls(el);
 #endif
 
-    term_bind_arrows(el);
+    term_bind_arrow(el);
 }
 
 
 }
 
 
@@ -1038,7 +1038,7 @@ map_init_emacs(el)
     buf[1] = CONTROL('X');
     key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
 
     buf[1] = CONTROL('X');
     key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
 
-    term_bind_arrows(el);
+    term_bind_arrow(el);
 }
 
 
 }
 
 
@@ -1177,6 +1177,8 @@ map_print_all_keys(el)
 
     (void) fprintf(el->el_outfile, "Multi-character bindings\n");
     key_print(el, "");
 
     (void) fprintf(el->el_outfile, "Multi-character bindings\n");
     key_print(el, "");
+    (void) fprintf(el->el_outfile, "Arrow key bindings\n");
+    term_print_arrow(el, "");
 }
 
 
 }
 
 
@@ -1194,17 +1196,18 @@ map_bind(el, argc, argv)
     char   *p;
     char    inbuf[EL_BUFSIZ];
     char    outbuf[EL_BUFSIZ];
     char   *p;
     char    inbuf[EL_BUFSIZ];
     char    outbuf[EL_BUFSIZ];
-    char   *in;
-    char   *out;
+    char   *in = NULL;
+    char   *out = NULL;
     el_bindings_t *bp;
     int     cmd;
     el_bindings_t *bp;
     int     cmd;
+    int            key;
 
     if (argv == NULL)
        return -1;
 
     map = el->el_map.key;
     ntype = XK_CMD;
 
     if (argv == NULL)
        return -1;
 
     map = el->el_map.key;
     ntype = XK_CMD;
-    remove = 0;
+    key = remove = 0;
     for (argc = 1; (p = argv[argc]) != NULL; argc++)
        if (p[0] == '-')
            switch (p[1]) {
     for (argc = 1; (p = argv[argc]) != NULL; argc++)
        if (p[0] == '-')
            switch (p[1]) {
@@ -1220,6 +1223,10 @@ map_bind(el, argc, argv)
                ntype = XK_EXE;
                break;
 #endif
                ntype = XK_EXE;
                break;
 #endif
+           case 'k':
+               key = 1;
+               break;
+
            case 'r':
                remove = 1;
                break;
            case 'r':
                remove = 1;
                break;
@@ -1249,13 +1256,20 @@ map_bind(el, argc, argv)
        return 0;
     }
 
        return 0;
     }
 
-    if ((in = parse__string(inbuf, argv[argc++])) == NULL) {
-       (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in instring.\n",
-                      argv[0]);
-       return -1;
-    }
+    if (key)
+       in = argv[argc++];
+    else
+       if ((in = parse__string(inbuf, argv[argc++])) == NULL) {
+           (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in instring.\n",
+                          argv[0]);
+           return -1;
+       }
 
     if (remove) {
 
     if (remove) {
+       if (key) {
+           (void) term_clear_arrow(el, in);
+           return -1;
+       }
        if (in[1]) 
            (void) key_delete(el, in);
        else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) 
        if (in[1]) 
            (void) key_delete(el, in);
        else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) 
@@ -1266,7 +1280,10 @@ map_bind(el, argc, argv)
     }
 
     if (argv[argc] == NULL) {
     }
 
     if (argv[argc] == NULL) {
-       map_print_key(el, map, in);
+       if (key)
+           term_print_arrow(el, in);
+       else
+           map_print_key(el, map, in);
        return 0;
     }
 
        return 0;
     }
 
@@ -1285,7 +1302,10 @@ map_bind(el, argc, argv)
                           "%s: Invalid \\ or ^ in outstring.\n", argv[0]);
            return -1;
        }
                           "%s: Invalid \\ or ^ in outstring.\n", argv[0]);
            return -1;
        }
-       key_add(el, in, key_map_str(el, out), ntype);
+       if (key)
+           term_set_arrow(el, in, key_map_str(el, out), ntype);
+       else
+           key_add(el, in, key_map_str(el, out), ntype);
        map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
        break;
 
        map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
        break;
 
@@ -1295,13 +1315,17 @@ map_bind(el, argc, argv)
                           "%s: Invalid command `%s'.\n", argv[0], argv[argc]);
            return -1;
        }
                           "%s: Invalid command `%s'.\n", argv[0], argv[argc]);
            return -1;
        }
-       if (in[1]) {
-           key_add(el, in, key_map_cmd(el, cmd), ntype);
-           map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
-       }
-       else  {
-           key_clear(el, map, in);
-           map[(unsigned char) *in] = cmd;
+       if (key)
+           term_set_arrow(el, in, key_map_str(el, out), ntype);
+       else {
+           if (in[1]) {
+               key_add(el, in, key_map_cmd(el, cmd), ntype);
+               map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
+           }
+           else  {
+               key_clear(el, map, in);
+               map[(unsigned char) *in] = cmd;
+           }
        }
        break;
 
        }
        break;
 
index 3cfbd96..f8e5121 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)map.h       5.1 (Berkeley) %G%
+ *     @(#)map.h       5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 3fe8a5a..ff26950 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)parse.c    5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)parse.c    5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.parse.c: parse an editline extended command
+ * parse.c: parse an editline extended command
  *
  * commands are:
  *
  *
  * commands are:
  *
@@ -76,7 +76,7 @@ el_parse(el, argc, argv)
 
     if (*ptr == ':') {
        *ptr = '\0';
 
     if (*ptr == ':') {
        *ptr = '\0';
-       if (strcmp(ptr, el->el_prog) != 0)
+       if (el_match(el->el_prog, ptr))
            return 0;
     }
     else
            return 0;
     }
     else
@@ -164,7 +164,7 @@ parse__escape(ptr)
            break;
        }
     }
            break;
        }
     }
-    else if (*p == '^') {
+    else if (*p == '^' && isalpha((unsigned char) *p)) {
        p++;
        c = (*p == '?') ? '\177' : (*p & 0237);
     }
        p++;
        c = (*p == '?') ? '\177' : (*p & 0237);
     }
index 62d3611..b27e431 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)parse.h     5.1 (Berkeley) %G%
+ *     @(#)parse.h     5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 8137fcf..e1fb6ac 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)prompt.c   5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)prompt.c   5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.prompt.c: Prompt printing functions
+ * prompt.c: Prompt printing functions
  */
 #include "sys.h"
 #include <stdio.h>
  */
 #include "sys.h"
 #include <stdio.h>
index 6d4a55f..9ab6e19 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)prompt.h    5.2 (Berkeley) %G%
+ *     @(#)prompt.h    5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index fb94226..4900325 100644 (file)
@@ -8,13 +8,13 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)read.c     5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)read.c     5.2 (Berkeley) %G%";
 
 
+#endif /* not lint && not SCCSID */
 /*
 /*
- * el.read.c: Clean this junk up! This is horrible code.
- *           Terminal read functions
+ * read.c: Clean this junk up! This is horrible code.
+ *        Terminal read functions
  */
 #include "sys.h"
 #include <sys/errno.h>
  */
 #include "sys.h"
 #include <sys/errno.h>
@@ -25,6 +25,10 @@ extern int errno;
 
 #define OKCMD -1
 
 
 #define OKCMD -1
 
+private int read__fixio                __P((int, int));
+private int read_preread       __P((EditLine *));
+private int read_getcmd                __P((EditLine *, el_action_t *, char *));
+
 #ifdef DEBUG_EDIT
 private void
 read_debug(el)
 #ifdef DEBUG_EDIT
 private void
 read_debug(el)
@@ -41,46 +45,95 @@ read_debug(el)
        (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
     if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
        (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
        (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
     if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
        (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
-#ifdef notyet
-    if ((!DoingArg) && (Argument != 1))
-       (void) fprintf(el->el_errfile, "(!DoingArg) && (Argument != 1)\r\n");
-    if (CcKeyMap[0] == 0)
-       (void) fprintf(el->el_errfile, "CcKeyMap[0] == 0 (maybe not inited)\r\n");
-#endif
 }
 }
-#endif
+#endif /* DEBUG_EDIT */
 
 
-#ifdef notyet
-int
-el_preread(el)
+/* read__fixio():
+ *     Try to recover from a read error
+ */
+private int
+read__fixio(fd, e)
+    int fd, e;
 {
 {
-    long    chrs = 0;
-    static Char *Input_Line = NULL;
+    switch (e) {
+    case -1:   /* Make sure that the code is reachable */
 
 
-    if (Input_Line)
-       xfree((ptr_t) Input_Line);
-    Input_Line = NULL;
+#ifdef EWOULDBLOCK
+    case EWOULDBLOCK:
+# define TRY_AGAIN
+#endif /* EWOULDBLOCK */
 
 
-    if (Tty_raw_mode)
+#if defined(POSIX) && defined(EAGAIN)
+# if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+    case EAGAIN:
+#  define TRY_AGAIN
+# endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
+#endif /* POSIX && EAGAIN */
+
+       e = 0;
+#ifdef TRY_AGAIN
+# if defined(F_SETFL) && defined(O_NDELAY)
+       if ((e = fcntl(fd, F_GETFL, 0)) == -1)
+           return -1;
+
+       if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1)
+           return -1;
+       else 
+           e = 1;
+# endif /* F_SETFL && O_NDELAY */
+
+# ifdef FIONBIO
+       if (ioctl(fd, FIONBIO, (ioctl_t) &e) == -1)
+           return -1;
+       else
+           e = 1;
+# endif        /* FIONBIO */
+
+#endif /* TRY_AGAIN */
+       return e ? 0 : -1;
+
+    case EINTR:
+       return 0;
+
+    default:
+       return -1;
+    }
+}
+
+
+/* read_preread():
+ *     Try to read the stuff in the input queue;
+ */
+private int
+read_preread(el)
+    EditLine *el;
+{
+    int    chrs = 0;
+
+    if (el->el_chared.c_macro.nline) {
+       el_free((ptr_t) el->el_chared.c_macro.nline);
+       el->el_chared.c_macro.nline = NULL;
+    }
+
+    if (el->el_tty.t_mode == ED_IO)
        return 0;
 
 #ifdef FIONREAD
        return 0;
 
 #ifdef FIONREAD
-    (void) ioctl(SHIN, FIONREAD, &chrs);
+    (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) &chrs);
     if (chrs > 0) {
     if (chrs > 0) {
-       char    buf[BUFSIZE];
+       char    buf[EL_BUFSIZ];
 
 
-       chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
+       chrs = read(el->el_infd, buf, (size_t) MIN(chrs, EL_BUFSIZ - 1));
        if (chrs > 0) {
            buf[chrs] = '\0';
        if (chrs > 0) {
            buf[chrs] = '\0';
-           Input_Line = Strsave(str2short(buf));
-           PushMacro(Input_Line);
+           el->el_chared.c_macro.nline = strdup(buf);
+           el_push(el->el_chared.c_macro.nline);
        }
     }
 #endif  /* FIONREAD */
        }
     }
 #endif  /* FIONREAD */
+
     return chrs > 0;
 }
     return chrs > 0;
 }
-#endif
-
 
 
 /* el_push():
 
 
 /* el_push():
@@ -103,8 +156,12 @@ el_push(el, str)
     }
 }
 
     }
 }
 
+
+/* read_getcmd():
+ *     Return next command from the input stream.
+ */
 private int
 private int
-el_getcmd(el, cmdnum, ch)
+read_getcmd(el, cmdnum, ch)
     EditLine *el;
     el_action_t *cmdnum;
     char *ch;
     EditLine *el;
     el_action_t *cmdnum;
     char *ch;
@@ -167,24 +224,17 @@ el_getc(el, cp)
     char *cp;
 {
     int num_read;
     char *cp;
 {
     int num_read;
-#if defined(EWOULDBLOCK) || (defined(POSIX) && defined(EAGAIN))
-# if defined(FIONBIO) || (defined(F_SETFL) && defined(O_NDELAY))
-#  define TRY_AGAIN
-    int     tried = 0;
-# endif /* FIONBIO || (F_SETFL && O_NDELAY) */
-#endif /* EWOULDBLOCK || (POSIX && EAGAIN) */
     unsigned char tcp;
     unsigned char tcp;
+    int tried = 0;
 
     c_macro_t *ma = &el->el_chared.c_macro;
 
     term__flush();
     for (;;) {
 
     c_macro_t *ma = &el->el_chared.c_macro;
 
     term__flush();
     for (;;) {
-#ifdef notyet
        if (ma->level < 0) {
        if (ma->level < 0) {
-           if (!el_preread(el))
+           if (!read_preread(el))
                break;
        }
                break;
        }
-#endif
        if (ma->level < 0) 
            break;
    
        if (ma->level < 0) 
            break;
    
@@ -201,54 +251,23 @@ el_getc(el, cp)
 
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Turning raw mode on\n");
 
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Turning raw mode on\n");
-#endif
+#endif /* DEBUG_READ */
     if (tty_rawmode(el) < 0)   /* make sure the tty is set up correctly */
     if (tty_rawmode(el) < 0)   /* make sure the tty is set up correctly */
-       return 0;               /* oops: SHIN was closed */
+       return 0;
 
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Reading a character\n");
 
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Reading a character\n");
-#endif
+#endif /* DEBUG_READ */
     while ((num_read = read(el->el_infd, (char *) &tcp, 1)) == -1)
     while ((num_read = read(el->el_infd, (char *) &tcp, 1)) == -1)
-       switch (errno) {
-           /*
-            * Someone might have set our file descriptor to non blocking From
-            * Gray Watson (gray%antr.uucp@med.pitt.edu), Thanks!!!
-            */
-#ifdef EWOULDBLOCK
-       case EWOULDBLOCK:
-#endif /* EWOULDBLOCK */
-#if defined(POSIX) && defined(EAGAIN)
-# if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK
-       case EAGAIN:
-# endif /* EWOULDBLOCK && EAGAIN != EWOULDBLOCK */
-#endif /* POSIX && EAGAIN */
-#ifdef TRY_AGAIN
-           if (!tried) {
-# if defined(F_SETFL) && defined(O_NDELAY)
-               (void) fcntl(SHIN, F_SETFL,
-                            fcntl(SHIN, F_GETFL, 0) & ~O_NDELAY);
-# endif /* F_SETFL && O_NDELAY */
-# ifdef FIONBIO
-               (void) ioctl(SHIN, FIONBIO, (ioctl_t) & tried);
-# endif /* FIONBIO */
-               tried = 1;
-               break;
-           }
-           *cp = tcp;
-           return (num_read);
-#endif /* TRY_AGAIN */
-       case EINTR:
-           break;
-       default:
-#ifdef DEBUG_EDIT
-           (void) fprintf(el->el_errfile, "GetNextChar(): errno == %d\n", errno);
-#endif /* DEBUG_EDIT */
-           *cp = tcp;
-           return num_read;
+       if (!tried && read__fixio(el->el_infd, errno) == 0)
+           tried = 1;
+       else {
+           *cp = '\0';
+           return -1;
        }
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Got it %c\n", tcp);
        }
 #ifdef DEBUG_READ
     (void) fprintf(el->el_errfile, "Got it %c\n", tcp);
-#endif
+#endif /* DEBUG_READ */
     *cp = tcp;
     return num_read;
 }
     *cp = tcp;
     return num_read;
 }
@@ -271,12 +290,11 @@ el_gets(el, nread)
     re_clear_display(el);              /* reset the display stuff */
     ch_reset(el);
 
     re_clear_display(el);              /* reset the display stuff */
     ch_reset(el);
 
-#ifdef notyet
 #ifdef FIONREAD
 #ifdef FIONREAD
-    if (!Tty_raw_mode && ma->level < 0) {
+    if (el->el_tty.t_mode == EX_IO && ma->level < 0) {
        long    chrs = 0;
 
        long    chrs = 0;
 
-       (void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
+       (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) &chrs);
        if (chrs == 0) {
            if (tty_rawmode(el) < 0) {
                if (nread)
        if (chrs == 0) {
            if (tty_rawmode(el) < 0) {
                if (nread)
@@ -285,27 +303,27 @@ el_gets(el, nread)
            }
        }
     }
            }
        }
     }
-#endif
-#endif
+#endif /* FIONREAD */
 
     re_refresh(el);                    /* print the prompt */
 
     for (num = OKCMD; num == OKCMD;) { /* while still editing this line */
 #ifdef DEBUG_EDIT
        read_debug(el);
 
     re_refresh(el);                    /* print the prompt */
 
     for (num = OKCMD; num == OKCMD;) { /* while still editing this line */
 #ifdef DEBUG_EDIT
        read_debug(el);
-#endif
+#endif /* DEBUG_EDIT */
        /* if EOF or error */
        /* if EOF or error */
-       if ((num = el_getcmd(el, &cmdnum, &ch)) != OKCMD) {
+       if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
 #ifdef DEBUG_READ
            (void) fprintf(el->el_errfile, "Returning from el_gets %d\n", num);
 #ifdef DEBUG_READ
            (void) fprintf(el->el_errfile, "Returning from el_gets %d\n", num);
-#endif
+#endif /* DEBUG_READ */
            break;
        }
 
        if (cmdnum >= el->el_map.nfunc) {       /* BUG CHECK command */
 #ifdef DEBUG_EDIT
            break;
        }
 
        if (cmdnum >= el->el_map.nfunc) {       /* BUG CHECK command */
 #ifdef DEBUG_EDIT
-           (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch);
-#endif
+           (void) fprintf(el->el_errfile, 
+                          "ERROR: illegal command from key 0%o\r\n", ch);
+#endif /* DEBUG_EDIT */
            continue;           /* try again */
        }
 
            continue;           /* try again */
        }
 
@@ -321,7 +339,7 @@ el_gets(el, nread)
            else
                (void) fprintf(el->el_errfile, "Error command = %d\n", cmdnum);
        }
            else
                (void) fprintf(el->el_errfile, "Error command = %d\n", cmdnum);
        }
-#endif
+#endif /* DEBUG_READ */
        retval = (*el->el_map.func[cmdnum])(el, ch);
 
        /* save the last command here */
        retval = (*el->el_map.func[cmdnum])(el, ch);
 
        /* save the last command here */
@@ -356,19 +374,6 @@ el_gets(el, nread)
 
        case CC_NEWLINE:        /* normal end of line */
            num = el->el_line.lastchar - el->el_line.buffer;    
 
        case CC_NEWLINE:        /* normal end of line */
            num = el->el_line.lastchar - el->el_line.buffer;    
-           /* return the number of chars read */
-#ifdef notyet
-           /*
-            * For continuation lines, we set the prompt to prompt 2
-            */
-           if (imode) {
-               if (!Strcmp(*(imode->vec), STRinsert))
-                   inputmode = MODE_INSERT;
-               else if (!Strcmp(*(imode->vec), STRoverwrite))
-                   inputmode = MODE_REPLACE;
-           }
-           printprompt(1, NULL);
-#endif
            break;
 
        case CC_FATAL:          /* fatal error, reset to known state */
            break;
 
        case CC_FATAL:          /* fatal error, reset to known state */
@@ -387,7 +392,7 @@ el_gets(el, nread)
        default:                /* functions we don't know about */
 #ifdef DEBUG_READ
            (void) fprintf(el->el_errfile, "*** editor ERROR ***\r\n\n");
        default:                /* functions we don't know about */
 #ifdef DEBUG_READ
            (void) fprintf(el->el_errfile, "*** editor ERROR ***\r\n\n");
-#endif
+#endif /* DEBUG_READ */
            el->el_state.argument = 1;
            el->el_state.doingarg = 0;
            term_beep(el);
            el->el_state.argument = 1;
            el->el_state.doingarg = 0;
            term_beep(el);
index d7ff729..50318df 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)refresh.c  5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)refresh.c  5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * ed.refresh.c: Lower level screen refreshing functions
+ * refresh.c: Lower level screen refreshing functions
  */
 #include "sys.h"
 #include <stdio.h>
  */
 #include "sys.h"
 #include <stdio.h>
index 3b97cc0..e7d38d7 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)refresh.h   5.2 (Berkeley) %G%
+ *     @(#)refresh.h   5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index dec34ef..aae9a4f 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)search.c   5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)search.c   5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.search.c: History and character search functions
+ * search.c: History and character search functions
  */
 #include "sys.h"
 #include <stdlib.h>
  */
 #include "sys.h"
 #include <stdlib.h>
@@ -22,7 +22,12 @@ static char sccsid[] = "@(#)search.c 5.1 (Berkeley) %G%";
 #endif
 #include "el.h"
 
 #endif
 #include "el.h"
 
-private int el_match   __P((const char *, const char *));
+/*
+ * Adjust cursor in vi mode to include the character under it
+ */
+#define EL_CURSOR(el) \
+    ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \
+                           ((el)->el_map.current == (el)->el_map.alt)))
 
 /* search_init():
  *     Initialize the search stuff
 
 /* search_init():
  *     Initialize the search stuff
@@ -66,7 +71,7 @@ regerror(msg)
 /* el_match():
  *     Return if string matches pattern
  */
 /* el_match():
  *     Return if string matches pattern
  */
-private int
+protected int
 el_match(str, pat)
     const char *str;
     const char *pat;
 el_match(str, pat)
     const char *str;
     const char *pat;
@@ -125,7 +130,7 @@ c_setpat(el)
 {
     if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && 
        el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) {
 {
     if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && 
        el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) {
-       el->el_search.patlen = el->el_line.cursor - el->el_line.buffer;
+       el->el_search.patlen = EL_CURSOR(el) - el->el_line.buffer;
        if (el->el_search.patlen >= EL_BUFSIZ) 
            el->el_search.patlen = EL_BUFSIZ -1;
        if (el->el_search.patlen >= 0)  {
        if (el->el_search.patlen >= EL_BUFSIZ) 
            el->el_search.patlen = EL_BUFSIZ -1;
        if (el->el_search.patlen >= 0)  {
@@ -141,7 +146,7 @@ c_setpat(el)
     (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen);
     (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", el->el_search.patbuf);
     (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", 
     (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen);
     (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", el->el_search.patbuf);
     (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", 
-                  el->el_line.cursor - el->el_line.buffer, 
+                  EL_CURSOR(el) - el->el_line.buffer, 
                   el->el_line.lastchar - el->el_line.buffer);
 #endif
 }
                   el->el_line.lastchar - el->el_line.buffer);
 #endif
 }
index ebd6156..823c6b2 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)search.h    5.2 (Berkeley) %G%
+ *     @(#)search.h    5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -27,6 +27,7 @@ typedef struct el_search_t {
 } el_search_t;
 
 
 } el_search_t;
 
 
+protected int          el_match        __P((const char *, const char *));
 protected int          search_init     __P((EditLine *));
 protected void         search_end      __P((EditLine *));
 protected int          c_hmatch        __P((EditLine *, const char *));
 protected int          search_init     __P((EditLine *));
 protected void         search_end      __P((EditLine *));
 protected int          c_hmatch        __P((EditLine *, const char *));
index 37548dc..274d710 100644 (file)
@@ -8,14 +8,14 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)sig.c      5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)sig.c      5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.sig.c: Signal handling stuff.
- *          our policy is to trap all signals, set a good state
- *          and pass the ball to our caller.
+ * sig.c: Signal handling stuff.
+ *       our policy is to trap all signals, set a good state
+ *       and pass the ball to our caller.
  */
 #include "sys.h"
 #include "el.h"
  */
 #include "sys.h"
 #include "el.h"
index a76e378..accd07d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sig.h       5.2 (Berkeley) %G%
+ *     @(#)sig.h       5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 6958976..1cdf989 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sys.h       5.1 (Berkeley) %G%
+ *     @(#)sys.h       5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -51,4 +51,34 @@ typedef char* ioctl_t;
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
+#ifdef sun
+typedef void (*sig_t)__P((int));
+#ifdef __GNUC__
+/*
+ * Broken hdrs.
+ */
+extern char    *getenv         __P((const char *));
+extern int     fprintf         __P((FILE *, const char *, ...));
+extern int     sigsetmask      __P((int));
+extern int     sigblock        __P((int));
+extern int     ioctl           __P((int, int, void *));
+extern int     fputc           __P((int, FILE *));
+extern int     fgetc           __P((FILE *));
+extern int     fflush          __P((FILE *));
+extern int     tolower         __P((int));
+extern int     toupper         __P((int));
+extern int     errno, sys_nerr;
+extern char    *sys_errlist[];
+extern void    perror          __P((const char *));
+extern int     read            __P((int, const char*, int));
+#include <string.h>
+#define strerror(e)    sys_errlist[e]
+#endif
+#ifdef SABER
+extern ptr_t    memcpy         __P((ptr_t, const ptr_t, size_t));
+extern ptr_t    memset         __P((ptr_t, int, size_t));
+#endif
+extern char    *fgetline       __P((FILE *, int *));
+#endif
+
 #endif /* _h_sys */
 #endif /* _h_sys */
index 8ad8be0..0dd7883 100644 (file)
@@ -8,15 +8,14 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)term.c     5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)term.c     5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.term.c: Editor/termcap-curses interface
- *           We have to declare a static variable here, since the
- *           termcap putchar routine does not take an argument!
- *           To do: Add the settc echotc and gettc functions
+ * term.c: Editor/termcap-curses interface
+ *        We have to declare a static variable here, since the
+ *        termcap putchar routine does not take an argument!
  */
 #include "sys.h"
 #include <stdio.h>
  */
 #include "sys.h"
 #include <stdio.h>
@@ -221,7 +220,8 @@ private     void    term_free_display       __P((EditLine *));
 private        void    term_alloc_display      __P((EditLine *));
 private        void    term_alloc              __P((EditLine *,
                                             struct termcapstr *, char *)); 
 private        void    term_alloc_display      __P((EditLine *));
 private        void    term_alloc              __P((EditLine *,
                                             struct termcapstr *, char *)); 
-private  void  term_get_termcap        __P((EditLine *, char *));
+private void   term_init_arrow         __P((EditLine *));
+private void   term_reset_arrow        __P((EditLine *));
 
 
 private FILE *term_outfile = NULL;     /* XXX: How do we fix that? */
 
 
 private FILE *term_outfile = NULL;     /* XXX: How do we fix that? */
@@ -277,13 +277,15 @@ term_init(el)
 {
     el->el_term.t_buf = (char *)  el_malloc(TC_BUFSIZE);
     el->el_term.t_cap = (char *)  el_malloc(TC_BUFSIZE);
 {
     el->el_term.t_buf = (char *)  el_malloc(TC_BUFSIZE);
     el->el_term.t_cap = (char *)  el_malloc(TC_BUFSIZE);
+    el->el_term.t_fkey = (fkey_t *) el_malloc(4 * sizeof(fkey_t));
     el->el_term.t_loc = 0;
     el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char*));
     (void) memset(el->el_term.t_str, 0, T_str * sizeof(char*));
     el->el_term.t_val = (int *)   el_malloc(T_val * sizeof(int));
     (void) memset(el->el_term.t_val, 0, T_val * sizeof(char*));
     term_outfile = el->el_outfile;
     el->el_term.t_loc = 0;
     el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char*));
     (void) memset(el->el_term.t_str, 0, T_str * sizeof(char*));
     el->el_term.t_val = (int *)   el_malloc(T_val * sizeof(int));
     (void) memset(el->el_term.t_val, 0, T_val * sizeof(char*));
     term_outfile = el->el_outfile;
-    term_get_termcap(el, NULL);
+    (void) term_set(el, NULL);
+    term_init_arrow(el);
     return 0;
 }
 
     return 0;
 }
 
@@ -772,11 +774,11 @@ term_clear_to_bottom(el)
 #endif
 
 
 #endif
 
 
-/* term_get_termcap():
- *     Read in the terminal capabilities
+/* term_set():
+ *     Read in the terminal capabilities from the requested terminal
  */
  */
-private void
-term_get_termcap(el, term)
+protected int
+term_set(el, term)
     EditLine *el;
     char *term;
 {
     EditLine *el;
     char *term;
 {
@@ -844,8 +846,9 @@ term_get_termcap(el, term)
     (void) term_get_size(el, &lins, &cols);/* get the correct window size */
     term_change_size(el, lins, cols);
     (void) sigprocmask(SIG_SETMASK, &oset, NULL);
     (void) term_get_size(el, &lins, &cols);/* get the correct window size */
     term_change_size(el, lins, cols);
     (void) sigprocmask(SIG_SETMASK, &oset, NULL);
-    term_bind_arrows(el);
-} /* end term_get_termcap */
+    term_bind_arrow(el);
+    return 0;
+} /* end term_set */
 
 
 /* term_get_size():
 
 
 /* term_get_size():
@@ -906,25 +909,145 @@ term_change_size(el, lins, cols)
 } /* end term_change_size */
 
 
 } /* end term_change_size */
 
 
-/* term_bind_arrows():
+/* term_init_arrow():
+ *     Initialize the arrow key bindings from termcap
+ */
+private void
+term_init_arrow(el)
+    EditLine *el;
+{
+    fkey_t *arrow = el->el_term.t_fkey;
+
+    arrow[A_K_DN].name    = "down";
+    arrow[A_K_DN].fun.cmd = ED_NEXT_HISTORY;
+    arrow[A_K_DN].type    = XK_CMD;
+
+    arrow[A_K_UP].name    = "up";
+    arrow[A_K_UP].fun.cmd = ED_PREV_HISTORY;
+    arrow[A_K_UP].type    = XK_CMD;
+
+    arrow[A_K_LT].name    = "left";
+    arrow[A_K_LT].fun.cmd = ED_PREV_CHAR;
+    arrow[A_K_LT].type    = XK_CMD;
+
+    arrow[A_K_RT].name    = "right";
+    arrow[A_K_RT].fun.cmd = ED_NEXT_CHAR;
+    arrow[A_K_RT].type    = XK_CMD;
+
+}
+
+
+/* term_reset_arrow():
+ *     Reset arrow key bindings
+ */
+private void
+term_reset_arrow(el) 
+    EditLine *el;
+{
+    fkey_t *arrow = el->el_term.t_fkey;
+    static char strA[] = {033, '[', 'A', '\0'};
+    static char strB[] = {033, '[', 'B', '\0'};
+    static char strC[] = {033, '[', 'C', '\0'};
+    static char strD[] = {033, '[', 'D', '\0'};
+    static char stOA[] = {033, 'O', 'A', '\0'};
+    static char stOB[] = {033, 'O', 'B', '\0'};
+    static char stOC[] = {033, 'O', 'C', '\0'};
+    static char stOD[] = {033, 'O', 'D', '\0'};
+
+    key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+    key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+    key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+    key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+    key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+    key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+    key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+    key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+
+    if (el->el_map.type == MAP_VI) {
+       key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+       key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+       key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+       key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+       key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+       key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+       key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+       key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+    }
+}
+
+
+/* term_set_arrow():
+ *     Set an arrow key binding
+ */
+protected int
+term_set_arrow(el, name, fun, type)
+    EditLine *el;
+    char *name;
+    key_value_t *fun;
+    int type;
+{
+    fkey_t *arrow = el->el_term.t_fkey;
+    int i;
+
+    for (i = 0; i < A_K_NKEYS; i++)
+       if (strcmp(name, arrow[i].name) == 0) {
+           arrow[i].fun  = *fun;
+           arrow[i].type = type;
+           return 0;
+       }
+    return -1;
+}
+
+
+/* term_clear_arrow():
+ *     Clear an arrow key binding
+ */
+protected int
+term_clear_arrow(el, name)
+    EditLine *el;
+    char *name;
+{
+    fkey_t *arrow = el->el_term.t_fkey;
+    int i;
+
+    for (i = 0; i < A_K_NKEYS; i++)
+       if (strcmp(name, arrow[i].name) == 0) {
+           arrow[i].type = XK_NOD;
+           return 0;
+       }
+    return -1;
+}
+
+
+/* term_print_arrow():
+ *     Print the arrow key bindings
+ */
+protected void
+term_print_arrow(el, name)
+    EditLine *el;
+    char *name;
+{
+    int i;
+    fkey_t *arrow = el->el_term.t_fkey;
+
+    for (i = 0; i < A_K_NKEYS; i++)
+       if (*name == '\0' || strcmp(name, arrow[i].name) == 0)
+           if (arrow[i].type != XK_NOD)
+               key_kprint(el, arrow[i].name, &arrow[i].fun, arrow[i].type);
+}
+
+
+/* term_bind_arrow():
  *     Bind the arrow keys
  */
 protected void
  *     Bind the arrow keys
  */
 protected void
-term_bind_arrows(el)
+term_bind_arrow(el)
     EditLine *el;
 {
     el_action_t *map, *dmap;
     int     i, j;
     char   *p;
     EditLine *el;
 {
     el_action_t *map, *dmap;
     int     i, j;
     char   *p;
-    static struct {
-       int     key, fun;
-    }       ar[] =
-    {
-       { T_kd, ED_NEXT_HISTORY },
-       { T_ku, ED_PREV_HISTORY },
-       { T_kl, ED_PREV_CHAR    },
-       { T_kr, ED_NEXT_CHAR    }
-    };
+    fkey_t *arrow = el->el_term.t_fkey;
 
     /* Check if the components needed are initialized */
     if (el->el_term.t_buf == NULL || el->el_map.key == NULL)
 
     /* Check if the components needed are initialized */
     if (el->el_term.t_buf == NULL || el->el_map.key == NULL)
@@ -933,8 +1056,10 @@ term_bind_arrows(el)
     map  = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key;
     dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs;
 
     map  = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key;
     dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs;
 
+    term_reset_arrow(el);
+
     for (i = 0; i < 4; i++) {
     for (i = 0; i < 4; i++) {
-       p = el->el_term.t_str[ar[i].key];
+       p = el->el_term.t_str[arrow[i].key];
        if (p && *p) {
            j = (unsigned char) *p;
            /*
        if (p && *p) {
            j = (unsigned char) *p;
            /*
@@ -946,13 +1071,21 @@ term_bind_arrows(el)
             *    ED_SEQUENCE_LEAD_IN
             * 2. They are single arrow keys pointing to an unassigned key.
             */
             *    ED_SEQUENCE_LEAD_IN
             * 2. They are single arrow keys pointing to an unassigned key.
             */
-           if (p[1] && (dmap[j] == map[j] || map[j] == ED_SEQUENCE_LEAD_IN)) {
-               key_add(el, p, key_map_cmd(el, ar[i].fun), XK_CMD);
-               map[j] = ED_SEQUENCE_LEAD_IN;
-           }
-           else if (map[j] == ED_UNASSIGNED) {
+           if (arrow[i].type == XK_NOD)
                key_clear(el, map, p);
                key_clear(el, map, p);
-               map[j] = ar[i].fun;
+           else {
+               if (p[1] && (dmap[j] == map[j] || 
+                            map[j] == ED_SEQUENCE_LEAD_IN)) {
+                   key_add(el, p, &arrow[i].fun, arrow[i].type);
+                   map[j] = ED_SEQUENCE_LEAD_IN;
+               }
+               else if (map[j] == ED_UNASSIGNED) {
+                   key_clear(el, map, p);
+                   if (arrow[i].type == XK_CMD)
+                       map[j] = arrow[i].fun.cmd;
+                   else
+                       key_add(el, p, &arrow[i].fun, arrow[i].type);
+               }
            }
        }
     }
            }
        }
     }
index e6a625b..48a3c5b 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)term.h      5.2 (Berkeley) %G%
+ *     @(#)term.h      5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 
 #include "histedit.h"
 
 
 #include "histedit.h"
 
+typedef struct {       /* Symbolic function key bindings       */
+    char       *name;  /* name of the key                      */
+    int        key;    /* Index in termcap table               */
+    key_value_t fun;   /* Function bound to it                 */
+    int                type;   /* Type of function                     */
+} fkey_t;
+
 typedef struct {
     coord_t t_size;                    /* # lines and cols     */
     bool_t  t_flags;
 typedef struct {
     coord_t t_size;                    /* # lines and cols     */
     bool_t  t_flags;
@@ -33,8 +40,17 @@ typedef struct {
     char  **t_str;                     /* termcap strings      */
     int           *t_val;                      /* termcap values       */
     char   *t_cap;                     /* Termcap buffer       */
     char  **t_str;                     /* termcap strings      */
     int           *t_val;                      /* termcap values       */
     char   *t_cap;                     /* Termcap buffer       */
+    fkey_t *t_fkey;                    /* Array of keys        */
 } el_term_t;
 
 } el_term_t;
 
+/*
+ * fKey indexes
+ */
+#define A_K_DN         0
+#define A_K_UP         1
+#define A_K_LT         2
+#define A_K_RT         3
+#define A_K_NKEYS      4
 
 protected void term_move_to_line       __P((EditLine *, int));
 protected void term_move_to_char       __P((EditLine *, int));
 
 protected void term_move_to_line       __P((EditLine *, int));
 protected void term_move_to_char       __P((EditLine *, int));
@@ -47,8 +63,13 @@ protected void term_beep             __P((EditLine *));
 protected void term_change_size                __P((EditLine *, int, int));
 protected int  term_get_size           __P((EditLine *, int *, int *));
 protected int  term_init               __P((EditLine *));
 protected void term_change_size                __P((EditLine *, int, int));
 protected int  term_get_size           __P((EditLine *, int *, int *));
 protected int  term_init               __P((EditLine *));
-protected void term_bind_arrows                __P((EditLine *));
+protected void term_bind_arrow         __P((EditLine *));
+protected void term_print_arrow                __P((EditLine *, char *));
+protected int  term_clear_arrow                __P((EditLine *, char *));
+protected int  term_set_arrow          __P((EditLine *, char *, 
+                                            key_value_t *, int));
 protected void term_end                        __P((EditLine *));
 protected void term_end                        __P((EditLine *));
+protected int  term_set                        __P((EditLine *, char *));
 protected int  term_settc              __P((EditLine *, int, char **));
 protected int  term_telltc             __P((EditLine *, int, char **));
 protected int  term_echotc             __P((EditLine *, int, char **));
 protected int  term_settc              __P((EditLine *, int, char **));
 protected int  term_telltc             __P((EditLine *, int, char **));
 protected int  term_echotc             __P((EditLine *, int, char **));
index 244bfbd..df5ec1f 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)termcap.h   5.1 (Berkeley) %G%
+ *     @(#)termcap.h   5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 92c43ad..422cbc3 100644 (file)
@@ -8,9 +8,9 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)tokenizer.c        5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)tokenizer.c        5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
  * tokenize.c: Bourne shell like tokenizer
 
 /*
  * tokenize.c: Bourne shell like tokenizer
index 9816505..3dd8b98 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tokenizer.h 5.1 (Berkeley) %G%
+ *     @(#)tokenizer.h 5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 8e71eca..2fe0937 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)tty.c      5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)tty.c      5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /* 
 
 /* 
- * el.tty.c: tty interface stuff
+ * tty.c: tty interface stuff
  */
 #include "sys.h"
 #include "tty.h"
  */
 #include "sys.h"
 #include "tty.h"
index 5dea2b1..d4aaf67 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tty.h       5.2 (Berkeley) %G%
+ *     @(#)tty.h       5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 24b8a7f..f196a32 100644 (file)
@@ -8,12 +8,12 @@
  * %sccs.include.redist.c%
  */
 
  * %sccs.include.redist.c%
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)vi.c       5.1 (Berkeley) %G%";
-#endif /* not lint */
+#if !defined(lint) && !defined(SCCSID)
+static char sccsid[] = "@(#)vi.c       5.2 (Berkeley) %G%";
+#endif /* not lint && not SCCSID */
 
 /*
 
 /*
- * el.vi.c: Vi mode commands.
+ * vi.c: Vi mode commands.
  */
 #include "sys.h"
 #include "el.h"
  */
 #include "sys.h"
 #include "el.h"