mirror of
https://github.com/troglobit/editline.git
synced 2025-09-18 19:10:09 +08:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
19f1943f6f |
44
INSTALL
44
INSTALL
@@ -1,44 +0,0 @@
|
|||||||
HowTo Build Minix Editline
|
|
||||||
==========================
|
|
||||||
|
|
||||||
Minix editline makes use of GNU configure tools, which includes autoconf, automake
|
|
||||||
and libtool. This enables high levels of portability and ease of use In most cases
|
|
||||||
all you need to do is unpack the tarball, enter the directory and type:
|
|
||||||
|
|
||||||
./configure
|
|
||||||
|
|
||||||
There are are, however, more options available. For instance, sometimes it is useful
|
|
||||||
to build editline as a static library, type:
|
|
||||||
|
|
||||||
./configure --disable-shared
|
|
||||||
|
|
||||||
By default editline employs a default handler for the TAB key, pressing it once
|
|
||||||
completes to the nearest matching filename in the current working directory, or it
|
|
||||||
can display a listing of possible completions. For some uses this default is not
|
|
||||||
desirable at all, type:
|
|
||||||
|
|
||||||
./configure --disable-default-complete
|
|
||||||
|
|
||||||
An even more common desire is to change the default install location. By default all
|
|
||||||
configure scripts setup /usr/local as the install "prefix", to change this type:
|
|
||||||
|
|
||||||
./configure --prefix=/home/troglobit/tmp
|
|
||||||
|
|
||||||
Advanced users are encouraged to read up on --libdir, --mandir, etc. in the GNU
|
|
||||||
Configure and Build System.
|
|
||||||
|
|
||||||
For more available options, type:
|
|
||||||
|
|
||||||
./configure --help
|
|
||||||
|
|
||||||
To build and install, simply type:
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
followed by
|
|
||||||
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
Good Luck!
|
|
||||||
//Joachim
|
|
||||||
|
|
19
Make.os9
19
Make.os9
@@ -1,19 +0,0 @@
|
|||||||
## $Revision: 1.2 $
|
|
||||||
##
|
|
||||||
## OS-9 makefile for editline library.
|
|
||||||
##
|
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
RFILES = editline.r complete.r sysos9.r
|
|
||||||
|
|
||||||
%.r: %.c
|
|
||||||
cc68 -r -Dstrchr=index -Dstrrchr=rindex -DNEED_STRDUP -DSYS_OS9 $*.c
|
|
||||||
|
|
||||||
testit: testit.r editline.lib
|
|
||||||
cc68 -f=testit testit.r -l=editline.lib
|
|
||||||
|
|
||||||
$(RFILES): $(RFILES:%.r=%.c)
|
|
||||||
|
|
||||||
editline.lib: $(RFILES)
|
|
||||||
cat $(RFILES) >$@
|
|
@@ -36,8 +36,8 @@ host_triplet = @host@
|
|||||||
subdir = .
|
subdir = .
|
||||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||||
$(top_srcdir)/configure INSTALL NEWS TODO config.guess \
|
$(top_srcdir)/configure NEWS TODO config.guess config.sub \
|
||||||
config.sub depcomp install-sh ltmain.sh missing
|
depcomp install-sh ltmain.sh missing
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||||
|
43
README
43
README
@@ -1,36 +1,39 @@
|
|||||||
README -*-text-*-
|
README -*-text-*-
|
||||||
|
|
||||||
This is a line editing library. It can be linked into almost any program to
|
This is a line editing library. It can be linked into almost any program to
|
||||||
provide command-line editing and history. It is call-compatible with the FSF
|
provide command-line editing and history.
|
||||||
readline library, but is a fraction of the size (and offers fewer features).
|
|
||||||
|
|
||||||
The editline library was created by Simmule Turner and Rich Salz back in 1992.
|
It is call-compatible with the FSF readline library, but it is a fraction of
|
||||||
At the time they chose to distribute the code under a "C News-like" copyright,
|
the size (and offers fewer features). It does not use standard I/O. It is
|
||||||
see the file LICENSE for details.
|
distributed under a "C News-like" copyright, see the file LICENSE for details.
|
||||||
|
|
||||||
The small size (<30k), lack of dependencies (no ncurses needed!) and the free
|
|
||||||
license should make this library interesting to many embedded developers.
|
|
||||||
|
|
||||||
Configuration is made by supplying different options to the GNU configure
|
Configuration is made by supplying different options to the GNU configure
|
||||||
script. In the examples/ directory you can find some small code snippets used
|
script. In the examples/ directory you can find some small code snippets
|
||||||
for testing.
|
used for testing.
|
||||||
|
|
||||||
This version of the editline library is a fork off the Minix3 sources. Other
|
Before finding out about the Debian version I was on the lookout for a really
|
||||||
know versions, often based off of the original comp.sources.unix posting are:
|
small replacement for the GNU readline package. Not only was libreadline large
|
||||||
|
and GPL:ed (instead of LGPL:ed), it also depends on libncurses, the resulting
|
||||||
|
size was a bit too much for my embedded system. I eventually stubmled upon the
|
||||||
|
BSD libedit library, which was sufficient for a while, even though it too
|
||||||
|
depends on libncurses. I searched my soul and went back to where I, back in
|
||||||
|
1996, started out -- Minix. And there it was, a really small readline
|
||||||
|
replacement!
|
||||||
|
|
||||||
* Debian libeditline, http://packages.qa.debian.org/e/editline.html
|
In 2000 Jim Studt packaged libeditline for Debian[1], the exact origin of the
|
||||||
* Heimdal, http://www.h5l.org
|
Debian code base is unclear, see the Sid package[2] for details. There were
|
||||||
* Festival speech-tools, http://festvox.org/festival/
|
some notable differences between that version and the upstream Minix sources,
|
||||||
* Steve Tell's editline patches, http://www.cs.unc.edu/~tell/dist.html
|
all of which have now been merged here.
|
||||||
|
|
||||||
The most intersting patches and bug fixes from each fork have been merged here.
|
|
||||||
Outstanding issues are listed in the TODO file.
|
|
||||||
|
|
||||||
An explanation of the version numbering may be in order. I didn't know about
|
An explanation of the version numbering may be in order. I didn't know about
|
||||||
the Debian version for quite some time, so I kept a different name for the
|
the Debian version for quite some time, so I kept a different name for the
|
||||||
package and a different versioning scheme. In June 2009, I decided to line up
|
package and a different versioning scheme. In June 2009, I decided to line up
|
||||||
alongside Debian, with the intent of merging the efforts.
|
alongside Debian, with the intent of merging the efforts. Sorry for any
|
||||||
|
confusion this might cause.
|
||||||
|
|
||||||
Enjoy,
|
Enjoy,
|
||||||
Joachim Nilsson <troglobit()vmlinux!org>
|
Joachim Nilsson <troglobit()vmlinux!org>
|
||||||
|
|
||||||
|
[1] - http://lists.debian.org/debian-devel/2000/05/msg00548.html
|
||||||
|
[2] - http://packages.debian.org/sid/libeditline0
|
||||||
|
|
||||||
|
32
TODO
32
TODO
@@ -1,35 +1,11 @@
|
|||||||
TODO -*-org-*-
|
TODO
|
||||||
|
|
||||||
Issues in need of work. Mostly compatibility with GNU readline, BSD libedit,
|
|
||||||
http://www.thrysoee.dk/editline/, and usability improvements.
|
|
||||||
|
|
||||||
Remember, the general idea is to keep Minix editline small.
|
|
||||||
|
|
||||||
* Verify for 1.14.0 that custom completion handlers still work
|
|
||||||
After reverting "fix" in 0.2.2 that made rl_complete() a function pointer we need to
|
|
||||||
make sure the same functionality is still available with the new infrastructure.
|
|
||||||
(Which is more inspired by BSD libedit and GNU readline.
|
|
||||||
|
|
||||||
* Investigate GNU readline dependencies needed for "fileman" example
|
|
||||||
The BSD libedit library has imported the GNU readline "fileman" example into its
|
|
||||||
tree to demonstrate the abilities of that library. This would also be quite useful
|
|
||||||
for Minix editline.
|
|
||||||
|
|
||||||
The first task is to investigate the depependencies and form TODO list items
|
|
||||||
detailing what is missing and, if possible, proposals how to implement including any
|
|
||||||
optional configure flags.
|
|
||||||
|
|
||||||
* Instead of supporting multiline input, try the Emacs approach, line scrolling.
|
|
||||||
|
|
||||||
* Add support for rl_bind_key(), currently only en editline specific el_bind_key() exists.
|
|
||||||
|
|
||||||
|
* Port "fileman" example from BSD libedit, http://www.thrysoee.dk/editline/
|
||||||
|
* Add support for rl_bind_key(), currently one needs to "hack" the Map[]
|
||||||
|
* Add support for inhibiting completion: rl_inhibit_completion
|
||||||
* Make "char *rl_prompt" globally visible.
|
* Make "char *rl_prompt" globally visible.
|
||||||
|
|
||||||
* Add support for rl_set_prompt().
|
* Add support for rl_set_prompt().
|
||||||
|
|
||||||
* Add support for --enable-utf8 to configure
|
* Add support for --enable-utf8 to configure
|
||||||
|
|
||||||
* Use strcmp(nl_langinfo(CODESET), "UTF-8") to look for utf8 capable terminal.
|
* Use strcmp(nl_langinfo(CODESET), "UTF-8") to look for utf8 capable terminal.
|
||||||
|
|
||||||
* Implement simple UTF-8 parser according to http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
* Implement simple UTF-8 parser according to http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
||||||
#undef CONFIG_SIGSTOP
|
#undef CONFIG_SIGSTOP
|
||||||
|
|
||||||
/* Define to skip duplicate lines in the scrollback history. */
|
/* Don't save command if same as last one. */
|
||||||
#undef CONFIG_UNIQUE_HISTORY
|
#undef CONFIG_UNIQUE_HISTORY
|
||||||
|
|
||||||
/* Define to use the termcap library for terminal size. */
|
/* Define to use the termcap library for terminal size. */
|
||||||
@@ -112,6 +112,12 @@
|
|||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Enable static keyword, hides internal methods. */
|
||||||
|
#undef HIDE
|
||||||
|
|
||||||
|
/* Number of lines in history. */
|
||||||
|
#undef HIST_SIZE
|
||||||
|
|
||||||
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
||||||
slash. */
|
slash. */
|
||||||
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
|
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||||
|
128
configure
vendored
128
configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.65 for editline 1.14.0.
|
# Generated by GNU Autoconf 2.65 for editline 1.14.0-rc1.
|
||||||
#
|
#
|
||||||
# Report bugs to <troglobit@vmlinux.org>.
|
# Report bugs to <troglobit@vmlinux.org>.
|
||||||
#
|
#
|
||||||
@@ -701,8 +701,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='editline'
|
PACKAGE_NAME='editline'
|
||||||
PACKAGE_TARNAME='editline'
|
PACKAGE_TARNAME='editline'
|
||||||
PACKAGE_VERSION='1.14.0'
|
PACKAGE_VERSION='1.14.0-rc1'
|
||||||
PACKAGE_STRING='editline 1.14.0'
|
PACKAGE_STRING='editline 1.14.0-rc1'
|
||||||
PACKAGE_BUGREPORT='troglobit@vmlinux.org'
|
PACKAGE_BUGREPORT='troglobit@vmlinux.org'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
@@ -748,6 +748,8 @@ am__EXEEXT_TRUE
|
|||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
TERMLIBS
|
TERMLIBS
|
||||||
AM_CFLAGS
|
AM_CFLAGS
|
||||||
|
CONFIG_DEFAULT_COMPLETE_FALSE
|
||||||
|
CONFIG_DEFAULT_COMPLETE_TRUE
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
CPP
|
CPP
|
||||||
OTOOL64
|
OTOOL64
|
||||||
@@ -867,12 +869,13 @@ with_pic
|
|||||||
enable_fast_install
|
enable_fast_install
|
||||||
with_gnu_ld
|
with_gnu_ld
|
||||||
enable_libtool_lock
|
enable_libtool_lock
|
||||||
enable_unique_history
|
|
||||||
enable_default_complete
|
enable_default_complete
|
||||||
enable_arrow_keys
|
enable_arrow_keys
|
||||||
enable_sigstop
|
enable_sigstop
|
||||||
enable_terminal_bell
|
enable_terminal_bell
|
||||||
enable_termcap
|
enable_termcap
|
||||||
|
enable_history
|
||||||
|
enable_unique_history
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
host_alias
|
host_alias
|
||||||
@@ -1424,7 +1427,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures editline 1.14.0 to adapt to many kinds of systems.
|
\`configure' configures editline 1.14.0-rc1 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1494,7 +1497,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of editline 1.14.0:";;
|
short | recursive ) echo "Configuration of editline 1.14.0-rc1:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1511,15 +1514,13 @@ Optional Features:
|
|||||||
--enable-fast-install[=PKGS]
|
--enable-fast-install[=PKGS]
|
||||||
optimize for fast installation [default=yes]
|
optimize for fast installation [default=yes]
|
||||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||||
--disable-unique-history
|
--enable-default-complete Enable default completion handler.
|
||||||
Disable uniqify of scrollback. Default: duplicate
|
--enable-arrow-keys Enable ANSI arrow keys.
|
||||||
entries are ignored. Use this to save dupes.
|
|
||||||
--disable-default-complete
|
|
||||||
Disable default (filename) completion handler.
|
|
||||||
--disable-arrow-keys Disable ANSI arrow keys.
|
|
||||||
--enable-sigstop Enable SIGSTOP key.
|
--enable-sigstop Enable SIGSTOP key.
|
||||||
--enable-terminal-bell Enable terminal bell on completion.
|
--enable-terminal-bell Enable terminal bell on completion.
|
||||||
--enable-termcap Use termcap library to query terminal size.
|
--enable-termcap Use the termcap library for terminal size.
|
||||||
|
--enable-history=LINES Enable scrollback history, default off.
|
||||||
|
--enable-unique-history Uniqify scrollback history, i.e., don't save dupes.
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
@@ -1604,7 +1605,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
editline configure 1.14.0
|
editline configure 1.14.0-rc1
|
||||||
generated by GNU Autoconf 2.65
|
generated by GNU Autoconf 2.65
|
||||||
|
|
||||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
@@ -2029,7 +2030,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by editline $as_me 1.14.0, which was
|
It was created by editline $as_me 1.14.0-rc1, which was
|
||||||
generated by GNU Autoconf 2.65. Invocation command line was
|
generated by GNU Autoconf 2.65. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -2843,7 +2844,7 @@ fi
|
|||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='editline'
|
PACKAGE='editline'
|
||||||
VERSION='1.14.0'
|
VERSION='1.14.0-rc1'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
@@ -4561,13 +4562,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
|||||||
else
|
else
|
||||||
lt_cv_nm_interface="BSD nm"
|
lt_cv_nm_interface="BSD nm"
|
||||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||||
(eval echo "\"\$as_me:4564: $ac_compile\"" >&5)
|
(eval echo "\"\$as_me:4565: $ac_compile\"" >&5)
|
||||||
(eval "$ac_compile" 2>conftest.err)
|
(eval "$ac_compile" 2>conftest.err)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:4567: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
(eval echo "\"\$as_me:4568: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:4570: output\"" >&5)
|
(eval echo "\"\$as_me:4571: output\"" >&5)
|
||||||
cat conftest.out >&5
|
cat conftest.out >&5
|
||||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||||
lt_cv_nm_interface="MS dumpbin"
|
lt_cv_nm_interface="MS dumpbin"
|
||||||
@@ -5773,7 +5774,7 @@ ia64-*-hpux*)
|
|||||||
;;
|
;;
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 5776 "configure"' > conftest.$ac_ext
|
echo '#line 5777 "configure"' > conftest.$ac_ext
|
||||||
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
||||||
(eval $ac_compile) 2>&5
|
(eval $ac_compile) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
@@ -7303,11 +7304,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7306: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7307: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:7310: \$? = $ac_status" >&5
|
echo "$as_me:7311: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
@@ -7642,11 +7643,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7645: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7646: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:7649: \$? = $ac_status" >&5
|
echo "$as_me:7650: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
@@ -7747,11 +7748,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7750: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7751: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:7754: \$? = $ac_status" >&5
|
echo "$as_me:7755: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
@@ -7802,11 +7803,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7805: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7806: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:7809: \$? = $ac_status" >&5
|
echo "$as_me:7810: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
@@ -10186,7 +10187,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 10189 "configure"
|
#line 10190 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@@ -10282,7 +10283,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 10285 "configure"
|
#line 10286 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@@ -10907,6 +10908,9 @@ fi
|
|||||||
|
|
||||||
$as_echo "#define SYS_UNIX 1" >>confdefs.h
|
$as_echo "#define SYS_UNIX 1" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
|
$as_echo "#define HIDE 1" >>confdefs.h
|
||||||
|
|
||||||
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
|
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
|
||||||
if test "x$ac_cv_type_size_t" = x""yes; then :
|
if test "x$ac_cv_type_size_t" = x""yes; then :
|
||||||
|
|
||||||
@@ -11126,32 +11130,26 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-unique-history was given.
|
# Check whether --enable-default-complete was given.
|
||||||
if test "${enable_unique_history+set}" = set; then :
|
if test "${enable_default_complete+set}" = set; then :
|
||||||
enableval=$enable_unique_history;
|
enableval=$enable_default_complete; complete=true;
|
||||||
else
|
$as_echo "#define CONFIG_DEFAULT_COMPLETE /**/" >>confdefs.h
|
||||||
|
|
||||||
$as_echo "#define CONFIG_UNIQUE_HISTORY 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x$complete = xtrue; then
|
||||||
# Check whether --enable-default-complete was given.
|
CONFIG_DEFAULT_COMPLETE_TRUE=
|
||||||
if test "${enable_default_complete+set}" = set; then :
|
CONFIG_DEFAULT_COMPLETE_FALSE='#'
|
||||||
enableval=$enable_default_complete;
|
|
||||||
else
|
else
|
||||||
|
CONFIG_DEFAULT_COMPLETE_TRUE='#'
|
||||||
$as_echo "#define CONFIG_DEFAULT_COMPLETE 1" >>confdefs.h
|
CONFIG_DEFAULT_COMPLETE_FALSE=
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-arrow-keys was given.
|
# Check whether --enable-arrow-keys was given.
|
||||||
if test "${enable_arrow_keys+set}" = set; then :
|
if test "${enable_arrow_keys+set}" = set; then :
|
||||||
enableval=$enable_arrow_keys;
|
enableval=$enable_arrow_keys;
|
||||||
else
|
$as_echo "#define CONFIG_ANSI_ARROWS /**/" >>confdefs.h
|
||||||
|
|
||||||
$as_echo "#define CONFIG_ANSI_ARROWS 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -11159,7 +11157,7 @@ fi
|
|||||||
# Check whether --enable-sigstop was given.
|
# Check whether --enable-sigstop was given.
|
||||||
if test "${enable_sigstop+set}" = set; then :
|
if test "${enable_sigstop+set}" = set; then :
|
||||||
enableval=$enable_sigstop;
|
enableval=$enable_sigstop;
|
||||||
$as_echo "#define CONFIG_SIGSTOP 1" >>confdefs.h
|
$as_echo "#define CONFIG_SIGSTOP /**/" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -11167,7 +11165,7 @@ fi
|
|||||||
# Check whether --enable-terminal-bell was given.
|
# Check whether --enable-terminal-bell was given.
|
||||||
if test "${enable_terminal_bell+set}" = set; then :
|
if test "${enable_terminal_bell+set}" = set; then :
|
||||||
enableval=$enable_terminal_bell;
|
enableval=$enable_terminal_bell;
|
||||||
$as_echo "#define CONFIG_ANNOYING_NOISE 1" >>confdefs.h
|
$as_echo "#define CONFIG_ANNOYING_NOISE /**/" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -11175,7 +11173,31 @@ fi
|
|||||||
# Check whether --enable-termcap was given.
|
# Check whether --enable-termcap was given.
|
||||||
if test "${enable_termcap+set}" = set; then :
|
if test "${enable_termcap+set}" = set; then :
|
||||||
enableval=$enable_termcap;
|
enableval=$enable_termcap;
|
||||||
$as_echo "#define CONFIG_USE_TERMCAP 1" >>confdefs.h
|
$as_echo "#define CONFIG_USE_TERMCAP /**/" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Default history size 1, i.e. disabled.
|
||||||
|
let HIST_SIZE=1
|
||||||
|
# Check whether --enable-history was given.
|
||||||
|
if test "${enable_history+set}" = set; then :
|
||||||
|
enableval=$enable_history; let HIST_SIZE=$enableval
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $HIST_SIZE -lt 1; then
|
||||||
|
let HIST_SIZE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HIST_SIZE $HIST_SIZE
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-unique-history was given.
|
||||||
|
if test "${enable_unique_history+set}" = set; then :
|
||||||
|
enableval=$enable_unique_history;
|
||||||
|
$as_echo "#define CONFIG_UNIQUE_HISTORY /**/" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -11512,6 +11534,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
|
|||||||
as_fn_error "conditional \"am__fastdepCC\" was never defined.
|
as_fn_error "conditional \"am__fastdepCC\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
if test -z "${CONFIG_DEFAULT_COMPLETE_TRUE}" && test -z "${CONFIG_DEFAULT_COMPLETE_FALSE}"; then
|
||||||
|
as_fn_error "conditional \"CONFIG_DEFAULT_COMPLETE\" was never defined.
|
||||||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
: ${CONFIG_STATUS=./config.status}
|
: ${CONFIG_STATUS=./config.status}
|
||||||
ac_write_fail=0
|
ac_write_fail=0
|
||||||
@@ -11920,7 +11946,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by editline $as_me 1.14.0, which was
|
This file was extended by editline $as_me 1.14.0-rc1, which was
|
||||||
generated by GNU Autoconf 2.65. Invocation command line was
|
generated by GNU Autoconf 2.65. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -11986,7 +12012,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
editline config.status 1.14.0
|
editline config.status 1.14.0-rc1
|
||||||
configured by $0, generated by GNU Autoconf 2.65,
|
configured by $0, generated by GNU Autoconf 2.65,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
43
configure.ac
43
configure.ac
@@ -13,7 +13,7 @@
|
|||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.61)
|
||||||
AC_INIT(editline, 1.14.0, troglobit@vmlinux.org)
|
AC_INIT(editline, 1.14.0-rc1, troglobit@vmlinux.org)
|
||||||
AC_CONFIG_SRCDIR([src/editline.c])
|
AC_CONFIG_SRCDIR([src/editline.c])
|
||||||
AC_CONFIG_HEADER([config.h])
|
AC_CONFIG_HEADER([config.h])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
@@ -43,6 +43,7 @@ AC_HEADER_TIOCGWINSZ
|
|||||||
|
|
||||||
# Overrides and types, should be a check.
|
# Overrides and types, should be a check.
|
||||||
AC_DEFINE([SYS_UNIX], [1], [Default to UNIX backend, should be detected.])
|
AC_DEFINE([SYS_UNIX], [1], [Default to UNIX backend, should be detected.])
|
||||||
|
AC_DEFINE([HIDE], [1], [Enable static keyword, hides internal methods.])
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
@@ -51,30 +52,40 @@ AC_PROG_GCC_TRADITIONAL
|
|||||||
AC_FUNC_STAT
|
AC_FUNC_STAT
|
||||||
AC_CHECK_FUNCS([strchr strdup strrchr tcgetattr perror])
|
AC_CHECK_FUNCS([strchr strdup strrchr tcgetattr perror])
|
||||||
|
|
||||||
AC_ARG_ENABLE(unique-history,
|
|
||||||
[AS_HELP_STRING([--disable-unique-history],
|
|
||||||
[Disable uniqify of scrollback. Default: duplicate entries are ignored. Use this to save dupes.])],
|
|
||||||
, AC_DEFINE(CONFIG_UNIQUE_HISTORY, 1, [Define to skip duplicate lines in the scrollback history.]))
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(default-complete,
|
AC_ARG_ENABLE(default-complete,
|
||||||
[AS_HELP_STRING([--disable-default-complete], [Disable default (filename) completion handler.])],
|
[ --enable-default-complete Enable default completion handler.],
|
||||||
, AC_DEFINE(CONFIG_DEFAULT_COMPLETE, 1, [Define to enable the default completion handler.]))
|
complete=true; AC_DEFINE(CONFIG_DEFAULT_COMPLETE,, [Define to enable the default completion handler.]))
|
||||||
|
AM_CONDITIONAL([CONFIG_DEFAULT_COMPLETE], [test x$complete = xtrue])
|
||||||
|
|
||||||
AC_ARG_ENABLE(arrow-keys,
|
AC_ARG_ENABLE(arrow-keys,
|
||||||
[AS_HELP_STRING([--disable-arrow-keys], [Disable ANSI arrow keys.])],
|
[ --enable-arrow-keys Enable ANSI arrow keys.],
|
||||||
, AC_DEFINE(CONFIG_ANSI_ARROWS, 1, [Define to include ANSI arrow keys support.]))
|
AC_DEFINE([CONFIG_ANSI_ARROWS],, [Define to include ANSI arrow keys support.]))
|
||||||
|
|
||||||
AC_ARG_ENABLE(sigstop,
|
AC_ARG_ENABLE(sigstop,
|
||||||
[AS_HELP_STRING([--enable-sigstop], [Enable SIGSTOP key.])],
|
[ --enable-sigstop Enable SIGSTOP key.],
|
||||||
AC_DEFINE([CONFIG_SIGSTOP], 1, [Define to enable SIGSTOP (Ctrl-Z) key.]))
|
AC_DEFINE([CONFIG_SIGSTOP],, [Define to enable SIGSTOP (Ctrl-Z) key.]))
|
||||||
|
|
||||||
AC_ARG_ENABLE(terminal-bell,
|
AC_ARG_ENABLE(terminal-bell,
|
||||||
[AS_HELP_STRING([--enable-terminal-bell], [Enable terminal bell on completion.])],
|
[ --enable-terminal-bell Enable terminal bell on completion.],
|
||||||
AC_DEFINE([CONFIG_ANNOYING_NOISE], 1, [Define to enable terminal bell on completion.]))
|
AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.]))
|
||||||
|
|
||||||
AC_ARG_ENABLE(termcap,
|
AC_ARG_ENABLE(termcap,
|
||||||
[AS_HELP_STRING([--enable-termcap], [Use termcap library to query terminal size.])],
|
[ --enable-termcap Use the termcap library for terminal size.],
|
||||||
AC_DEFINE([CONFIG_USE_TERMCAP], 1, [Define to use the termcap library for terminal size.]))
|
AC_DEFINE([CONFIG_USE_TERMCAP],, [Define to use the termcap library for terminal size.]))
|
||||||
|
|
||||||
|
# Default history size 1, i.e. disabled.
|
||||||
|
let HIST_SIZE=1
|
||||||
|
AC_ARG_ENABLE(history,
|
||||||
|
[ --enable-history=LINES Enable scrollback history, default off.],
|
||||||
|
let HIST_SIZE=$enableval)
|
||||||
|
if test $HIST_SIZE -lt 1; then
|
||||||
|
let HIST_SIZE=1
|
||||||
|
fi
|
||||||
|
AC_DEFINE_UNQUOTED(HIST_SIZE, $HIST_SIZE, [Number of lines in history.])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(unique-history,
|
||||||
|
[ --enable-unique-history Uniqify scrollback history, i.e., don't save dupes.],
|
||||||
|
AC_DEFINE([CONFIG_UNIQUE_HISTORY],, [Don't save command if same as last one.]))
|
||||||
|
|
||||||
# Restore gnu89 inline semantics on gcc 4.3 and newer
|
# Restore gnu89 inline semantics on gcc 4.3 and newer
|
||||||
saved_cflags="$CFLAGS"
|
saved_cflags="$CFLAGS"
|
||||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,9 +1,3 @@
|
|||||||
editline (1.14.0-1) unstable; urgency=low
|
|
||||||
|
|
||||||
* Update to new configure based build.
|
|
||||||
|
|
||||||
-- Joachim Nilsson <joachim.nilsson@vmlinux.org> Wed, 11 Aug 2010 13:28:00 +0100
|
|
||||||
|
|
||||||
editline (1.12-6) unstable; urgency=low
|
editline (1.12-6) unstable; urgency=low
|
||||||
|
|
||||||
* Switch package format to 3.0 (quilt).
|
* Switch package format to 3.0 (quilt).
|
||||||
|
1
debian/editline1.files
vendored
Normal file
1
debian/editline1.files
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
usr/lib/*.so.*
|
4
debian/libeditline-dev.install
vendored
4
debian/libeditline-dev.install
vendored
@@ -1,4 +0,0 @@
|
|||||||
usr/include
|
|
||||||
usr/lib/libeditline*.*a
|
|
||||||
usr/lib/libeditline*.so
|
|
||||||
usr/share/man/man3
|
|
1
debian/libeditline0.install
vendored
1
debian/libeditline0.install
vendored
@@ -1 +0,0 @@
|
|||||||
usr/lib/libeditline*.so.*
|
|
33
debian/rules
vendored
33
debian/rules
vendored
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
# debian/rules for libeditline
|
# Sample debian/rules that uses debhelper.
|
||||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
# Uncomment this to turn on verbose mode.
|
||||||
@@ -12,12 +12,14 @@ major=0
|
|||||||
build: build-stamp
|
build: build-stamp
|
||||||
build-stamp:
|
build-stamp:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_auto_configure
|
$(MAKE)
|
||||||
dh_auto_build
|
touch build-stamp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_auto_clean
|
dh_testroot
|
||||||
|
rm -f build-stamp
|
||||||
|
[ ! -f Makefile ] || $(MAKE) clean
|
||||||
dh_clean
|
dh_clean
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
@@ -25,18 +27,29 @@ install: build
|
|||||||
dh_testroot
|
dh_testroot
|
||||||
dh_clean -k
|
dh_clean -k
|
||||||
dh_installdirs
|
dh_installdirs
|
||||||
dh_auto_install
|
$(MAKE) install DESTDIR=`pwd`/debian/libeditline-dev
|
||||||
|
cp include_editline.h \
|
||||||
|
`pwd`/debian/libeditline-dev/usr/include/editline.h
|
||||||
|
|
||||||
binary-indep: install
|
binary-indep: build install
|
||||||
|
|
||||||
# build libeditline${major} package by moving files from editline-dev
|
binary-arch: build install
|
||||||
binary-arch: install
|
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
dh_auto_install
|
# build libeditline${major} package by moving files from editline-dev
|
||||||
dh_install --sourcedir=debian/tmp
|
dh_movefiles --sourcedir=debian/libeditline-dev \
|
||||||
|
-plibeditline$(major) \
|
||||||
|
usr/lib/libeditline.so.$(major) \
|
||||||
|
usr/lib/libeditline.so.$(version)
|
||||||
dh_installdocs
|
dh_installdocs
|
||||||
|
dh_installexamples
|
||||||
|
dh_installmenu
|
||||||
|
dh_installmanpages
|
||||||
|
rm -rf debian/libeditline0/usr/share/man/
|
||||||
|
dh_installcron
|
||||||
|
dh_installinfo
|
||||||
dh_installchangelogs
|
dh_installchangelogs
|
||||||
|
dh_link
|
||||||
dh_strip
|
dh_strip
|
||||||
dh_compress
|
dh_compress
|
||||||
dh_fixperms
|
dh_fixperms
|
||||||
|
@@ -3,4 +3,4 @@ AUTOMAKE_OPTIONS = foreign
|
|||||||
noinst_PROGRAMS = testit cli
|
noinst_PROGRAMS = testit cli
|
||||||
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||||
AM_LDFLAGS = -static
|
|
||||||
|
@@ -210,7 +210,6 @@ top_builddir = @top_builddir@
|
|||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||||
AM_LDFLAGS = -static
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@@ -22,8 +22,6 @@
|
|||||||
#include "editline.h"
|
#include "editline.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define HISTORY "/tmp/.cli-history"
|
|
||||||
|
|
||||||
static char *list[] = {
|
static char *list[] = {
|
||||||
"foo ", "bar ", "bsd ", "cli ", "ls ", "cd ", "malloc ", "tee ", NULL
|
"foo ", "bar ", "bsd ", "cli ", "ls ", "cd ", "malloc ", "tee ", NULL
|
||||||
};
|
};
|
||||||
@@ -80,28 +78,6 @@ static int my_rl_list_possib(char *token, char ***av)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
el_status_t list_possible(void)
|
|
||||||
{
|
|
||||||
char **av;
|
|
||||||
char *word;
|
|
||||||
int ac;
|
|
||||||
|
|
||||||
word = el_find_word();
|
|
||||||
ac = rl_list_possib(word, &av);
|
|
||||||
if (word)
|
|
||||||
free(word);
|
|
||||||
if (ac) {
|
|
||||||
el_print_columns(ac, av);
|
|
||||||
while (--ac >= 0)
|
|
||||||
free(av[ac]);
|
|
||||||
free(av);
|
|
||||||
|
|
||||||
return CSmove;
|
|
||||||
}
|
|
||||||
|
|
||||||
return el_ring_bell();
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int ac __attribute__ ((unused)), char *av[] __attribute__ ((unused)))
|
int main(int ac __attribute__ ((unused)), char *av[] __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
@@ -110,15 +86,11 @@ int main(int ac __attribute__ ((unused)), char *av[] __attribute__ ((unused)))
|
|||||||
/* Setup callbacks */
|
/* Setup callbacks */
|
||||||
rl_set_complete_func(&my_rl_complete);
|
rl_set_complete_func(&my_rl_complete);
|
||||||
rl_set_list_possib_func(&my_rl_list_possib);
|
rl_set_list_possib_func(&my_rl_list_possib);
|
||||||
el_bind_key('?', list_possible);
|
|
||||||
read_history(HISTORY);
|
|
||||||
|
|
||||||
while ((line = readline(prompt)) != NULL) {
|
while ((line = readline(prompt)) != NULL) {
|
||||||
printf("\t\t\t|%s|\n", line);
|
printf("\t\t\t|%s|\n", line);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_history(HISTORY);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -27,55 +27,31 @@ typedef enum {
|
|||||||
} el_status_t;
|
} el_status_t;
|
||||||
|
|
||||||
/* Editline specific types, despite rl_ prefix. From Heimdal project. */
|
/* Editline specific types, despite rl_ prefix. From Heimdal project. */
|
||||||
typedef char* rl_complete_func_t(char*, int*);
|
typedef char* (*rl_complete_func_t)(char*, int*);
|
||||||
typedef int rl_list_possib_func_t(char*, char***);
|
typedef int (*rl_list_possib_func_t)(char*, char***);
|
||||||
typedef el_status_t el_keymap_func_t(void);
|
typedef el_status_t (*el_keymap_func_t)(void);
|
||||||
typedef int rl_hook_func_t(void);
|
|
||||||
typedef int rl_getc_func_t(void);
|
|
||||||
typedef void rl_voidfunc_t(void);
|
|
||||||
typedef void rl_vintfunc_t(int);
|
|
||||||
|
|
||||||
/* Display 8-bit chars "as-is" or as `M-x'? Toggle with M-m. (Default:0 - "as-is") */
|
/* Display 8-bit chars "as-is" or as `M-x'? Toggle with M-m. (Default:0 - "as-is") */
|
||||||
extern int rl_meta_chars;
|
extern int rl_meta_chars;
|
||||||
|
|
||||||
|
/* Use these functions to set custom command/file completion, see cli.c for example usage. */
|
||||||
|
rl_complete_func_t rl_set_complete_func(rl_complete_func_t func);
|
||||||
|
rl_list_possib_func_t rl_set_list_possib_func(rl_list_possib_func_t func);
|
||||||
|
|
||||||
/* Editline specific functions. */
|
/* Editline specific functions. */
|
||||||
extern char * el_find_word(void);
|
void el_bind_key_in_metamap(char c, el_keymap_func_t func);
|
||||||
extern void el_print_columns(int ac, char **av);
|
|
||||||
extern el_status_t el_ring_bell(void);
|
|
||||||
|
|
||||||
extern void el_bind_key(int key, el_keymap_func_t function);
|
|
||||||
extern void el_bind_key_in_metamap(int key, el_keymap_func_t function);
|
|
||||||
|
|
||||||
extern char *rl_complete(char *token, int *match);
|
|
||||||
extern int rl_list_possib(char *token, char ***av);
|
|
||||||
|
|
||||||
/* For compatibility with FSF readline. */
|
/* For compatibility with FSF readline. */
|
||||||
extern int rl_point;
|
extern int rl_point;
|
||||||
extern int rl_mark;
|
extern int rl_mark;
|
||||||
extern int rl_end;
|
extern int rl_end;
|
||||||
extern int rl_inhibit_complete;
|
|
||||||
extern char *rl_line_buffer;
|
extern char *rl_line_buffer;
|
||||||
extern const char *rl_readline_name;
|
extern const char *rl_readline_name;
|
||||||
extern FILE *rl_instream; /* The stdio stream from which input is read. Defaults to stdin if NULL - Not supported yet! */
|
|
||||||
extern FILE *rl_outstream; /* The stdio stream to which output is flushed. Defaults to stdout if NULL - Not supported yet! */
|
|
||||||
extern int el_no_echo; /* e.g under emacs, don't echo except prompt */
|
extern int el_no_echo; /* e.g under emacs, don't echo except prompt */
|
||||||
extern int el_hist_size; /* size of history scrollback buffer, default: 15 */
|
extern void rl_reset_terminal(char *p);
|
||||||
|
|
||||||
extern void rl_initialize(void);
|
extern void rl_initialize(void);
|
||||||
extern void rl_reset_terminal(const char *terminal_name);
|
|
||||||
|
|
||||||
extern char *readline(const char *prompt);
|
extern char *readline(const char *prompt);
|
||||||
extern void add_history(const char *line);
|
extern void add_history(char *line); /* OBSOLETE: Made part of readline(). -- kjb */
|
||||||
|
|
||||||
extern int read_history(const char *filename);
|
|
||||||
extern int write_history(const char *filename);
|
|
||||||
|
|
||||||
rl_complete_func_t *rl_set_complete_func(rl_complete_func_t *func);
|
|
||||||
rl_list_possib_func_t *rl_set_list_possib_func(rl_list_possib_func_t *func);
|
|
||||||
|
|
||||||
void rl_prep_terminal(int meta_flag);
|
|
||||||
void rl_deprep_terminal(void);
|
|
||||||
|
|
||||||
int rl_getc(void);
|
|
||||||
|
|
||||||
#endif /* __EDITLINE_H__ */
|
#endif /* __EDITLINE_H__ */
|
||||||
|
100
man/editline.3
100
man/editline.3
@@ -3,43 +3,54 @@
|
|||||||
editline \- command-line editing library with history
|
editline \- command-line editing library with history
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B "char *readline(char *prompt);"
|
.B "char *"
|
||||||
|
.B "readline(prompt)"
|
||||||
|
.B " char *prompt;"
|
||||||
|
|
||||||
|
.B "void"
|
||||||
|
.B "add_history(line)"
|
||||||
|
.B " char *line;"
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Editline
|
.I Editline
|
||||||
is a library that provides an line-editing interface with history.
|
is a library that provides an line-editing interface with text recall.
|
||||||
It is intended to be functionally equivalent with the
|
It is intended to be compatible with the
|
||||||
.I readline
|
.I readline
|
||||||
library provided by the Free Software Foundation, but much smaller.
|
library provided by the Free Software Foundation, but much smaller.
|
||||||
The bulk of this manual page describes the user interface.
|
The bulk of this manual page describes the user interface.
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
.I readline()
|
.I readline
|
||||||
function displays the given
|
routine returns a line of text with the trailing newline removed.
|
||||||
.I prompt
|
The data is returned in a buffer allocated with
|
||||||
on stdout, waits for user input on stdin and then
|
|
||||||
returns a line of text with the trailing newline removed. The data is returned in a
|
|
||||||
buffer allocated with
|
|
||||||
.IR malloc (3),
|
.IR malloc (3),
|
||||||
so the space should be released with
|
so the space should be released with
|
||||||
.IR free (3)
|
.IR free (3)
|
||||||
when the calling program is done with it.
|
when the calling program is done with it.
|
||||||
|
Before accepting input from the user, the specified
|
||||||
|
.I prompt
|
||||||
|
is displayed on the terminal.
|
||||||
.PP
|
.PP
|
||||||
Each line returned is copied to the internal history list, unless it happens
|
Each line returned is copied to the internal history list, unless it happens
|
||||||
to be equal to the previous line. This is configurable if you are building editline
|
to be equal to the previous line.
|
||||||
from source.
|
|
||||||
.SS "User Interface"
|
.SS "User Interface"
|
||||||
A program that uses this library provides a simple emacs-like editing interface to
|
A program that uses this library provides a simple emacs-like editing
|
||||||
its users. A line may be edited before it is sent to the calling program by typing
|
interface to its users.
|
||||||
either control characters or escape sequences. A control character, shown as a caret
|
A line may be edited before it is sent to the calling program by typing either
|
||||||
followed by a letter, is typed by holding down the ``control'' key while the letter
|
control characters or escape sequences.
|
||||||
is typed. For example, ``^A'' is a control-A. An escape sequence is entered by
|
A control character, shown as a caret followed by a letter, is typed by
|
||||||
typing the ``escape'' key followed by one or more characters. The escape key is
|
holding down the ``control'' key while the letter is typed.
|
||||||
abbreviated as ``ESC''. Note that unlike control keys, case matters in escape
|
For example, ``^A'' is a control-A.
|
||||||
sequences; ``ESC\ F'' is not the same as ``ESC\ f''.
|
An escape sequence is entered by typing the ``escape'' key followed by one or
|
||||||
|
more characters.
|
||||||
|
The escape key is abbreviated as ``ESC''.
|
||||||
|
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
|
||||||
|
is not the same as ``ESC\ f''.
|
||||||
.PP
|
.PP
|
||||||
An editing command may be typed anywhere on the line, not just at the beginning. In
|
An editing command may be typed anywhere on the line, not just at the
|
||||||
addition, a return may also be typed anywhere on the line, not just at the end.
|
beginning.
|
||||||
|
In addition, a return may also be typed anywhere on the line, not just at
|
||||||
|
the end.
|
||||||
.PP
|
.PP
|
||||||
Most editing commands may be given a repeat count,
|
Most editing commands may be given a repeat count,
|
||||||
.IR n ,
|
.IR n ,
|
||||||
@@ -70,8 +81,8 @@ The following control characters are accepted:
|
|||||||
^M Done with line (alternate return key)
|
^M Done with line (alternate return key)
|
||||||
^N Get next line from history [n]
|
^N Get next line from history [n]
|
||||||
^P Get previous line from history [n]
|
^P Get previous line from history [n]
|
||||||
^R Search backward (forward if [n]) through history for
|
^R Search backward (forward if [n]) through history for text;
|
||||||
\& text; must start line if text begins with an uparrow
|
\& must start line if text begins with an uparrow
|
||||||
^T Transpose characters
|
^T Transpose characters
|
||||||
^V Insert next character, even if it is an edit command
|
^V Insert next character, even if it is an edit command
|
||||||
^W Wipe to the mark
|
^W Wipe to the mark
|
||||||
@@ -98,8 +109,7 @@ ESC\ b Move backward a word [n]
|
|||||||
ESC\ d Delete word under cursor [n]
|
ESC\ d Delete word under cursor [n]
|
||||||
ESC\ f Move forward a word [n]
|
ESC\ f Move forward a word [n]
|
||||||
ESC\ l Make word lowercase [n]
|
ESC\ l Make word lowercase [n]
|
||||||
ESC\ m Toggle if 8bit chars display normally or with an
|
ESC\ m Toggle if 8bit chars display normally or with ``M\-'' prefix
|
||||||
\& ``M\-'' prefix
|
|
||||||
ESC\ u Make word uppercase [n]
|
ESC\ u Make word uppercase [n]
|
||||||
ESC\ y Yank back last killed text
|
ESC\ y Yank back last killed text
|
||||||
ESC\ v Show library version
|
ESC\ v Show library version
|
||||||
@@ -154,41 +164,11 @@ for you:
|
|||||||
.RE
|
.RE
|
||||||
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
||||||
is shown in italics.
|
is shown in italics.
|
||||||
|
|
||||||
.SH "USAGE"
|
|
||||||
To include
|
|
||||||
.I readline()
|
|
||||||
in your program, simply call it as you do any other function. Just make sure to link
|
|
||||||
your program with libeditline.
|
|
||||||
|
|
||||||
.SS "Example"
|
|
||||||
The following brief example lets you enter a line and edit it, then displays it.
|
|
||||||
|
|
||||||
.nf
|
|
||||||
.B "#include <stdlib.h>"
|
|
||||||
.B ""
|
|
||||||
.B "extern char *readline(char *prompt);"
|
|
||||||
.B ""
|
|
||||||
.B "int main (void)"
|
|
||||||
.B "{"
|
|
||||||
.B " char *p;"
|
|
||||||
.B ""
|
|
||||||
.B " while ((p = readline(``CLI> '')) != NULL) {"
|
|
||||||
.B " printf(\"%s\n\", p);"
|
|
||||||
.B " free(p);"
|
|
||||||
.B " }"
|
|
||||||
.B ""
|
|
||||||
.B " return 0;"
|
|
||||||
.B "}"
|
|
||||||
.fi
|
|
||||||
|
|
||||||
.SH "BUGS AND LIMITATIONS"
|
.SH "BUGS AND LIMITATIONS"
|
||||||
Doesn't know how to handle multiple lines or unicode characters well. See the TODO
|
Doesn't know how to handle multiple lines.
|
||||||
file in the distribution if you want to help out.
|
|
||||||
|
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
The original editline library was created by Simmule R. Turner and Rich $alz. It is
|
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
|
||||||
now maintained in several forks: Heimdal, Festival speech tools, Mozilla, Google
|
and Rich $alz <rsalz@osf.org>.
|
||||||
Gadgets for Linux, and many other places. The original manual page was made by DaviD
|
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
|
||||||
W. Sanderson. This version was made by Joachim Nilsson <troglobit@gmail.com>.
|
|
||||||
|
|
||||||
|
.\" $PchId: editline.3,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
lib_LTLIBRARIES = libeditline.la
|
lib_LTLIBRARIES = libeditline.la
|
||||||
libeditline_la_SOURCES = editline.c editline.h complete.c sysunix.c unix.h
|
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h
|
||||||
|
if CONFIG_DEFAULT_COMPLETE
|
||||||
|
# Built-in completion handler.
|
||||||
|
libeditline_la_SOURCES += complete.c
|
||||||
|
endif
|
||||||
|
@@ -34,6 +34,8 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
|
# Built-in completion handler.
|
||||||
|
@CONFIG_DEFAULT_COMPLETE_TRUE@am__append_1 = complete.c
|
||||||
subdir = src
|
subdir = src
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@@ -71,7 +73,10 @@ am__base_list = \
|
|||||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
libeditline_la_LIBADD =
|
libeditline_la_LIBADD =
|
||||||
am_libeditline_la_OBJECTS = editline.lo complete.lo sysunix.lo
|
am__libeditline_la_SOURCES_DIST = editline.c editline.h sysunix.c \
|
||||||
|
unix.h complete.c
|
||||||
|
@CONFIG_DEFAULT_COMPLETE_TRUE@am__objects_1 = complete.lo
|
||||||
|
am_libeditline_la_OBJECTS = editline.lo sysunix.lo $(am__objects_1)
|
||||||
libeditline_la_OBJECTS = $(am_libeditline_la_OBJECTS)
|
libeditline_la_OBJECTS = $(am_libeditline_la_OBJECTS)
|
||||||
AM_V_lt = $(am__v_lt_$(V))
|
AM_V_lt = $(am__v_lt_$(V))
|
||||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||||
@@ -103,7 +108,7 @@ AM_V_GEN = $(am__v_GEN_$(V))
|
|||||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||||
am__v_GEN_0 = @echo " GEN " $@;
|
am__v_GEN_0 = @echo " GEN " $@;
|
||||||
SOURCES = $(libeditline_la_SOURCES)
|
SOURCES = $(libeditline_la_SOURCES)
|
||||||
DIST_SOURCES = $(libeditline_la_SOURCES)
|
DIST_SOURCES = $(am__libeditline_la_SOURCES_DIST)
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
@@ -223,7 +228,8 @@ top_builddir = @top_builddir@
|
|||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
lib_LTLIBRARIES = libeditline.la
|
lib_LTLIBRARIES = libeditline.la
|
||||||
libeditline_la_SOURCES = editline.c editline.h complete.c sysunix.c unix.h
|
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h \
|
||||||
|
$(am__append_1)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@@ -140,12 +140,12 @@ static int SplitPath(char *path, char **dirpart, char **filepart)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rl_complete_func_t *el_complete_func = NULL;
|
static rl_complete_func_t el_complete_func = NULL;
|
||||||
|
|
||||||
/* For compatibility with the Heimdal project. */
|
/* For compatibility with the Heimdal project. */
|
||||||
rl_complete_func_t *rl_set_complete_func(rl_complete_func_t *func)
|
rl_complete_func_t rl_set_complete_func(rl_complete_func_t func)
|
||||||
{
|
{
|
||||||
rl_complete_func_t *old = el_complete_func;
|
rl_complete_func_t old = el_complete_func;
|
||||||
el_complete_func = func;
|
el_complete_func = func;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
@@ -234,12 +234,12 @@ char *rl_complete(char *token, int *match)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static rl_list_possib_func_t *el_list_possib_func = NULL;
|
static rl_list_possib_func_t el_list_possib_func = NULL;
|
||||||
|
|
||||||
/* For compatibility with the Heimdal project. */
|
/* For compatibility with the Heimdal project. */
|
||||||
rl_list_possib_func_t *rl_set_list_possib_func(rl_list_possib_func_t *func)
|
rl_list_possib_func_t rl_set_list_possib_func(rl_list_possib_func_t func)
|
||||||
{
|
{
|
||||||
rl_list_possib_func_t *old = el_list_possib_func;
|
rl_list_possib_func_t old = el_list_possib_func;
|
||||||
el_list_possib_func = func;
|
el_list_possib_func = func;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
437
src/editline.c
437
src/editline.c
@@ -1,6 +1,7 @@
|
|||||||
/* Main editing routines for editline library.
|
/* Main editing routines for editline library.
|
||||||
*
|
*
|
||||||
* Copyright (c) 1992, 1993 Simmule Turner and Rich Salz. All rights reserved.
|
* Copyright (c) 1992, 1993 Simmule Turner and Rich Salz. All rights reserved.
|
||||||
|
* Copyright (c) 1998 Alan W. Black <awb()cstr!ed.ac!uk>, for Edinburgh Speech Tools.
|
||||||
*
|
*
|
||||||
* This software is not subject to any license of the American Telephone
|
* This software is not subject to any license of the American Telephone
|
||||||
* and Telegraph Company or of the Regents of the University of California.
|
* and Telegraph Company or of the Regents of the University of California.
|
||||||
@@ -29,8 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
#define SCREEN_COLS 80
|
#define SCREEN_COLS 80
|
||||||
#define SCREEN_ROWS 24
|
#define SCREEN_ROWS 24
|
||||||
#define EL_STDIN 0
|
|
||||||
#define EL_STDOUT 1
|
|
||||||
#define NO_ARG (-1)
|
#define NO_ARG (-1)
|
||||||
#define DEL 127
|
#define DEL 127
|
||||||
#define CTL(x) ((x) & 0x1F)
|
#define CTL(x) ((x) & 0x1F)
|
||||||
@@ -39,6 +38,9 @@
|
|||||||
#define META(x) ((x) | 0x80)
|
#define META(x) ((x) | 0x80)
|
||||||
#define ISMETA(x) ((x) & 0x80)
|
#define ISMETA(x) ((x) & 0x80)
|
||||||
#define UNMETA(x) ((x) & 0x7F)
|
#define UNMETA(x) ((x) & 0x7F)
|
||||||
|
#ifndef HIST_SIZE /* Default to one line history, i.e. disabled. */
|
||||||
|
#define HIST_SIZE 1
|
||||||
|
#endif
|
||||||
#define SEPS "\"#$&'()*:;<=>?[\\]^`{|}~\n\t "
|
#define SEPS "\"#$&'()*:;<=>?[\\]^`{|}~\n\t "
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -62,14 +64,9 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int Size;
|
int Size;
|
||||||
int Pos;
|
int Pos;
|
||||||
char **Lines;
|
char *Lines[HIST_SIZE];
|
||||||
} el_hist_t;
|
} el_hist_t;
|
||||||
|
|
||||||
rl_getc_func_t *rl_getc_function = rl_getc;
|
|
||||||
rl_hook_func_t *rl_event_hook;
|
|
||||||
rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
|
|
||||||
rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Globals.
|
** Globals.
|
||||||
*/
|
*/
|
||||||
@@ -82,46 +79,34 @@ int rl_quit;
|
|||||||
int rl_susp;
|
int rl_susp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int el_hist_size = 15;
|
|
||||||
static el_hist_t H = {
|
|
||||||
.Size = 0,
|
|
||||||
.Pos = 0,
|
|
||||||
.Lines = NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static char NILSTR[] = "";
|
static char NILSTR[] = "";
|
||||||
static const char *el_input = NILSTR;
|
static const char *el_input = NILSTR;
|
||||||
static char *Yanked;
|
static char *Yanked;
|
||||||
static char *Screen;
|
static char *Screen;
|
||||||
static char NEWLINE[]= CRLF;
|
static char NEWLINE[]= CRLF;
|
||||||
static const char *el_term = "dumb";
|
static el_hist_t H;
|
||||||
static int Repeat;
|
static int Repeat;
|
||||||
static int old_point;
|
static int old_point;
|
||||||
static int el_push_back;
|
static int el_push_back;
|
||||||
static int el_pushed;
|
static int el_pushed;
|
||||||
static int el_intr_pending;
|
static int el_intr_pending;
|
||||||
static int el_infd = EL_STDIN;
|
|
||||||
static int el_outfd = EL_STDOUT;
|
|
||||||
static el_keymap_t Map[];
|
static el_keymap_t Map[];
|
||||||
static el_keymap_t MetaMap[];
|
static el_keymap_t MetaMap[];
|
||||||
static size_t Length;
|
static size_t Length;
|
||||||
static size_t ScreenCount;
|
static size_t ScreenCount;
|
||||||
static size_t ScreenSize;
|
static size_t ScreenSize;
|
||||||
static char *backspace = "\b";
|
static char *backspace;
|
||||||
static int tty_cols = SCREEN_COLS;
|
static int tty_cols;
|
||||||
static int tty_rows = SCREEN_ROWS;
|
static int tty_rows;
|
||||||
|
|
||||||
int el_no_echo = 0; /* e.g., under Emacs */
|
int el_no_echo = 0; /* e.g., under Emacs */
|
||||||
int rl_point;
|
int rl_point;
|
||||||
int rl_mark;
|
int rl_mark;
|
||||||
int rl_end;
|
int rl_end;
|
||||||
int rl_meta_chars = 0; /* Display 8-bit chars as the actual char(0) or as `M-x'(1)? */
|
int rl_meta_chars = 0; /* Display 8-bit chars as the actual char(0) or as `M-x'(1)? */
|
||||||
int rl_inhibit_complete = 0;
|
|
||||||
char *rl_line_buffer;
|
char *rl_line_buffer;
|
||||||
const char *rl_prompt;
|
const char *rl_prompt;
|
||||||
const char *rl_readline_name;/* Set by calling program, for conditional parsing of ~/.inputrc - Not supported yet! */
|
const char *rl_readline_name;/* Set by calling program, for conditional parsing of ~/.inputrc - Not supported yet! */
|
||||||
FILE *rl_instream = NULL; /* The stdio stream from which input is read. Defaults to stdin if NULL */
|
|
||||||
FILE *rl_outstream = NULL; /* The stdio stream to which output is flushed. Defaults to stdout if NULL */
|
|
||||||
|
|
||||||
/* User definable callbacks. */
|
/* User definable callbacks. */
|
||||||
char **(*rl_attempted_completion_function)(const char *token, int start, int end);
|
char **(*rl_attempted_completion_function)(const char *token, int start, int end);
|
||||||
@@ -150,6 +135,16 @@ static int is_alpha_num(unsigned char c)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* http://www.utf8-chartable.de/unicode-utf8-table.pl */
|
||||||
|
int isutf8(unsigned char c)
|
||||||
|
{
|
||||||
|
if (c >= 0xC2 && c <= 0xCF)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** TTY input/output functions.
|
** TTY input/output functions.
|
||||||
*/
|
*/
|
||||||
@@ -160,7 +155,7 @@ static void tty_flush(void)
|
|||||||
|
|
||||||
if (ScreenCount) {
|
if (ScreenCount) {
|
||||||
if (!el_no_echo)
|
if (!el_no_echo)
|
||||||
res = write(el_outfd, Screen, ScreenCount);
|
res = write(1, Screen, ScreenCount);
|
||||||
ScreenCount = 0;
|
ScreenCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +177,15 @@ static void tty_puts(const char *p)
|
|||||||
|
|
||||||
static void tty_show(unsigned char c)
|
static void tty_show(unsigned char c)
|
||||||
{
|
{
|
||||||
if (c == DEL) {
|
static int mode_compose = 0;
|
||||||
|
|
||||||
|
if (mode_compose) {
|
||||||
|
tty_put(c);
|
||||||
|
mode_compose = 0;
|
||||||
|
} else if (isutf8(c)) {
|
||||||
|
mode_compose = 1;
|
||||||
|
tty_put(c);
|
||||||
|
} else if (c == DEL) {
|
||||||
tty_put('^');
|
tty_put('^');
|
||||||
tty_put('?');
|
tty_put('?');
|
||||||
} else if (ISCTL(c)) {
|
} else if (ISCTL(c)) {
|
||||||
@@ -209,20 +212,11 @@ static void tty_push(int c)
|
|||||||
el_push_back = c;
|
el_push_back = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rl_getc(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
char c;
|
|
||||||
|
|
||||||
do {
|
|
||||||
r = read(el_infd, &c, 1);
|
|
||||||
} while (r == -1 && errno == EINTR);
|
|
||||||
|
|
||||||
return r == 1 ? c : EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tty_get(void)
|
static int tty_get(void)
|
||||||
{
|
{
|
||||||
|
char c;
|
||||||
|
int r;
|
||||||
|
|
||||||
tty_flush();
|
tty_flush();
|
||||||
if (el_pushed) {
|
if (el_pushed) {
|
||||||
el_pushed = 0;
|
el_pushed = 0;
|
||||||
@@ -230,11 +224,15 @@ static int tty_get(void)
|
|||||||
}
|
}
|
||||||
if (*el_input)
|
if (*el_input)
|
||||||
return *el_input++;
|
return *el_input++;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = read(0, &c, 1);
|
||||||
|
} while (r == -1 && errno == EINTR);
|
||||||
|
|
||||||
return rl_getc_function();
|
return r == 1 ? c : EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tty_back() tty_puts(backspace)
|
#define tty_back() (backspace ? tty_puts(backspace) : tty_put('\b'))
|
||||||
|
|
||||||
static void tty_backn(int n)
|
static void tty_backn(int n)
|
||||||
{
|
{
|
||||||
@@ -244,28 +242,64 @@ static void tty_backn(int n)
|
|||||||
|
|
||||||
static void tty_info(void)
|
static void tty_info(void)
|
||||||
{
|
{
|
||||||
rl_reset_terminal(NULL);
|
static int init;
|
||||||
|
#ifdef CONFIG_USE_TERMCAP
|
||||||
|
char *term;
|
||||||
|
char buff[2048];
|
||||||
|
char *bp;
|
||||||
|
#endif
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
struct winsize W;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (init) {
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
/* Perhaps we got resized. */
|
||||||
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
||||||
|
&& W.ws_col > 0 && W.ws_row > 0) {
|
||||||
|
tty_cols = (int)W.ws_col;
|
||||||
|
tty_rows = (int)W.ws_row;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
init++;
|
||||||
|
|
||||||
|
/* Initialize to faulty values to trigger fallback if nothing else works. */
|
||||||
|
tty_cols = tty_rows = -1;
|
||||||
|
#ifdef CONFIG_USE_TERMCAP
|
||||||
|
bp = buff;
|
||||||
|
if ((term = getenv("TERM")) == NULL)
|
||||||
|
term = "dumb";
|
||||||
|
if (-1 != tgetent(buff, term)) {
|
||||||
|
if ((backspace = tgetstr("le", &bp)) != NULL)
|
||||||
|
backspace = strdup(backspace);
|
||||||
|
else
|
||||||
|
backspace = "\b";
|
||||||
|
tty_cols = tgetnum("co");
|
||||||
|
tty_rows = tgetnum("li");
|
||||||
|
}
|
||||||
|
/* Make sure to check width & rows and fallback to TIOCGWINSZ if available. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (tty_cols <= 0 || tty_rows <= 0) {
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
if (-1 != ioctl(0, TIOCGWINSZ, &W)) {
|
||||||
|
tty_cols = (int)W.ws_col;
|
||||||
|
tty_rows = (int)W.ws_row;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
tty_cols = SCREEN_COLS;
|
||||||
|
tty_rows = SCREEN_ROWS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Glue routines to rl_ttyset()
|
|
||||||
*/
|
|
||||||
void rl_prep_terminal(int meta_flag)
|
|
||||||
{
|
|
||||||
rl_meta_chars = !meta_flag;
|
|
||||||
rl_ttyset(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rl_deprep_terminal(void)
|
|
||||||
{
|
|
||||||
rl_ttyset(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Print an array of words in columns.
|
** Print an array of words in columns.
|
||||||
*/
|
*/
|
||||||
void el_print_columns(int ac, char **av)
|
static void columns(int ac, char **av)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
@@ -309,7 +343,9 @@ static void left(el_status_t Change)
|
|||||||
{
|
{
|
||||||
if (rl_point) {
|
if (rl_point) {
|
||||||
tty_back();
|
tty_back();
|
||||||
if (ISMETA(rl_line_buffer[rl_point - 1])) {
|
if (isutf8(rl_line_buffer[rl_point - 2])) {
|
||||||
|
rl_point--;
|
||||||
|
} else if (ISMETA(rl_line_buffer[rl_point - 1])) {
|
||||||
if (rl_meta_chars) {
|
if (rl_meta_chars) {
|
||||||
tty_back();
|
tty_back();
|
||||||
tty_back();
|
tty_back();
|
||||||
@@ -326,11 +362,14 @@ static void right(el_status_t Change)
|
|||||||
{
|
{
|
||||||
tty_show(rl_line_buffer[rl_point]);
|
tty_show(rl_line_buffer[rl_point]);
|
||||||
|
|
||||||
|
if (isutf8(rl_line_buffer[rl_point]))
|
||||||
|
tty_show(rl_line_buffer[++rl_point]);
|
||||||
|
|
||||||
if (Change == CSmove)
|
if (Change == CSmove)
|
||||||
rl_point++;
|
rl_point++;
|
||||||
}
|
}
|
||||||
|
|
||||||
el_status_t el_ring_bell(void)
|
static el_status_t ring_bell(void)
|
||||||
{
|
{
|
||||||
tty_put('\07');
|
tty_put('\07');
|
||||||
tty_flush();
|
tty_flush();
|
||||||
@@ -348,7 +387,7 @@ static el_status_t do_macro(int c)
|
|||||||
|
|
||||||
if ((el_input = (char *)getenv((char *)name)) == NULL) {
|
if ((el_input = (char *)getenv((char *)name)) == NULL) {
|
||||||
el_input = NILSTR;
|
el_input = NILSTR;
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
}
|
}
|
||||||
return CSstay;
|
return CSstay;
|
||||||
}
|
}
|
||||||
@@ -519,7 +558,7 @@ static const char *prev_hist(void)
|
|||||||
static el_status_t do_insert_hist(const char *p)
|
static el_status_t do_insert_hist(const char *p)
|
||||||
{
|
{
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
|
|
||||||
rl_point = 0;
|
rl_point = 0;
|
||||||
reposition();
|
reposition();
|
||||||
@@ -537,7 +576,7 @@ static el_status_t do_hist(const char *(*move)(void))
|
|||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
if ((p = move()) == NULL)
|
if ((p = move()) == NULL)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
} while (++i < Repeat);
|
} while (++i < Repeat);
|
||||||
return do_insert_hist(p);
|
return do_insert_hist(p);
|
||||||
}
|
}
|
||||||
@@ -624,7 +663,7 @@ static el_status_t h_search(void)
|
|||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
if (Searching)
|
if (Searching)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
Searching = 1;
|
Searching = 1;
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
@@ -644,7 +683,7 @@ static el_status_t h_search(void)
|
|||||||
p = search_hist(p, move);
|
p = search_hist(p, move);
|
||||||
clear_line();
|
clear_line();
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
el_ring_bell();
|
ring_bell();
|
||||||
return redisplay();
|
return redisplay();
|
||||||
}
|
}
|
||||||
return do_insert_hist(p);
|
return do_insert_hist(p);
|
||||||
@@ -686,7 +725,7 @@ static el_status_t delete_string(int count)
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (count <= 0 || rl_end == rl_point)
|
if (count <= 0 || rl_end == rl_point)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
|
|
||||||
if (count == 1 && rl_point == rl_end - 1) {
|
if (count == 1 && rl_point == rl_end - 1) {
|
||||||
/* Optimize common case of delete at end of line. */
|
/* Optimize common case of delete at end of line. */
|
||||||
@@ -697,6 +736,9 @@ static el_status_t delete_string(int count)
|
|||||||
if (ISCTL(*p)) {
|
if (ISCTL(*p)) {
|
||||||
i = 2;
|
i = 2;
|
||||||
tty_put(' ');
|
tty_put(' ');
|
||||||
|
} else if (isutf8(*p)) {
|
||||||
|
i = 2;
|
||||||
|
tty_put(' ');
|
||||||
} else if (rl_meta_chars && ISMETA(*p)) {
|
} else if (rl_meta_chars && ISMETA(*p)) {
|
||||||
i = 3;
|
i = 3;
|
||||||
tty_put(' ');
|
tty_put(' ');
|
||||||
@@ -850,7 +892,7 @@ static el_status_t meta(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_ANSI_ARROWS */
|
#endif /* CONFIG_ANSI_ARROWS */
|
||||||
|
|
||||||
@@ -868,7 +910,21 @@ static el_status_t meta(void)
|
|||||||
return kp->Function();
|
return kp->Function();
|
||||||
}
|
}
|
||||||
|
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
|
}
|
||||||
|
|
||||||
|
static el_status_t utf8(int c)
|
||||||
|
{
|
||||||
|
char buff[3];
|
||||||
|
|
||||||
|
if (!isutf8(c))
|
||||||
|
return CSeof;
|
||||||
|
|
||||||
|
buff[0] = c;
|
||||||
|
buff[1] = tty_get();
|
||||||
|
buff[2] = '\0';
|
||||||
|
|
||||||
|
return insert_string(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_status_t emacs(int c)
|
static el_status_t emacs(int c)
|
||||||
@@ -879,6 +935,10 @@ static el_status_t emacs(int c)
|
|||||||
/* Save point before interpreting input character 'c'. */
|
/* Save point before interpreting input character 'c'. */
|
||||||
old_point = rl_point;
|
old_point = rl_point;
|
||||||
|
|
||||||
|
if (isutf8(c)) {
|
||||||
|
return utf8(c);
|
||||||
|
}
|
||||||
|
|
||||||
if (rl_meta_chars && ISMETA(c)) {
|
if (rl_meta_chars && ISMETA(c)) {
|
||||||
tty_push(UNMETA(c));
|
tty_push(UNMETA(c));
|
||||||
return meta();
|
return meta();
|
||||||
@@ -888,15 +948,7 @@ static el_status_t emacs(int c)
|
|||||||
if (kp->Key == c)
|
if (kp->Key == c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
s = kp->Function ? kp->Function() : insert_char(c);
|
||||||
if (kp->Function) {
|
|
||||||
s = kp->Function();
|
|
||||||
if (s == CSdispatch) /* If Function is inhibited. */
|
|
||||||
s = insert_char(c);
|
|
||||||
} else {
|
|
||||||
s = insert_char(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!el_pushed) {
|
if (!el_pushed) {
|
||||||
/* No pushback means no repeat count; hacky, but true. */
|
/* No pushback means no repeat count; hacky, but true. */
|
||||||
Repeat = NO_ARG;
|
Repeat = NO_ARG;
|
||||||
@@ -907,6 +959,9 @@ static el_status_t emacs(int c)
|
|||||||
|
|
||||||
static el_status_t tty_special(int c)
|
static el_status_t tty_special(int c)
|
||||||
{
|
{
|
||||||
|
if (isutf8(c))
|
||||||
|
return CSdispatch;
|
||||||
|
|
||||||
if (rl_meta_chars && ISMETA(c))
|
if (rl_meta_chars && ISMETA(c))
|
||||||
return CSdispatch;
|
return CSdispatch;
|
||||||
|
|
||||||
@@ -992,33 +1047,19 @@ static char *editinput(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hist_alloc(void)
|
static void hist_add(char *p)
|
||||||
{
|
|
||||||
if (!H.Lines)
|
|
||||||
H.Lines = calloc(el_hist_size, sizeof(char *));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hist_add(const char *p)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
|
||||||
|
|
||||||
#ifdef CONFIG_UNIQUE_HISTORY
|
if ((p = (char *)strdup((char *)p)) == NULL)
|
||||||
if (H.Pos && strcmp(p, H.Lines[H.Pos - 1]) == 0)
|
|
||||||
return;
|
return;
|
||||||
#endif
|
if (H.Size < HIST_SIZE) {
|
||||||
if (H.Size && strcmp(p, H.Lines[H.Size - 1]) == 0)
|
H.Lines[H.Size++] = p;
|
||||||
return;
|
|
||||||
|
|
||||||
if ((s = strdup(p)) == NULL)
|
|
||||||
return;
|
|
||||||
if (H.Size < el_hist_size) {
|
|
||||||
H.Lines[H.Size++] = s;
|
|
||||||
} else {
|
} else {
|
||||||
free(H.Lines[0]);
|
free(H.Lines[0]);
|
||||||
for (i = 0; i < el_hist_size - 1; i++)
|
for (i = 0; i < HIST_SIZE - 1; i++)
|
||||||
H.Lines[i] = H.Lines[i + 1];
|
H.Lines[i] = H.Lines[i + 1];
|
||||||
H.Lines[i] = s;
|
H.Lines[i] = p;
|
||||||
}
|
}
|
||||||
H.Pos = H.Size - 1;
|
H.Pos = H.Size - 1;
|
||||||
}
|
}
|
||||||
@@ -1047,7 +1088,7 @@ static char *read_redirected(void)
|
|||||||
|
|
||||||
p += oldpos; /* Continue where we left off... */
|
p += oldpos; /* Continue where we left off... */
|
||||||
}
|
}
|
||||||
if (read(el_infd, p, 1) <= 0) {
|
if (read(0, p, 1) <= 0) {
|
||||||
/* Ignore "incomplete" lines at EOF, just like we do for a tty. */
|
/* Ignore "incomplete" lines at EOF, just like we do for a tty. */
|
||||||
free(line);
|
free(line);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1062,63 +1103,14 @@ static char *read_redirected(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For compatibility with FSF readline. */
|
/* For compatibility with FSF readline. */
|
||||||
void rl_reset_terminal(const char *terminal_name)
|
void rl_reset_terminal(char *p __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_USE_TERMCAP
|
|
||||||
char buf[1024];
|
|
||||||
char *bp;
|
|
||||||
#endif
|
|
||||||
#ifdef TIOCGWINSZ
|
|
||||||
struct winsize W;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (terminal_name) {
|
|
||||||
el_term = terminal_name;
|
|
||||||
} else if ((el_term = getenv("TERM")) == NULL) {
|
|
||||||
el_term = "dumb";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize to faulty values to trigger fallback if nothing else works. */
|
|
||||||
tty_cols = tty_rows = -1;
|
|
||||||
|
|
||||||
#ifdef CONFIG_USE_TERMCAP
|
|
||||||
bp = buf;
|
|
||||||
if (-1 != tgetent(buf, el_term)) {
|
|
||||||
if ((backspace = tgetstr("le", &bp)) != NULL)
|
|
||||||
backspace = strdup(backspace);
|
|
||||||
tty_cols = tgetnum("co");
|
|
||||||
tty_rows = tgetnum("li");
|
|
||||||
}
|
|
||||||
/* Make sure to check width & rows and fallback to TIOCGWINSZ if available. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tty_cols <= 0 || tty_rows <= 0) {
|
|
||||||
#ifdef TIOCGWINSZ
|
|
||||||
if (ioctl(el_outfd, TIOCGWINSZ, &W) >= 0 && W.ws_col > 0 && W.ws_row > 0) {
|
|
||||||
tty_cols = (int)W.ws_col;
|
|
||||||
tty_rows = (int)W.ws_row;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
tty_cols = SCREEN_COLS;
|
|
||||||
tty_rows = SCREEN_ROWS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rl_initialize(void)
|
void rl_initialize(void)
|
||||||
{
|
{
|
||||||
if (!rl_prompt)
|
if (!rl_prompt)
|
||||||
rl_prompt = "? ";
|
rl_prompt = "? ";
|
||||||
|
|
||||||
hist_alloc();
|
|
||||||
|
|
||||||
/* Setup I/O descriptors */
|
|
||||||
if (!rl_instream) el_infd = EL_STDIN;
|
|
||||||
else el_infd = fileno(rl_instream);
|
|
||||||
if (el_infd < 0) el_infd = EL_STDIN;
|
|
||||||
if (!rl_outstream) el_outfd = EL_STDOUT;
|
|
||||||
else el_outfd = fileno(rl_outstream);
|
|
||||||
if (el_outfd < 0) el_outfd = EL_STDOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *readline(const char *prompt)
|
char *readline(const char *prompt)
|
||||||
@@ -1141,7 +1133,7 @@ char *readline(const char *prompt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tty_info();
|
tty_info();
|
||||||
rl_prep_term_function(!rl_meta_chars);
|
rl_ttyset(0);
|
||||||
hist_add(NILSTR);
|
hist_add(NILSTR);
|
||||||
ScreenSize = SCREEN_INC;
|
ScreenSize = SCREEN_INC;
|
||||||
Screen = malloc(sizeof(char) * ScreenSize);
|
Screen = malloc(sizeof(char) * ScreenSize);
|
||||||
@@ -1166,13 +1158,18 @@ char *readline(const char *prompt)
|
|||||||
tty_flush();
|
tty_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
rl_deprep_term_function();
|
rl_ttyset(1);
|
||||||
free(Screen);
|
free(Screen);
|
||||||
free(H.Lines[--H.Size]);
|
free(H.Lines[--H.Size]);
|
||||||
|
|
||||||
/* Always add history, if it's a sane line. */
|
if (line != NULL && *line != '\0'
|
||||||
if (line != NULL && *line != '\0')
|
#ifdef CONFIG_UNIQUE_HISTORY
|
||||||
|
&& !(H.Pos && strcmp(line, H.Lines[H.Pos - 1]) == 0)
|
||||||
|
#endif
|
||||||
|
&& !(H.Size && strcmp(line, H.Lines[H.Size - 1]) == 0)
|
||||||
|
) {
|
||||||
hist_add(line);
|
hist_add(line);
|
||||||
|
}
|
||||||
|
|
||||||
if (el_intr_pending > 0) {
|
if (el_intr_pending > 0) {
|
||||||
int s = el_intr_pending;
|
int s = el_intr_pending;
|
||||||
@@ -1183,58 +1180,20 @@ char *readline(const char *prompt)
|
|||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Even though readline() itself adds history automatically, the user can also add
|
void add_history(char *p __attribute__ ((unused)))
|
||||||
* lines. This is for compat with GNU Readline. */
|
|
||||||
void add_history(const char *p)
|
|
||||||
{
|
{
|
||||||
|
#ifdef obsolete /* Made part of readline(). -- kjb */
|
||||||
if (p == NULL || *p == '\0')
|
if (p == NULL || *p == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hist_add(p);
|
#ifdef CONFIG_UNIQUE_HISTORY
|
||||||
}
|
if (H.Pos && strcmp(p, (char *) H.Lines[H.Pos - 1]) == 0)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
int read_history(const char *filename)
|
if (H.Size && strcmp(p, (char *) H.Lines[H.Size - 1]) == 0)
|
||||||
{
|
return;
|
||||||
FILE *fp;
|
hist_add((char *)p);
|
||||||
char buf[SCREEN_INC];
|
#endif
|
||||||
|
|
||||||
hist_alloc();
|
|
||||||
fp = fopen(filename, "r");
|
|
||||||
if (fp) {
|
|
||||||
H.Size = 0;
|
|
||||||
while (H.Size < el_hist_size) {
|
|
||||||
if (!fgets(buf, SCREEN_INC, fp))
|
|
||||||
break;
|
|
||||||
buf[strlen(buf) - 1] = 0; /* Remove '\n' */
|
|
||||||
add_history(buf);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
int write_history(const char *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
hist_alloc();
|
|
||||||
fp = fopen(filename, "w");
|
|
||||||
if (fp) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (i < H.Size) {
|
|
||||||
fprintf(fp, "%s\n", H.Lines[i++]);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return errno;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1242,7 +1201,7 @@ int write_history(const char *filename)
|
|||||||
** Move back to the beginning of the current word and return an
|
** Move back to the beginning of the current word and return an
|
||||||
** allocated copy of it.
|
** allocated copy of it.
|
||||||
*/
|
*/
|
||||||
char *el_find_word(void)
|
static char *find_word(void)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
char *new;
|
char *new;
|
||||||
@@ -1285,12 +1244,12 @@ static el_status_t c_possible(void)
|
|||||||
char *word;
|
char *word;
|
||||||
int ac;
|
int ac;
|
||||||
|
|
||||||
word = el_find_word();
|
word = find_word();
|
||||||
ac = rl_list_possib(word, &av);
|
ac = rl_list_possib(word, &av);
|
||||||
if (word)
|
if (word)
|
||||||
free(word);
|
free(word);
|
||||||
if (ac) {
|
if (ac) {
|
||||||
el_print_columns(ac, av);
|
columns(ac, av);
|
||||||
while (--ac >= 0)
|
while (--ac >= 0)
|
||||||
free(av[ac]);
|
free(av[ac]);
|
||||||
free(av);
|
free(av);
|
||||||
@@ -1298,7 +1257,7 @@ static el_status_t c_possible(void)
|
|||||||
return CSmove;
|
return CSmove;
|
||||||
}
|
}
|
||||||
|
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_status_t c_complete(void)
|
static el_status_t c_complete(void)
|
||||||
@@ -1307,23 +1266,20 @@ static el_status_t c_complete(void)
|
|||||||
char *word, *new;
|
char *word, *new;
|
||||||
size_t len;
|
size_t len;
|
||||||
int unique;
|
int unique;
|
||||||
el_status_t s = CSdone;
|
el_status_t s = 0;
|
||||||
|
|
||||||
if (rl_inhibit_complete)
|
word = find_word();
|
||||||
return CSdispatch;
|
p = (char *)rl_complete((char *)word, &unique);
|
||||||
|
|
||||||
word = el_find_word();
|
|
||||||
p = rl_complete(word, &unique);
|
|
||||||
if (word)
|
if (word)
|
||||||
free(word);
|
free(word);
|
||||||
if (p) {
|
if (p) {
|
||||||
len = strlen(p);
|
len = strlen((char *)p);
|
||||||
word = p;
|
word = p;
|
||||||
new = q = malloc(sizeof(char) * (2 * len + 1));
|
new = q = malloc(sizeof(char) * (2 * len + 1));
|
||||||
if (!new)
|
if (!new)
|
||||||
return CSstay;
|
return CSstay;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if ((*p < ' ' || strchr(SEPS, *p) != NULL)
|
if ((*p < ' ' || strchr(SEPS, (char) *p) != NULL)
|
||||||
&& (!unique || p[1] != 0)) {
|
&& (!unique || p[1] != 0)) {
|
||||||
*q++ = '\\';
|
*q++ = '\\';
|
||||||
}
|
}
|
||||||
@@ -1335,7 +1291,7 @@ static el_status_t c_complete(void)
|
|||||||
s = insert_string(new);
|
s = insert_string(new);
|
||||||
#ifdef CONFIG_ANNOYING_NOISE
|
#ifdef CONFIG_ANNOYING_NOISE
|
||||||
if (!unique)
|
if (!unique)
|
||||||
el_ring_bell();
|
ring_bell();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
free(new);
|
free(new);
|
||||||
@@ -1394,7 +1350,7 @@ static el_status_t exchange(void)
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
if ((c = tty_get()) != CTL('X'))
|
if ((c = tty_get()) != CTL('X'))
|
||||||
return c == EOF ? CSeof : el_ring_bell();
|
return c == EOF ? CSeof : ring_bell();
|
||||||
|
|
||||||
if ((c = rl_mark) <= rl_end) {
|
if ((c = rl_mark) <= rl_end) {
|
||||||
rl_mark = rl_point;
|
rl_mark = rl_point;
|
||||||
@@ -1414,7 +1370,7 @@ static el_status_t yank(void)
|
|||||||
static el_status_t copy_region(void)
|
static el_status_t copy_region(void)
|
||||||
{
|
{
|
||||||
if (rl_mark > rl_end)
|
if (rl_mark > rl_end)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
|
|
||||||
if (rl_point > rl_mark)
|
if (rl_point > rl_mark)
|
||||||
save_yank(rl_mark, rl_point - rl_mark);
|
save_yank(rl_mark, rl_point - rl_mark);
|
||||||
@@ -1540,14 +1496,14 @@ static el_status_t last_argument(void)
|
|||||||
int ac;
|
int ac;
|
||||||
|
|
||||||
if (H.Size == 1 || (p = (char *)H.Lines[H.Size - 2]) == NULL)
|
if (H.Size == 1 || (p = (char *)H.Lines[H.Size - 2]) == NULL)
|
||||||
return el_ring_bell();
|
return ring_bell();
|
||||||
|
|
||||||
if ((p = strdup(p)) == NULL)
|
if ((p = strdup(p)) == NULL)
|
||||||
return CSstay;
|
return CSstay;
|
||||||
ac = argify(p, &av);
|
ac = argify(p, &av);
|
||||||
|
|
||||||
if (Repeat != NO_ARG)
|
if (Repeat != NO_ARG)
|
||||||
s = Repeat < ac ? insert_string(av[Repeat]) : el_ring_bell();
|
s = Repeat < ac ? insert_string(av[Repeat]) : ring_bell();
|
||||||
else
|
else
|
||||||
s = ac ? insert_string(av[ac - 1]) : CSstay;
|
s = ac ? insert_string(av[ac - 1]) : CSstay;
|
||||||
|
|
||||||
@@ -1558,14 +1514,14 @@ static el_status_t last_argument(void)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_keymap_t Map[64] = {
|
static el_keymap_t Map[33] = {
|
||||||
{ CTL('@'), mk_set },
|
{ CTL('@'), mk_set },
|
||||||
{ CTL('A'), beg_line },
|
{ CTL('A'), beg_line },
|
||||||
{ CTL('B'), bk_char },
|
{ CTL('B'), bk_char },
|
||||||
{ CTL('D'), del_char },
|
{ CTL('D'), del_char },
|
||||||
{ CTL('E'), end_line },
|
{ CTL('E'), end_line },
|
||||||
{ CTL('F'), fd_char },
|
{ CTL('F'), fd_char },
|
||||||
{ CTL('G'), el_ring_bell },
|
{ CTL('G'), ring_bell },
|
||||||
{ CTL('H'), bk_del_char },
|
{ CTL('H'), bk_del_char },
|
||||||
{ CTL('I'), c_complete },
|
{ CTL('I'), c_complete },
|
||||||
{ CTL('J'), accept_line },
|
{ CTL('J'), accept_line },
|
||||||
@@ -1573,13 +1529,13 @@ static el_keymap_t Map[64] = {
|
|||||||
{ CTL('L'), redisplay },
|
{ CTL('L'), redisplay },
|
||||||
{ CTL('M'), accept_line },
|
{ CTL('M'), accept_line },
|
||||||
{ CTL('N'), h_next },
|
{ CTL('N'), h_next },
|
||||||
{ CTL('O'), el_ring_bell },
|
{ CTL('O'), ring_bell },
|
||||||
{ CTL('P'), h_prev },
|
{ CTL('P'), h_prev },
|
||||||
{ CTL('Q'), el_ring_bell },
|
{ CTL('Q'), ring_bell },
|
||||||
{ CTL('R'), h_search },
|
{ CTL('R'), h_search },
|
||||||
{ CTL('S'), el_ring_bell },
|
{ CTL('S'), ring_bell },
|
||||||
{ CTL('T'), transpose },
|
{ CTL('T'), transpose },
|
||||||
{ CTL('U'), el_ring_bell },
|
{ CTL('U'), ring_bell },
|
||||||
{ CTL('V'), quote },
|
{ CTL('V'), quote },
|
||||||
{ CTL('W'), bk_kill_word },
|
{ CTL('W'), bk_kill_word },
|
||||||
{ CTL('X'), exchange },
|
{ CTL('X'), exchange },
|
||||||
@@ -1587,12 +1543,12 @@ static el_keymap_t Map[64] = {
|
|||||||
#ifdef SYSTEM_IS_WIN32
|
#ifdef SYSTEM_IS_WIN32
|
||||||
{ CTL('Z'), end_of_input },
|
{ CTL('Z'), end_of_input },
|
||||||
#else
|
#else
|
||||||
{ CTL('Z'), el_ring_bell },
|
{ CTL('Z'), ring_bell },
|
||||||
#endif
|
#endif
|
||||||
{ CTL('['), meta },
|
{ CTL('['), meta },
|
||||||
{ CTL(']'), move_to_char },
|
{ CTL(']'), move_to_char },
|
||||||
{ CTL('^'), el_ring_bell },
|
{ CTL('^'), ring_bell },
|
||||||
{ CTL('_'), el_ring_bell },
|
{ CTL('_'), ring_bell },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1616,40 +1572,31 @@ static el_keymap_t MetaMap[64]= {
|
|||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void el_bind_key_in_map(int key, el_keymap_func_t function, el_keymap_t map[], size_t mapsz)
|
void el_bind_key_in_metamap(char c, el_keymap_func_t func)
|
||||||
{
|
{
|
||||||
size_t i;
|
/* Add given function to key map for META keys */
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; Map[i].Function != NULL; i++)
|
for (i = 0; MetaMap[i].Key != 0; i++)
|
||||||
{
|
{
|
||||||
if (map[i].Key == key)
|
if (MetaMap[i].Key == c)
|
||||||
{
|
{
|
||||||
map[i].Function = function;
|
MetaMap[i].Function = func;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A new key so have to add it to end */
|
/* A new key so have to add it to end */
|
||||||
if (i == mapsz)
|
if (i == 63)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"editline: failed binding key 0x%x, keymap full.\n", key);
|
fprintf(stderr,"editline: MetaMap table full, requires increase\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
map[i].Key = key;
|
MetaMap[i].Function = func;
|
||||||
map[i].Function = function;
|
MetaMap[i].Key = c;
|
||||||
|
MetaMap[i + 1].Function = 0; /* Zero the last location */
|
||||||
map[i + 1].Function = NULL; /* Terminate list */
|
MetaMap[i + 1].Key = 0; /* Zero the last location */
|
||||||
}
|
|
||||||
|
|
||||||
void el_bind_key(int key, el_keymap_func_t function)
|
|
||||||
{
|
|
||||||
el_bind_key_in_map(key, function, Map, ARRAY_ELEMENTS(Map));
|
|
||||||
}
|
|
||||||
|
|
||||||
void el_bind_key_in_metamap(int key, el_keymap_func_t function)
|
|
||||||
{
|
|
||||||
el_bind_key_in_map(key, function, MetaMap, ARRAY_ELEMENTS(MetaMap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -56,9 +56,6 @@
|
|||||||
#define MEM_INC 64
|
#define MEM_INC 64
|
||||||
#define SCREEN_INC 256
|
#define SCREEN_INC 256
|
||||||
|
|
||||||
/* http://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827 */
|
|
||||||
#define ARRAY_ELEMENTS(arr) ((sizeof(arr)/sizeof(0[arr])) / ((size_t)(!(sizeof(arr) % sizeof(0[arr])))))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Variables and routines internal to this package.
|
** Variables and routines internal to this package.
|
||||||
*/
|
*/
|
||||||
|
25
src/os9.h
25
src/os9.h
@@ -1,25 +0,0 @@
|
|||||||
/* Editline system header file for OS-9 (on 68k).
|
|
||||||
*
|
|
||||||
* Copyright (c) 1992, 1993 Simmule Turner and Rich Salz. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is not subject to any license of the American Telephone
|
|
||||||
* and Telegraph Company or of the Regents of the University of California.
|
|
||||||
*
|
|
||||||
* Permission is granted to anyone to use this software for any purpose on
|
|
||||||
* any computer system, and to alter it and redistribute it freely, subject
|
|
||||||
* to the following restrictions:
|
|
||||||
* 1. The authors are not responsible for the consequences of use of this
|
|
||||||
* software, no matter how awful, even if they arise from flaws in it.
|
|
||||||
* 2. The origin of this software must not be misrepresented, either by
|
|
||||||
* explicit claim or by omission. Since few users ever read sources,
|
|
||||||
* credits must appear in the documentation.
|
|
||||||
* 3. Altered versions must be plainly marked as such, and must not be
|
|
||||||
* misrepresented as being the original software. Since few users
|
|
||||||
* ever read sources, credits must appear in the documentation.
|
|
||||||
* 4. This notice may not be removed or altered.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CRLF "\r\l"
|
|
||||||
|
|
||||||
#include <dir.h>
|
|
||||||
typedef struct direct DIRENTRY;
|
|
65
src/sysos9.c
65
src/sysos9.c
@@ -1,65 +0,0 @@
|
|||||||
/* OS-9 (on 68k) system-dependant routines for editline library.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1992, 1993 Simmule Turner and Rich Salz. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is not subject to any license of the American Telephone
|
|
||||||
* and Telegraph Company or of the Regents of the University of California.
|
|
||||||
*
|
|
||||||
* Permission is granted to anyone to use this software for any purpose on
|
|
||||||
* any computer system, and to alter it and redistribute it freely, subject
|
|
||||||
* to the following restrictions:
|
|
||||||
* 1. The authors are not responsible for the consequences of use of this
|
|
||||||
* software, no matter how awful, even if they arise from flaws in it.
|
|
||||||
* 2. The origin of this software must not be misrepresented, either by
|
|
||||||
* explicit claim or by omission. Since few users ever read sources,
|
|
||||||
* credits must appear in the documentation.
|
|
||||||
* 3. Altered versions must be plainly marked as such, and must not be
|
|
||||||
* misrepresented as being the original software. Since few users
|
|
||||||
* ever read sources, credits must appear in the documentation.
|
|
||||||
* 4. This notice may not be removed or altered.
|
|
||||||
*/
|
|
||||||
#include "editline.h"
|
|
||||||
#include <sgstat.h>
|
|
||||||
#include <modes.h>
|
|
||||||
|
|
||||||
void rl_ttyset(int Reset)
|
|
||||||
{
|
|
||||||
static struct sgbuf old;
|
|
||||||
struct sgbuf new;
|
|
||||||
|
|
||||||
if (Reset == 0) {
|
|
||||||
_gs_opt(0, &old);
|
|
||||||
_gs_opt(0, &new);
|
|
||||||
new.sg_backsp = 0; new.sg_delete = 0; new.sg_echo = 0;
|
|
||||||
new.sg_alf = 0; new.sg_nulls = 0; new.sg_pause = 0;
|
|
||||||
new.sg_page = 0; new.sg_bspch = 0; new.sg_dlnch = 0;
|
|
||||||
new.sg_eorch = 0; new.sg_eofch = 0; new.sg_rlnch = 0;
|
|
||||||
new.sg_dulnch = 0; new.sg_psch = 0; new.sg_kbich = 0;
|
|
||||||
new.sg_kbach = 0; new.sg_bsech = 0; new.sg_bellch = 0;
|
|
||||||
new.sg_xon = 0; new.sg_xoff = 0; new.sg_tabcr = 0;
|
|
||||||
new.sg_tabsiz = 0;
|
|
||||||
_ss_opt(0, &new);
|
|
||||||
rl_erase = old.sg_bspch;
|
|
||||||
rl_kill = old.sg_dlnch;
|
|
||||||
rl_eof = old.sg_eofch;
|
|
||||||
rl_intr = old.sg_kbich;
|
|
||||||
rl_quit = -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_ss_opt(0, &old);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rl_add_slash(char *path, char *p)
|
|
||||||
{
|
|
||||||
strcat(p, access(path, S_IREAD | S_IFDIR) ? " " : "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Local Variables:
|
|
||||||
* version-control: t
|
|
||||||
* indent-tabs-mode: t
|
|
||||||
* c-file-style: "ellemtel"
|
|
||||||
* c-basic-offset: 4
|
|
||||||
* End:
|
|
||||||
*/
|
|
@@ -43,11 +43,9 @@ void rl_ttyset(int Reset)
|
|||||||
|
|
||||||
new = old;
|
new = old;
|
||||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||||
new.c_iflag &= ~INPCK;
|
new.c_iflag &= ~(ISTRIP | INPCK); /* | PARENB */
|
||||||
if (rl_meta_chars)
|
// new.c_cflag &= ~(CSIZE);
|
||||||
new.c_iflag |= ISTRIP;
|
// new.c_cflag |= (CS8 | CLOCAL);
|
||||||
else
|
|
||||||
new.c_iflag &= ~ISTRIP;
|
|
||||||
new.c_cc[VMIN] = 1;
|
new.c_cc[VMIN] = 1;
|
||||||
new.c_cc[VTIME] = 0;
|
new.c_cc[VTIME] = 0;
|
||||||
if (-1 == tcsetattr(0, TCSADRAIN, &new))
|
if (-1 == tcsetattr(0, TCSADRAIN, &new))
|
||||||
@@ -80,12 +78,9 @@ void rl_ttyset(int Reset)
|
|||||||
|
|
||||||
new = old;
|
new = old;
|
||||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||||
new.c_iflag &= ~INPCK;
|
new.c_iflag &= ~(ISTRIP | INPCK); /* | PARENB */
|
||||||
if (rl_meta_chars)
|
// new.c_cflag &= ~(CSIZE);
|
||||||
new.c_iflag |= ISTRIP;
|
// new.c_cflag |= (CS8 | CLOCAL);
|
||||||
else
|
|
||||||
new.c_iflag &= ~ISTRIP;
|
|
||||||
|
|
||||||
new.c_cc[VMIN] = 1;
|
new.c_cc[VMIN] = 1;
|
||||||
new.c_cc[VTIME] = 0;
|
new.c_cc[VTIME] = 0;
|
||||||
if (-1 == ioctl(0, TCSETAW, &new))
|
if (-1 == ioctl(0, TCSETAW, &new))
|
||||||
@@ -130,10 +125,9 @@ void rl_ttyset(int Reset)
|
|||||||
new_sgttyb = old_sgttyb;
|
new_sgttyb = old_sgttyb;
|
||||||
new_sgttyb.sg_flags &= ~ECHO;
|
new_sgttyb.sg_flags &= ~ECHO;
|
||||||
new_sgttyb.sg_flags |= RAW;
|
new_sgttyb.sg_flags |= RAW;
|
||||||
if (rl_meta_chars)
|
#ifdef PASS8
|
||||||
new_sgttyb.sg_flags &= ~PASS8;
|
|
||||||
else
|
|
||||||
new_sgttyb.sg_flags |= PASS8;
|
new_sgttyb.sg_flags |= PASS8;
|
||||||
|
#endif
|
||||||
if (-1 == ioctl(0, TIOCSETP, &new_sgttyb))
|
if (-1 == ioctl(0, TIOCSETP, &new_sgttyb))
|
||||||
perror("Failed TIOCSETP");
|
perror("Failed TIOCSETP");
|
||||||
new_tchars = old_tchars;
|
new_tchars = old_tchars;
|
||||||
|
Reference in New Issue
Block a user