823 lines
24 KiB
Diff
823 lines
24 KiB
Diff
diff -Naur libedit-20080712-2.11/Makefile.am libedit-20080712-2.11-zyxel/Makefile.am
|
|
--- libedit-20080712-2.11/Makefile.am 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/Makefile.am 2014-01-15 09:49:18.064271378 +0800
|
|
@@ -1,7 +1,8 @@
|
|
|
|
AUTOMAKE_OPTIONS = foreign
|
|
|
|
-SUBDIRS = src examples doc
|
|
+#SUBDIRS = src examples doc
|
|
+SUBDIRS = src doc
|
|
|
|
EXTRA_DIST = libedit.pc.in
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
|
diff -Naur libedit-20080712-2.11/Makefile.in libedit-20080712-2.11-zyxel/Makefile.in
|
|
--- libedit-20080712-2.11/Makefile.in 2008-07-12 17:36:12.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/Makefile.in 2014-01-15 09:49:18.128271378 +0800
|
|
@@ -192,7 +192,9 @@
|
|
sysconfdir = @sysconfdir@
|
|
target_alias = @target_alias@
|
|
AUTOMAKE_OPTIONS = foreign
|
|
-SUBDIRS = src examples doc
|
|
+#ZyXEL
|
|
+#SUBDIRS = src examples doc
|
|
+SUBDIRS = src doc
|
|
EXTRA_DIST = libedit.pc.in patches/README patches/00-vis.h.patch \
|
|
patches/01-term.c.patch patches/02-el_term.h.patch \
|
|
patches/03-unvis.c.patch patches/04-strlcpy.c.patch \
|
|
diff -Naur libedit-20080712-2.11/src/chared.c libedit-20080712-2.11-zyxel/src/chared.c
|
|
--- libedit-20080712-2.11/src/chared.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/chared.c 2014-01-15 09:49:18.240271378 +0800
|
|
@@ -547,6 +547,8 @@
|
|
EditLine *el;
|
|
size_t addlen;
|
|
{
|
|
+ return 0;
|
|
+#if 0 /* ZyXEL */
|
|
size_t sz, newsz;
|
|
char *newbuffer, *oldbuf, *oldkbuf;
|
|
|
|
@@ -623,6 +625,7 @@
|
|
/* Safe to set enlarged buffer size */
|
|
el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE];
|
|
return 1;
|
|
+#endif
|
|
}
|
|
|
|
/* ch_end():
|
|
diff -Naur libedit-20080712-2.11/src/common.c libedit-20080712-2.11-zyxel/src/common.c
|
|
--- libedit-20080712-2.11/src/common.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/common.c 2014-01-15 09:49:18.316271378 +0800
|
|
@@ -95,10 +95,10 @@
|
|
*el->el_line.cursor++ = c;
|
|
re_refresh(el);
|
|
}
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_state.inputmode == MODE_REPLACE_1)
|
|
return vi_command_mode(el, 0);
|
|
-
|
|
+#endif
|
|
return (CC_NORM);
|
|
}
|
|
|
|
@@ -148,6 +148,7 @@
|
|
#endif
|
|
if (el->el_line.cursor == el->el_line.lastchar) {
|
|
/* if I'm at the end */
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI) {
|
|
if (el->el_line.cursor == el->el_line.buffer) {
|
|
/* if I'm also at the beginning */
|
|
@@ -166,11 +167,12 @@
|
|
#endif
|
|
}
|
|
} else {
|
|
+#endif
|
|
if (el->el_line.cursor != el->el_line.buffer)
|
|
el->el_line.cursor--;
|
|
else
|
|
return (CC_ERROR);
|
|
- }
|
|
+// } /* ZyXEL */
|
|
}
|
|
c_delafter(el, el->el_state.argument); /* delete after dot */
|
|
if (el->el_line.cursor >= el->el_line.lastchar &&
|
|
@@ -212,6 +214,7 @@
|
|
{
|
|
|
|
el->el_line.cursor = el->el_line.lastchar;
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI) {
|
|
#ifdef VI_MOVE
|
|
el->el_line.cursor--;
|
|
@@ -221,6 +224,7 @@
|
|
return (CC_REFRESH);
|
|
}
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
}
|
|
|
|
@@ -236,6 +240,7 @@
|
|
|
|
el->el_line.cursor = el->el_line.buffer;
|
|
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI) {
|
|
/* We want FIRST non space character */
|
|
while (isspace((unsigned char) *el->el_line.cursor))
|
|
@@ -245,6 +250,7 @@
|
|
return (CC_REFRESH);
|
|
}
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
}
|
|
|
|
@@ -284,21 +290,24 @@
|
|
{
|
|
char *lim = el->el_line.lastchar;
|
|
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_line.cursor >= lim ||
|
|
(el->el_line.cursor == lim - 1 &&
|
|
el->el_map.type == MAP_VI &&
|
|
el->el_chared.c_vcmd.action == NOP))
|
|
return (CC_ERROR);
|
|
-
|
|
+#endif
|
|
el->el_line.cursor += el->el_state.argument;
|
|
if (el->el_line.cursor > lim)
|
|
el->el_line.cursor = lim;
|
|
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI)
|
|
if (el->el_chared.c_vcmd.action != NOP) {
|
|
cv_delfini(el);
|
|
return (CC_REFRESH);
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
}
|
|
|
|
@@ -319,12 +328,13 @@
|
|
el->el_line.buffer,
|
|
el->el_state.argument,
|
|
ce__isword);
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI)
|
|
if (el->el_chared.c_vcmd.action != NOP) {
|
|
cv_delfini(el);
|
|
return (CC_REFRESH);
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
}
|
|
|
|
@@ -342,12 +352,13 @@
|
|
el->el_line.cursor -= el->el_state.argument;
|
|
if (el->el_line.cursor < el->el_line.buffer)
|
|
el->el_line.cursor = el->el_line.buffer;
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI)
|
|
if (el->el_chared.c_vcmd.action != NOP) {
|
|
cv_delfini(el);
|
|
return (CC_REFRESH);
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
} else
|
|
return (CC_ERROR);
|
|
@@ -658,10 +669,12 @@
|
|
el->el_history.eventno += el->el_state.argument;
|
|
|
|
if (hist_get(el) == CC_ERROR) {
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI) {
|
|
el->el_history.eventno = sv_event;
|
|
return CC_ERROR;
|
|
}
|
|
+#endif
|
|
beep = 1;
|
|
/* el->el_history.eventno was fixed by first call */
|
|
(void) hist_get(el);
|
|
diff -Naur libedit-20080712-2.11/src/el.h libedit-20080712-2.11-zyxel/src/el.h
|
|
--- libedit-20080712-2.11/src/el.h 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/el.h 2014-01-15 09:49:18.240271378 +0800
|
|
@@ -49,7 +49,11 @@
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
|
|
+#ifdef ZYSH_BUFSIZE /* ZyXEL */
|
|
+#define EL_BUFSIZ ZYSH_BUFSIZE
|
|
+#else
|
|
#define EL_BUFSIZ 1024 /* Maximum line size */
|
|
+#endif
|
|
|
|
#define HANDLE_SIGNALS 0x01
|
|
#define NO_TTY 0x02
|
|
diff -Naur libedit-20080712-2.11/src/emacs.c libedit-20080712-2.11-zyxel/src/emacs.c
|
|
--- libedit-20080712-2.11/src/emacs.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/emacs.c 2014-01-15 09:49:18.316271378 +0800
|
|
@@ -265,12 +265,13 @@
|
|
el->el_line.lastchar,
|
|
el->el_state.argument,
|
|
ce__isword);
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI)
|
|
if (el->el_chared.c_vcmd.action != NOP) {
|
|
cv_delfini(el);
|
|
return (CC_REFRESH);
|
|
}
|
|
+#endif
|
|
return (CC_CURSOR);
|
|
}
|
|
|
|
diff -Naur libedit-20080712-2.11/src/hist.c libedit-20080712-2.11-zyxel/src/hist.c
|
|
--- libedit-20080712-2.11/src/hist.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/hist.c 2014-01-15 09:49:18.216271378 +0800
|
|
@@ -105,12 +105,13 @@
|
|
el->el_history.sz);
|
|
el->el_line.lastchar = el->el_line.buffer +
|
|
(el->el_history.last - el->el_history.buf);
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
#ifdef KSHVI
|
|
if (el->el_map.type == MAP_VI)
|
|
el->el_line.cursor = el->el_line.buffer;
|
|
else
|
|
#endif /* KSHVI */
|
|
+#endif
|
|
el->el_line.cursor = el->el_line.lastchar;
|
|
|
|
return (CC_REFRESH);
|
|
@@ -138,11 +139,13 @@
|
|
if (el->el_line.lastchar > el->el_line.buffer
|
|
&& el->el_line.lastchar[-1] == ' ')
|
|
el->el_line.lastchar--;
|
|
+#if 0 /* ZyXEL */
|
|
#ifdef KSHVI
|
|
if (el->el_map.type == MAP_VI)
|
|
el->el_line.cursor = el->el_line.buffer;
|
|
else
|
|
#endif /* KSHVI */
|
|
+#endif
|
|
el->el_line.cursor = el->el_line.lastchar;
|
|
|
|
return (CC_REFRESH);
|
|
diff -Naur libedit-20080712-2.11/src/histedit.h libedit-20080712-2.11-zyxel/src/histedit.h
|
|
--- libedit-20080712-2.11/src/histedit.h 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/histedit.h 2014-01-15 09:49:18.240271378 +0800
|
|
@@ -220,6 +220,7 @@
|
|
int *, const char ***, int *, int *);
|
|
int tok_str(Tokenizer *, const char *,
|
|
int *, const char ***);
|
|
+int tok_relist(Tokenizer *, const LineInfo *); /* ZyXEL */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
diff -Naur libedit-20080712-2.11/src/Makefile.in libedit-20080712-2.11-zyxel/src/Makefile.in
|
|
--- libedit-20080712-2.11/src/Makefile.in 2008-07-12 17:36:12.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/Makefile.in 2014-01-15 09:49:18.240271378 +0800
|
|
@@ -58,11 +58,18 @@
|
|
libLTLIBRARIES_INSTALL = $(INSTALL)
|
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
|
libedit_la_LIBADD =
|
|
-am_libedit_la_OBJECTS = chared.lo common.lo el.lo emacs.lo hist.lo \
|
|
+#ZyXEL
|
|
+#am_libedit_la_OBJECTS = chared.lo common.lo el.lo emacs.lo hist.lo \
|
|
key.lo map.lo parse.lo prompt.lo read.lo refresh.lo search.lo \
|
|
sig.lo term.lo tty.lo vi.lo fgetln.lo strlcat.lo strlcpy.lo \
|
|
unvis.lo vis.lo tokenizer.lo history.lo filecomplete.lo \
|
|
readline.lo
|
|
+am_libedit_la_OBJECTS = chared.lo common.lo el.lo emacs.lo hist.lo \
|
|
+ key.lo map.lo parse.lo prompt.lo read.lo refresh.lo search.lo \
|
|
+ sig.lo term.lo tty.lo fgetln.lo strlcat.lo strlcpy.lo \
|
|
+ unvis.lo vis.lo tokenizer.lo history.lo filecomplete.lo \
|
|
+ readline.lo
|
|
+
|
|
am__objects_1 = fcns.lo help.lo
|
|
nodist_libedit_la_OBJECTS = $(am__objects_1)
|
|
libedit_la_OBJECTS = $(am_libedit_la_OBJECTS) \
|
|
@@ -193,16 +200,28 @@
|
|
sharedstatedir = @sharedstatedir@
|
|
sysconfdir = @sysconfdir@
|
|
target_alias = @target_alias@
|
|
-BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c
|
|
-AHDR = vi.h emacs.h common.h
|
|
-ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
|
|
+#ZyXEL
|
|
+#BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c
|
|
+#AHDR = vi.h emacs.h common.h
|
|
+#ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
|
|
+BUILT_SOURCES = emacs.h common.h fcns.h help.h fcns.c help.c
|
|
+AHDR = emacs.h common.h
|
|
+ASRC = $(srcdir)/emacs.c $(srcdir)/common.c
|
|
CLEANFILES = $(BUILT_SOURCES)
|
|
lib_LTLIBRARIES = libedit.la
|
|
-libedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \
|
|
+#ZyXEL
|
|
+#libedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \
|
|
prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \
|
|
fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \
|
|
history.c filecomplete.c readline.c chared.h el.h hist.h \
|
|
histedit.h key.h map.h parse.h prompt.h read.h refresh.h \
|
|
+ search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \
|
|
+ editline/readline.h
|
|
+libedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \
|
|
+ prompt.c read.c refresh.c search.c sig.c term.c tty.c \
|
|
+ fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \
|
|
+ history.c filecomplete.c readline.c chared.h el.h hist.h \
|
|
+ histedit.h key.h map.h parse.h prompt.h read.h refresh.h \
|
|
search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \
|
|
editline/readline.h
|
|
|
|
diff -Naur libedit-20080712-2.11/src/map.c libedit-20080712-2.11-zyxel/src/map.c
|
|
--- libedit-20080712-2.11/src/map.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/map.c 2014-01-15 09:49:18.240271378 +0800
|
|
@@ -318,7 +318,7 @@
|
|
/* 255 */
|
|
};
|
|
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
/*
|
|
* keymap table for vi. Each index into above tbl; should be
|
|
* N_KEYS entries long. Vi mode uses a sticky-extend to do command mode:
|
|
@@ -884,7 +884,7 @@
|
|
/* 254 */ ED_UNASSIGNED, /* M-~ */
|
|
/* 255 */ ED_UNASSIGNED /* M-^? */
|
|
};
|
|
-
|
|
+#endif
|
|
|
|
/* map_init():
|
|
* Initialize and allocate the maps
|
|
@@ -899,11 +899,13 @@
|
|
#ifdef MAP_DEBUG
|
|
if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t))
|
|
EL_ABORT((el->errfile, "Emacs map incorrect\n"));
|
|
+#if 0 /* ZyXEL */
|
|
if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t))
|
|
EL_ABORT((el->errfile, "Vi command map incorrect\n"));
|
|
if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t))
|
|
EL_ABORT((el->errfile, "Vi insert map incorrect\n"));
|
|
#endif
|
|
+#endif
|
|
|
|
el->el_map.alt = (el_action_t *)el_malloc(sizeof(el_action_t) * N_KEYS);
|
|
if (el->el_map.alt == NULL)
|
|
@@ -912,8 +914,10 @@
|
|
if (el->el_map.key == NULL)
|
|
return (-1);
|
|
el->el_map.emacs = el_map_emacs;
|
|
+#if 0 /* ZyXEL */
|
|
el->el_map.vic = el_map_vi_command;
|
|
el->el_map.vii = el_map_vi_insert;
|
|
+#endif
|
|
el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) *
|
|
EL_NUM_FCNS);
|
|
if (el->el_map.help == NULL)
|
|
@@ -926,12 +930,14 @@
|
|
return (-1);
|
|
memcpy(el->el_map.func, func__get(), sizeof(el_func_t) * EL_NUM_FCNS);
|
|
el->el_map.nfunc = EL_NUM_FCNS;
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
#ifdef VIDEFAULT
|
|
map_init_vi(el);
|
|
#else
|
|
map_init_emacs(el);
|
|
#endif /* VIDEFAULT */
|
|
+#endif
|
|
+ map_init_emacs(el); /* ZyXEL */
|
|
return (0);
|
|
}
|
|
|
|
@@ -948,8 +954,10 @@
|
|
el_free((ptr_t) el->el_map.key);
|
|
el->el_map.key = NULL;
|
|
el->el_map.emacs = NULL;
|
|
+#if 0 /* ZyXEL */
|
|
el->el_map.vic = NULL;
|
|
el->el_map.vii = NULL;
|
|
+#endif
|
|
el_free((ptr_t) el->el_map.help);
|
|
el->el_map.help = NULL;
|
|
el_free((ptr_t) el->el_map.func);
|
|
@@ -992,8 +1000,10 @@
|
|
continue;
|
|
if (i > 0377) {
|
|
i = 033;
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI)
|
|
map = alt;
|
|
+#endif
|
|
} else
|
|
map = alt;
|
|
}
|
|
@@ -1013,7 +1023,7 @@
|
|
map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN;
|
|
}
|
|
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
/* map_init_vi():
|
|
* Initialize the vi bindings
|
|
*/
|
|
@@ -1042,7 +1052,7 @@
|
|
tty_bind_char(el, 1);
|
|
term_bind_arrow(el);
|
|
}
|
|
-
|
|
+#endif
|
|
|
|
/* map_init_emacs():
|
|
* Initialize the emacs bindings
|
|
@@ -1089,10 +1099,12 @@
|
|
map_init_emacs(el);
|
|
return (0);
|
|
}
|
|
+#if 0 /* ZyXEL */
|
|
if (strcmp(editor, "vi") == 0) {
|
|
map_init_vi(el);
|
|
return (0);
|
|
}
|
|
+#endif
|
|
return (-1);
|
|
}
|
|
|
|
@@ -1110,9 +1122,11 @@
|
|
case MAP_EMACS:
|
|
*editor = "emacs";
|
|
return (0);
|
|
+#if 0 /* ZyXEL */
|
|
case MAP_VI:
|
|
*editor = "vi";
|
|
return (0);
|
|
+#endif
|
|
}
|
|
return (-1);
|
|
}
|
|
@@ -1285,11 +1299,11 @@
|
|
case 'r':
|
|
rem = 1;
|
|
break;
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
case 'v':
|
|
map_init_vi(el);
|
|
return (0);
|
|
-
|
|
+#endif
|
|
case 'e':
|
|
map_init_emacs(el);
|
|
return (0);
|
|
diff -Naur libedit-20080712-2.11/src/map.h libedit-20080712-2.11-zyxel/src/map.h
|
|
--- libedit-20080712-2.11/src/map.h 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/map.h 2014-01-15 09:49:18.332271378 +0800
|
|
@@ -52,8 +52,10 @@
|
|
el_action_t *key; /* The current normal key map */
|
|
el_action_t *current; /* The keymap we are using */
|
|
const el_action_t *emacs; /* The default emacs key map */
|
|
+#if 0 /* ZyXEL */
|
|
const el_action_t *vic; /* The vi command mode key map */
|
|
const el_action_t *vii; /* The vi insert mode key map */
|
|
+#endif
|
|
int type; /* Emacs or vi */
|
|
el_bindings_t *help; /* The help for the editor functions */
|
|
el_func_t *func; /* List of available functions */
|
|
@@ -66,7 +68,7 @@
|
|
protected int map_bind(EditLine *, int, const char **);
|
|
protected int map_init(EditLine *);
|
|
protected void map_end(EditLine *);
|
|
-protected void map_init_vi(EditLine *);
|
|
+//protected void map_init_vi(EditLine *); /* ZyXEL */
|
|
protected void map_init_emacs(EditLine *);
|
|
protected int map_set_editor(EditLine *, char *);
|
|
protected int map_get_editor(EditLine *, const char **);
|
|
diff -Naur libedit-20080712-2.11/src/read.c libedit-20080712-2.11-zyxel/src/read.c
|
|
--- libedit-20080712-2.11/src/read.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/read.c 2014-01-15 09:49:18.328271378 +0800
|
|
@@ -526,6 +526,7 @@
|
|
/* vi redo needs these way down the levels... */
|
|
el->el_state.thiscmd = cmdnum;
|
|
el->el_state.thisch = ch;
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI &&
|
|
el->el_map.current == el->el_map.key &&
|
|
el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
|
|
@@ -536,6 +537,7 @@
|
|
else
|
|
*el->el_chared.c_redo.pos++ = ch;
|
|
}
|
|
+#endif
|
|
retval = (*el->el_map.func[cmdnum]) (el, ch);
|
|
#ifdef DEBUG_READ
|
|
(void) fprintf(el->el_errfile,
|
|
diff -Naur libedit-20080712-2.11/src/term.c libedit-20080712-2.11-zyxel/src/term.c
|
|
--- libedit-20080712-2.11/src/term.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/term.c 2014-01-15 09:49:18.316271378 +0800
|
|
@@ -1019,14 +1019,20 @@
|
|
/* term_change_size():
|
|
* Change the size of the terminal
|
|
*/
|
|
+extern int column; /* ZyXEL */
|
|
+extern int row;
|
|
protected int
|
|
term_change_size(EditLine *el, int lins, int cols)
|
|
{
|
|
/*
|
|
* Just in case
|
|
*/
|
|
+ column = Val(T_co) = (cols < 2) ? 80 : cols;
|
|
+ row = Val(T_li) = (lins < 1) ? 24 : lins;
|
|
+#if 0 /*ZyXEL */
|
|
Val(T_co) = (cols < 2) ? 80 : cols;
|
|
Val(T_li) = (lins < 1) ? 24 : lins;
|
|
+#endif
|
|
|
|
/* re-make display buffers */
|
|
if (term_rebuffer_display(el) == -1)
|
|
@@ -1108,7 +1114,7 @@
|
|
key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
|
|
key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
|
key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
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);
|
|
@@ -1123,6 +1129,7 @@
|
|
key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
|
|
key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
|
|
@@ -1195,9 +1202,13 @@
|
|
/* Check if the components needed are initialized */
|
|
if (el->el_term.t_buf == NULL || el->el_map.key == NULL)
|
|
return;
|
|
-
|
|
+#if 0 /* ZyXEL */
|
|
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;
|
|
+#endif
|
|
+ map = el->el_map.key; /* ZyXEL */
|
|
+ dmap = el->el_map.emacs; /* ZyXEL */
|
|
+
|
|
|
|
term_reset_arrow(el);
|
|
|
|
diff -Naur libedit-20080712-2.11/src/tokenizer.c libedit-20080712-2.11-zyxel/src/tokenizer.c
|
|
--- libedit-20080712-2.11/src/tokenizer.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/tokenizer.c 2014-01-15 09:49:18.316271378 +0800
|
|
@@ -167,7 +167,90 @@
|
|
tok_free((ptr_t) tok);
|
|
}
|
|
|
|
+/* ZyXEL */
|
|
+/* add a new function : tok_relist */
|
|
+int g_len = 0;
|
|
+public int
|
|
+tok_relist(Tokenizer *tok, const LineInfo *line)
|
|
+{
|
|
+ const char *ptr;
|
|
+ const char *o_ptr;
|
|
+ char *new_line; /* new line->buffer */
|
|
+ char *n_ptr;
|
|
+ char t_c; /* target character */
|
|
+ int count_pp; /* counter for pipe */
|
|
+ int state;
|
|
+ int len;
|
|
+ int buffer_size;
|
|
+
|
|
+ ptr = line->buffer;
|
|
+ count_pp = 0;
|
|
+
|
|
+ while ( *ptr != '\0' ) {
|
|
+ if ( *ptr == '|' || *ptr == ';' )
|
|
+ count_pp += 2;
|
|
+ ptr++;
|
|
+ }
|
|
+
|
|
+ if ( !count_pp )
|
|
+ return 0;
|
|
+
|
|
+ new_line = calloc(strlen(line->buffer)+count_pp+1, sizeof(char));
|
|
+ ptr = o_ptr = line->buffer;
|
|
+ n_ptr = new_line;
|
|
+ state = Q_none;
|
|
+
|
|
+ while ( *ptr != '\0' ) {
|
|
+ switch( *ptr ) {
|
|
+ case '"':
|
|
+ if ( state == Q_none ) {
|
|
+ state = Q_single;
|
|
+ } else {
|
|
+ state = Q_none;
|
|
+ }
|
|
+ *n_ptr = *ptr;
|
|
+ n_ptr++;
|
|
+ break;
|
|
+
|
|
+ case '|':
|
|
+ case ';':
|
|
+ t_c = *ptr;
|
|
+ if ( state == Q_none ) {
|
|
+ if ( *(ptr-1) == ' ' ) {
|
|
+ //*n_ptr = '|';
|
|
+ *n_ptr = t_c;
|
|
+ } else {
|
|
+ *n_ptr = ' ';
|
|
+ n_ptr++;
|
|
+ //*n_ptr = '|';
|
|
+ *n_ptr = t_c;
|
|
+ }
|
|
+ n_ptr++;
|
|
+ if ( *(ptr+1) != ' ' ) {
|
|
+ *n_ptr = ' ';
|
|
+ n_ptr++;
|
|
+ }
|
|
+ } else {
|
|
+ *n_ptr = *ptr;
|
|
+ n_ptr++;
|
|
+ /* do nothing */
|
|
+ }
|
|
+ break;
|
|
|
|
+ default:
|
|
+ *n_ptr = *ptr;
|
|
+ n_ptr++;
|
|
+ break;
|
|
+ }
|
|
+ ptr++;
|
|
+ }
|
|
+
|
|
+ strcpy((char *)line->buffer, new_line); /* ZyXEL */
|
|
+ //strcpy(line->buffer, new_line);
|
|
+ g_len = (n_ptr - new_line) - (line->buffer - line->lastchar);
|
|
+ tok_free(new_line);
|
|
+ return 0;
|
|
+}
|
|
|
|
/* tok_line():
|
|
* Bourne shell (sh(1)) like tokenizing
|
|
@@ -194,9 +277,10 @@
|
|
int cc, co;
|
|
|
|
cc = co = -1;
|
|
+ tok_relist(tok, line);
|
|
ptr = line->buffer;
|
|
for (ptr = line->buffer; ;ptr++) {
|
|
- if (ptr >= line->lastchar)
|
|
+ if (ptr >= (line->lastchar+g_len)) /* ZyXEL */
|
|
ptr = "";
|
|
if (ptr == line->cursor) {
|
|
cc = tok->argc;
|
|
@@ -305,7 +389,8 @@
|
|
|
|
case Q_single:
|
|
case Q_double:
|
|
- *tok->wptr++ = *ptr; /* Add the return */
|
|
+ //*tok->wptr++ = *ptr; /* ZyXEL */ /* Add the return */
|
|
+ *tok->wptr = *ptr; /* ZyXEL */
|
|
break;
|
|
|
|
case Q_doubleone: /* Back to double, eat the '\n' */
|
|
@@ -354,6 +439,41 @@
|
|
}
|
|
break;
|
|
|
|
+ case '#': /* ZyXEL */
|
|
+ tok->flags &= ~TOK_EAT;
|
|
+ switch (tok->quote) {
|
|
+ case Q_none:
|
|
+ if ( *(ptr-1) != ' ' ) {
|
|
+ *tok->wptr++ = *ptr;
|
|
+ } else if ( *(ptr-2) == '\\' ) {
|
|
+ *tok->wptr++ = *ptr;
|
|
+ } else {
|
|
+ goto tok_line_outok;
|
|
+ }
|
|
+ break;
|
|
+
|
|
+ case Q_single:
|
|
+ case Q_double:
|
|
+ *tok->wptr++ = *ptr;
|
|
+ break;
|
|
+
|
|
+ case Q_doubleone:
|
|
+ tok->flags |= TOK_EAT;
|
|
+ tok->quote = Q_double;
|
|
+ break;
|
|
+
|
|
+ case Q_one:
|
|
+ tok->quote = Q_none;
|
|
+ *tok->wptr++ = *ptr;
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ return (0);
|
|
+ }
|
|
+ break;
|
|
+#if 0
|
|
+#endif
|
|
+
|
|
default:
|
|
tok->flags &= ~TOK_EAT;
|
|
switch (tok->quote) {
|
|
@@ -445,3 +565,4 @@
|
|
li.cursor = li.lastchar = strchr(line, '\0');
|
|
return (tok_line(tok, &li, argc, argv, NULL, NULL));
|
|
}
|
|
+
|
|
diff -Naur libedit-20080712-2.11/src/tty.c libedit-20080712-2.11-zyxel/src/tty.c
|
|
--- libedit-20080712-2.11/src/tty.c 2008-07-12 16:38:05.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/tty.c 2014-01-15 09:49:18.328271378 +0800
|
|
@@ -119,6 +119,7 @@
|
|
};
|
|
|
|
private const ttymap_t tty_map[] = {
|
|
+#if 0 /* ZyXEL */
|
|
#ifdef VERASE
|
|
{C_ERASE, VERASE,
|
|
{EM_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}},
|
|
@@ -139,6 +140,7 @@
|
|
{C_EOF, VEOF,
|
|
{EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED}},
|
|
#endif /* VEOF */
|
|
+#endif
|
|
#ifdef VWERASE
|
|
{C_WERASE, VWERASE,
|
|
{ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD}},
|
|
@@ -446,7 +448,8 @@
|
|
|
|
|
|
#define tty_getty(el, td) tcgetattr((el)->el_infd, (td))
|
|
-#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td))
|
|
+#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSANOW, (td)) /* ZyXEL */
|
|
+//#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) /* ZyXEL */
|
|
|
|
#define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)
|
|
#define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8)
|
|
@@ -878,14 +881,15 @@
|
|
|
|
map = el->el_map.key;
|
|
alt = el->el_map.alt;
|
|
+#if 0 /* ZyXEL */
|
|
if (el->el_map.type == MAP_VI) {
|
|
dmap = el->el_map.vii;
|
|
dalt = el->el_map.vic;
|
|
} else {
|
|
+#endif
|
|
dmap = el->el_map.emacs;
|
|
dalt = NULL;
|
|
- }
|
|
-
|
|
+// } /* ZyXEL */
|
|
for (tp = tty_map; tp->nch != -1; tp++) {
|
|
new[0] = t_n[tp->nch];
|
|
old[0] = t_o[tp->och];
|
|
diff -Naur libedit-20080712-2.11/src/vi.h libedit-20080712-2.11-zyxel/src/vi.h
|
|
--- libedit-20080712-2.11/src/vi.h 1970-01-01 08:00:00.000000000 +0800
|
|
+++ libedit-20080712-2.11-zyxel/src/vi.h 2014-01-15 09:49:18.216271378 +0800
|
|
@@ -0,0 +1,51 @@
|
|
+/* Automatically generated file, do not edit */
|
|
+#ifndef _h_vi_c
|
|
+#define _h_vi_c
|
|
+protected el_action_t vi_paste_next (EditLine *, int);
|
|
+protected el_action_t vi_paste_prev (EditLine *, int);
|
|
+protected el_action_t vi_prev_big_word (EditLine *, int);
|
|
+protected el_action_t vi_prev_word (EditLine *, int);
|
|
+protected el_action_t vi_next_big_word (EditLine *, int);
|
|
+protected el_action_t vi_next_word (EditLine *, int);
|
|
+protected el_action_t vi_change_case (EditLine *, int);
|
|
+protected el_action_t vi_change_meta (EditLine *, int);
|
|
+protected el_action_t vi_insert_at_bol (EditLine *, int);
|
|
+protected el_action_t vi_replace_char (EditLine *, int);
|
|
+protected el_action_t vi_replace_mode (EditLine *, int);
|
|
+protected el_action_t vi_substitute_char (EditLine *, int);
|
|
+protected el_action_t vi_substitute_line (EditLine *, int);
|
|
+protected el_action_t vi_change_to_eol (EditLine *, int);
|
|
+protected el_action_t vi_insert (EditLine *, int);
|
|
+protected el_action_t vi_add (EditLine *, int);
|
|
+protected el_action_t vi_add_at_eol (EditLine *, int);
|
|
+protected el_action_t vi_delete_meta (EditLine *, int);
|
|
+protected el_action_t vi_end_big_word (EditLine *, int);
|
|
+protected el_action_t vi_end_word (EditLine *, int);
|
|
+protected el_action_t vi_undo (EditLine *, int);
|
|
+protected el_action_t vi_command_mode (EditLine *, int);
|
|
+protected el_action_t vi_zero (EditLine *, int);
|
|
+protected el_action_t vi_delete_prev_char (EditLine *, int);
|
|
+protected el_action_t vi_list_or_eof (EditLine *, int);
|
|
+protected el_action_t vi_kill_line_prev (EditLine *, int);
|
|
+protected el_action_t vi_search_prev (EditLine *, int);
|
|
+protected el_action_t vi_search_next (EditLine *, int);
|
|
+protected el_action_t vi_repeat_search_next (EditLine *, int);
|
|
+protected el_action_t vi_repeat_search_prev (EditLine *, int);
|
|
+protected el_action_t vi_next_char (EditLine *, int);
|
|
+protected el_action_t vi_prev_char (EditLine *, int);
|
|
+protected el_action_t vi_to_next_char (EditLine *, int);
|
|
+protected el_action_t vi_to_prev_char (EditLine *, int);
|
|
+protected el_action_t vi_repeat_next_char (EditLine *, int);
|
|
+protected el_action_t vi_repeat_prev_char (EditLine *, int);
|
|
+protected el_action_t vi_match (EditLine *, int);
|
|
+protected el_action_t vi_undo_line (EditLine *, int);
|
|
+protected el_action_t vi_to_column (EditLine *, int);
|
|
+protected el_action_t vi_yank_end (EditLine *, int);
|
|
+protected el_action_t vi_yank (EditLine *, int);
|
|
+protected el_action_t vi_comment_out (EditLine *, int);
|
|
+protected el_action_t vi_alias (EditLine *, int);
|
|
+protected el_action_t vi_to_history_line (EditLine *, int);
|
|
+protected el_action_t vi_histedit (EditLine *, int);
|
|
+protected el_action_t vi_history_word (EditLine *, int);
|
|
+protected el_action_t vi_redo (EditLine *, int);
|
|
+#endif /* _h_vi_c */
|