mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 04:21:24 +08:00
More cleanup. Added license blurb to top of all source files.
Remove all old $Id:$ and similar constructs, they don't provide any additional benefit anymore. Add configure options for toggling terminal bell and toying with SIGSTOP using Ctrl-Z. Rename config option for ANSI keys to get a consistent namespace. Also did some work on ANSI-fication of function definitions, lot's of that was still lingering around.
This commit is contained in:
parent
00dd651835
commit
3c4cf96bfc
12
config.h.in
12
config.h.in
@ -1,11 +1,17 @@
|
|||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
/* Define to include ANSI arrow keys support in minix-editline */
|
|
||||||
#undef ANSI_ARROWS
|
|
||||||
|
|
||||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
||||||
#undef CLOSEDIR_VOID
|
#undef CLOSEDIR_VOID
|
||||||
|
|
||||||
|
/* Define to enable terminal bell on completion. */
|
||||||
|
#undef CONFIG_ANNOYING_NOISE
|
||||||
|
|
||||||
|
/* Define to include ANSI arrow keys support. */
|
||||||
|
#undef CONFIG_ANSI_ARROWS
|
||||||
|
|
||||||
|
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
||||||
|
#undef CONFIG_SIGSTOP
|
||||||
|
|
||||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||||
*/
|
*/
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
|
80
configure
vendored
80
configure
vendored
@ -746,8 +746,8 @@ ac_includes_default="\
|
|||||||
ac_subst_vars='am__EXEEXT_FALSE
|
ac_subst_vars='am__EXEEXT_FALSE
|
||||||
am__EXEEXT_TRUE
|
am__EXEEXT_TRUE
|
||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
COMPLETE_FALSE
|
CONFIG_DEFAULT_COMPLETE_FALSE
|
||||||
COMPLETE_TRUE
|
CONFIG_DEFAULT_COMPLETE_TRUE
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
CPP
|
CPP
|
||||||
OTOOL64
|
OTOOL64
|
||||||
@ -869,6 +869,8 @@ with_gnu_ld
|
|||||||
enable_libtool_lock
|
enable_libtool_lock
|
||||||
enable_default_complete
|
enable_default_complete
|
||||||
enable_arrow_keys
|
enable_arrow_keys
|
||||||
|
enable_sigstop
|
||||||
|
enable_terminal_bell
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
host_alias
|
host_alias
|
||||||
@ -1509,6 +1511,8 @@ Optional Features:
|
|||||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||||
--enable-default-complete Enable default completion handler.
|
--enable-default-complete Enable default completion handler.
|
||||||
--enable-arrow-keys Enable ANSI arrow keys.
|
--enable-arrow-keys Enable ANSI arrow keys.
|
||||||
|
--enable-sigstop Enable SIGSTOP key.
|
||||||
|
--enable-terminal-bell Enable terminal bell on completion.
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
@ -4550,13 +4554,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:4553: $ac_compile\"" >&5)
|
(eval echo "\"\$as_me:4557: $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:4556: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
(eval echo "\"\$as_me:4560: $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:4559: output\"" >&5)
|
(eval echo "\"\$as_me:4563: 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"
|
||||||
@ -5762,7 +5766,7 @@ ia64-*-hpux*)
|
|||||||
;;
|
;;
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 5765 "configure"' > conftest.$ac_ext
|
echo '#line 5769 "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=$?
|
||||||
@ -7292,11 +7296,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:7295: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7299: $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:7299: \$? = $ac_status" >&5
|
echo "$as_me:7303: \$? = $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.
|
||||||
@ -7631,11 +7635,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:7634: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7638: $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:7638: \$? = $ac_status" >&5
|
echo "$as_me:7642: \$? = $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.
|
||||||
@ -7736,11 +7740,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:7739: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7743: $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:7743: \$? = $ac_status" >&5
|
echo "$as_me:7747: \$? = $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
|
||||||
@ -7791,11 +7795,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:7794: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7798: $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:7798: \$? = $ac_status" >&5
|
echo "$as_me:7802: \$? = $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
|
||||||
@ -10175,7 +10179,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 10178 "configure"
|
#line 10182 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -10271,7 +10275,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 10274 "configure"
|
#line 10278 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -11079,11 +11083,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$complete = xtrue; then
|
if test x$complete = xtrue; then
|
||||||
COMPLETE_TRUE=
|
CONFIG_DEFAULT_COMPLETE_TRUE=
|
||||||
COMPLETE_FALSE='#'
|
CONFIG_DEFAULT_COMPLETE_FALSE='#'
|
||||||
else
|
else
|
||||||
COMPLETE_TRUE='#'
|
CONFIG_DEFAULT_COMPLETE_TRUE='#'
|
||||||
COMPLETE_FALSE=
|
CONFIG_DEFAULT_COMPLETE_FALSE=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -11098,7 +11102,37 @@ fi
|
|||||||
|
|
||||||
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
||||||
|
|
||||||
$as_echo "#define ANSI_ARROWS /**/" >>confdefs.h
|
$as_echo "#define CONFIG_ANSI_ARROWS /**/" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_enable_sigstop=no
|
||||||
|
# Check whether --enable-sigstop was given.
|
||||||
|
if test "${enable_sigstop+set}" = set; then :
|
||||||
|
enableval=$enable_sigstop; ac_enable_sigstop=$enableval
|
||||||
|
else
|
||||||
|
ac_enable_sigstop=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${ac_enable_sigstop}" = xyes ; then
|
||||||
|
|
||||||
|
$as_echo "#define CONFIG_SIGSTOP /**/" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_enable_terminal_bell=no
|
||||||
|
# Check whether --enable-terminal-bell was given.
|
||||||
|
if test "${enable_terminal_bell+set}" = set; then :
|
||||||
|
enableval=$enable_terminal_bell; ac_enable_terminal_bell=$enableval
|
||||||
|
else
|
||||||
|
ac_enable_terminal_bell=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${ac_enable_terminal_bell}" = xyes ; then
|
||||||
|
|
||||||
|
$as_echo "#define CONFIG_ANNOYING_NOISE /**/" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -11217,8 +11251,8 @@ 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 "${COMPLETE_TRUE}" && test -z "${COMPLETE_FALSE}"; then
|
if test -z "${CONFIG_DEFAULT_COMPLETE_TRUE}" && test -z "${CONFIG_DEFAULT_COMPLETE_FALSE}"; then
|
||||||
as_fn_error "conditional \"COMPLETE\" was never defined.
|
as_fn_error "conditional \"CONFIG_DEFAULT_COMPLETE\" 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
|
||||||
|
|
||||||
|
26
configure.ac
26
configure.ac
@ -55,7 +55,7 @@ AC_ARG_ENABLE([default-complete],
|
|||||||
AC_MSG_ERROR([bad value ${enableval} for --enable-default-complete])
|
AC_MSG_ERROR([bad value ${enableval} for --enable-default-complete])
|
||||||
;;
|
;;
|
||||||
esac],[complete=false])
|
esac],[complete=false])
|
||||||
AM_CONDITIONAL([COMPLETE], [test x$complete = xtrue])
|
AM_CONDITIONAL([CONFIG_DEFAULT_COMPLETE], [test x$complete = xtrue])
|
||||||
|
|
||||||
ac_enable_arrow_keys=no
|
ac_enable_arrow_keys=no
|
||||||
AC_ARG_ENABLE(arrow-keys,
|
AC_ARG_ENABLE(arrow-keys,
|
||||||
@ -63,8 +63,28 @@ AC_ARG_ENABLE(arrow-keys,
|
|||||||
[ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no])
|
[ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no])
|
||||||
|
|
||||||
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
||||||
AC_DEFINE([ANSI_ARROWS], [],
|
AC_DEFINE([CONFIG_ANSI_ARROWS], [],
|
||||||
[Define to include ANSI arrow keys support in minix-editline])
|
[Define to include ANSI arrow keys support.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_enable_sigstop=no
|
||||||
|
AC_ARG_ENABLE(sigstop,
|
||||||
|
[ --enable-sigstop Enable SIGSTOP key.],
|
||||||
|
[ ac_enable_sigstop=$enableval ], [ ac_enable_sigstop=no])
|
||||||
|
|
||||||
|
if test "x${ac_enable_sigstop}" = xyes ; then
|
||||||
|
AC_DEFINE([CONFIG_SIGSTOP], [],
|
||||||
|
[Define to enable SIGSTOP (Ctrl-Z) key.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_enable_terminal_bell=no
|
||||||
|
AC_ARG_ENABLE(terminal-bell,
|
||||||
|
[ --enable-terminal-bell Enable terminal bell on completion.],
|
||||||
|
[ ac_enable_terminal_bell=$enableval ], [ ac_enable_terminal_bell=no])
|
||||||
|
|
||||||
|
if test "x${ac_enable_terminal_bell}" = xyes ; then
|
||||||
|
AC_DEFINE([CONFIG_ANNOYING_NOISE], [],
|
||||||
|
[Define to enable terminal bell on completion.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
||||||
|
@ -1,4 +1,24 @@
|
|||||||
/* Custom CLI command completion. */
|
/* Custom CLI command completion.
|
||||||
|
*
|
||||||
|
* 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 "editline.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -6,10 +26,8 @@ static char *list[] = {
|
|||||||
"foo ", "bar ", "bsd ", "cli ", "ls ", "cd ", "malloc ", "tee ", NULL
|
"foo ", "bar ", "bsd ", "cli ", "ls ", "cd ", "malloc ", "tee ", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* Attempt to complete the pathname, returning an allocated copy.
|
||||||
** Attempt to complete the pathname, returning an allocated copy.
|
* Fill in *unique if we completed it, or set it to 0 if ambiguous. */
|
||||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
|
||||||
*/
|
|
||||||
static char *my_rl_complete(char *token, int *match)
|
static char *my_rl_complete(char *token, int *match)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -38,9 +56,7 @@ static char *my_rl_complete(char *token, int *match)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Return all possible completions. */
|
||||||
** Return all possible completions.
|
|
||||||
*/
|
|
||||||
static int my_rl_list_possib(char *token, char ***av)
|
static int my_rl_list_possib(char *token, char ***av)
|
||||||
{
|
{
|
||||||
int i, num, total = 0;
|
int i, num, total = 0;
|
||||||
|
@ -1,8 +1,24 @@
|
|||||||
/* $Revision: 5 $
|
/* A "micro-shell" to test editline library.
|
||||||
**
|
* If given any arguments, commands aren't executed.
|
||||||
** A "micro-shell" to test editline library.
|
*
|
||||||
** If given any arguments, commands aren't executed.
|
* 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 <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
@ -53,7 +69,3 @@ int main(int argc, char *argv[] __attribute__ ((unused)))
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* $PchId: testit.c,v 1.3 1996/02/22 21:18:51 philip Exp $
|
|
||||||
*/
|
|
||||||
|
@ -1,4 +1,23 @@
|
|||||||
/* Minix editline */
|
/* Minix editline
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
#ifndef __EDITLINE_H__
|
#ifndef __EDITLINE_H__
|
||||||
#define __EDITLINE_H__
|
#define __EDITLINE_H__
|
||||||
|
|
||||||
@ -10,9 +29,7 @@ extern int rl_meta_chars;
|
|||||||
extern char *(*rl_complete)(char *token, int *match);
|
extern char *(*rl_complete)(char *token, int *match);
|
||||||
extern int (*rl_list_possib)(char *token, char ***av);
|
extern int (*rl_list_possib)(char *token, char ***av);
|
||||||
|
|
||||||
/*
|
/* For compatibility with FSF readline. */
|
||||||
** For compatibility with FSF readline.
|
|
||||||
*/
|
|
||||||
extern void rl_reset_terminal(char *p);
|
extern void rl_reset_terminal(char *p);
|
||||||
extern void rl_initialize(void);
|
extern void rl_initialize(void);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
lib_LTLIBRARIES = libeditline.la
|
lib_LTLIBRARIES = libeditline.la
|
||||||
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h
|
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h
|
||||||
if COMPLETE
|
if CONFIG_DEFAULT_COMPLETE
|
||||||
# Built-in completion handler.
|
# Built-in completion handler.
|
||||||
libeditline_la_SOURCES += complete.c
|
libeditline_la_SOURCES += complete.c
|
||||||
AM_CPPFLAGS = -DCOMPLETE
|
AM_CPPFLAGS = -DCOMPLETE
|
||||||
|
@ -35,7 +35,7 @@ POST_UNINSTALL = :
|
|||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
# Built-in completion handler.
|
# Built-in completion handler.
|
||||||
@COMPLETE_TRUE@am__append_1 = complete.c
|
@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
|
||||||
@ -75,7 +75,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
|||||||
libeditline_la_LIBADD =
|
libeditline_la_LIBADD =
|
||||||
am__libeditline_la_SOURCES_DIST = editline.c editline.h sysunix.c \
|
am__libeditline_la_SOURCES_DIST = editline.c editline.h sysunix.c \
|
||||||
unix.h complete.c
|
unix.h complete.c
|
||||||
@COMPLETE_TRUE@am__objects_1 = complete.lo
|
@CONFIG_DEFAULT_COMPLETE_TRUE@am__objects_1 = complete.lo
|
||||||
am_libeditline_la_OBJECTS = editline.lo sysunix.lo $(am__objects_1)
|
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))
|
||||||
@ -228,7 +228,7 @@ AUTOMAKE_OPTIONS = foreign
|
|||||||
lib_LTLIBRARIES = libeditline.la
|
lib_LTLIBRARIES = libeditline.la
|
||||||
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h \
|
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h \
|
||||||
$(am__append_1)
|
$(am__append_1)
|
||||||
@COMPLETE_TRUE@AM_CPPFLAGS = -DCOMPLETE
|
@CONFIG_DEFAULT_COMPLETE_TRUE@AM_CPPFLAGS = -DCOMPLETE
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
106
src/complete.c
106
src/complete.c
@ -1,31 +1,43 @@
|
|||||||
/* $Revision: 5 $
|
/* History and file completion functions for editline library.
|
||||||
**
|
*
|
||||||
** History and file completion functions 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 "editline.h"
|
||||||
|
|
||||||
|
#define MAX_TOTAL_MATCHES (256 << sizeof(char *))
|
||||||
|
|
||||||
#if defined(NEED_STRDUP)
|
#ifdef NEED_STRDUP
|
||||||
/*
|
/* Return an allocated copy of a string. */
|
||||||
** Return an allocated copy of a string.
|
char *strdup(const char *p)
|
||||||
*/
|
|
||||||
char *
|
|
||||||
strdup(p)
|
|
||||||
char *p;
|
|
||||||
{
|
{
|
||||||
char *new;
|
char *new;
|
||||||
|
|
||||||
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
||||||
(void)strcpy(new, p);
|
(void)strcpy(new, p);
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
#endif /* defined(NEED_STRDUP) */
|
#endif
|
||||||
|
|
||||||
/*
|
/* Wrap strcmp() for qsort() */
|
||||||
** strcmp-like sorting predicate for qsort.
|
static int compare(void *p1, void *p2)
|
||||||
*/
|
|
||||||
static int
|
|
||||||
compare(void *p1, void *p2)
|
|
||||||
{
|
{
|
||||||
char **v1 = (char **)p1;
|
char **v1 = (char **)p1;
|
||||||
char **v2 = (char **)p2;
|
char **v2 = (char **)p2;
|
||||||
@ -33,15 +45,9 @@ compare(void *p1, void *p2)
|
|||||||
return strcmp(*v1, *v2);
|
return strcmp(*v1, *v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Fill in *avp with an array of names that match file, up to its length.
|
||||||
** Fill in *avp with an array of names that match file, up to its length.
|
* Ignore . and .. . */
|
||||||
** Ignore . and .. .
|
static int FindMatches(char *dir, char *file, char ***avp)
|
||||||
*/
|
|
||||||
static int
|
|
||||||
FindMatches(dir, file, avp)
|
|
||||||
char *dir;
|
|
||||||
char *file;
|
|
||||||
char ***avp;
|
|
||||||
{
|
{
|
||||||
char **av;
|
char **av;
|
||||||
char **new;
|
char **new;
|
||||||
@ -52,7 +58,6 @@ FindMatches(dir, file, avp)
|
|||||||
SIZE_T len;
|
SIZE_T len;
|
||||||
SIZE_T choices;
|
SIZE_T choices;
|
||||||
SIZE_T total;
|
SIZE_T total;
|
||||||
#define MAX_TOTAL (256 << sizeof(char *))
|
|
||||||
|
|
||||||
if ((dp = opendir(dir)) == NULL)
|
if ((dp = opendir(dir)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -70,7 +75,7 @@ FindMatches(dir, file, avp)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
choices++;
|
choices++;
|
||||||
if ((total += strlen(p)) > MAX_TOTAL) {
|
if ((total += strlen(p)) > MAX_TOTAL_MATCHES) {
|
||||||
/* This is a bit too much. */
|
/* This is a bit too much. */
|
||||||
while (ac > 0) DISPOSE(av[--ac]);
|
while (ac > 0) DISPOSE(av[--ac]);
|
||||||
continue;
|
continue;
|
||||||
@ -98,8 +103,8 @@ FindMatches(dir, file, avp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up and return. */
|
/* Clean up and return. */
|
||||||
(void)closedir(dp);
|
closedir(dp);
|
||||||
if (total > MAX_TOTAL) {
|
if (total > MAX_TOTAL_MATCHES) {
|
||||||
char many[sizeof(total) * 3];
|
char many[sizeof(total) * 3];
|
||||||
p = many + sizeof(many);
|
p = many + sizeof(many);
|
||||||
*--p = '\0';
|
*--p = '\0';
|
||||||
@ -114,17 +119,12 @@ FindMatches(dir, file, avp)
|
|||||||
if (ac)
|
if (ac)
|
||||||
qsort(av, ac, sizeof (char **), compare);
|
qsort(av, ac, sizeof (char **), compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Split a pathname into allocated directory and trailing filename parts. */
|
||||||
** Split a pathname into allocated directory and trailing filename parts.
|
static int SplitPath(char *path, char **dirpart, char **filepart)
|
||||||
*/
|
|
||||||
static int
|
|
||||||
SplitPath(path, dirpart, filepart)
|
|
||||||
char *path;
|
|
||||||
char **dirpart;
|
|
||||||
char **filepart;
|
|
||||||
{
|
{
|
||||||
static char DOT[] = ".";
|
static char DOT[] = ".";
|
||||||
char *dpart;
|
char *dpart;
|
||||||
@ -149,17 +149,13 @@ SplitPath(path, dirpart, filepart)
|
|||||||
}
|
}
|
||||||
*dirpart = dpart;
|
*dirpart = dpart;
|
||||||
*filepart = fpart;
|
*filepart = fpart;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Attempt to complete the pathname, returning an allocated copy.
|
||||||
** Attempt to complete the pathname, returning an allocated copy.
|
* Fill in *unique if we completed it, or set it to 0 if ambiguous. */
|
||||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
char *default_rl_complete(char *pathname, int *unique)
|
||||||
*/
|
|
||||||
char *
|
|
||||||
default_rl_complete(pathname, unique)
|
|
||||||
char *pathname;
|
|
||||||
int *unique;
|
|
||||||
{
|
{
|
||||||
char **av;
|
char **av;
|
||||||
char *dir;
|
char *dir;
|
||||||
@ -174,9 +170,11 @@ default_rl_complete(pathname, unique)
|
|||||||
|
|
||||||
if (SplitPath(pathname, &dir, &file) < 0)
|
if (SplitPath(pathname, &dir, &file) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
||||||
DISPOSE(dir);
|
DISPOSE(dir);
|
||||||
DISPOSE(file);
|
DISPOSE(file);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,16 +220,12 @@ default_rl_complete(pathname, unique)
|
|||||||
for (i = 0; i < ac; i++)
|
for (i = 0; i < ac; i++)
|
||||||
DISPOSE(av[i]);
|
DISPOSE(av[i]);
|
||||||
DISPOSE(av);
|
DISPOSE(av);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Return all possible completions. */
|
||||||
** Return all possible completions.
|
int default_rl_list_possib(char *pathname, char ***avp)
|
||||||
*/
|
|
||||||
int
|
|
||||||
default_rl_list_possib(pathname, avp)
|
|
||||||
char *pathname;
|
|
||||||
char ***avp;
|
|
||||||
{
|
{
|
||||||
char *dir;
|
char *dir;
|
||||||
char *file;
|
char *file;
|
||||||
@ -239,12 +233,10 @@ default_rl_list_possib(pathname, avp)
|
|||||||
|
|
||||||
if (SplitPath(pathname, &dir, &file) < 0)
|
if (SplitPath(pathname, &dir, &file) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ac = FindMatches(dir, file, avp);
|
ac = FindMatches(dir, file, avp);
|
||||||
DISPOSE(dir);
|
DISPOSE(dir);
|
||||||
DISPOSE(file);
|
DISPOSE(file);
|
||||||
|
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* $PchId: complete.c,v 1.3 1996/02/22 21:18:51 philip Exp $
|
|
||||||
*/
|
|
||||||
|
@ -1,7 +1,24 @@
|
|||||||
/* $Revision: 2220 $
|
/* Main editing routines for editline library.
|
||||||
**
|
*
|
||||||
** Main editing 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 "editline.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -64,9 +81,9 @@ int rl_erase;
|
|||||||
int rl_intr;
|
int rl_intr;
|
||||||
int rl_kill;
|
int rl_kill;
|
||||||
int rl_quit;
|
int rl_quit;
|
||||||
#if defined(DO_SIGTSTP)
|
#ifdef CONFIG_SIGSTOP
|
||||||
int rl_susp;
|
int rl_susp;
|
||||||
#endif /* defined(DO_SIGTSTP) */
|
#endif
|
||||||
|
|
||||||
static const char NIL[] = "";
|
static const char NIL[] = "";
|
||||||
static const char *Input = NIL;
|
static const char *Input = NIL;
|
||||||
@ -105,12 +122,12 @@ int (*rl_list_possib)(char *token, char ***av);
|
|||||||
** Declarations.
|
** Declarations.
|
||||||
*/
|
*/
|
||||||
static char *editinput(void);
|
static char *editinput(void);
|
||||||
#if defined(USE_TERMCAP)
|
#ifdef USE_TERMCAP
|
||||||
extern char *getenv(void);
|
extern char *getenv(void);
|
||||||
extern char *tgetstr(void);
|
extern char *tgetstr(void);
|
||||||
extern int tgetent(void);
|
extern int tgetent(void);
|
||||||
extern int tgetnum(void);
|
extern int tgetnum(void);
|
||||||
#endif /* defined(USE_TERMCAP) */
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** TTY input/output functions.
|
** TTY input/output functions.
|
||||||
@ -196,30 +213,30 @@ static void tty_backn(int n)
|
|||||||
static void tty_info(void)
|
static void tty_info(void)
|
||||||
{
|
{
|
||||||
static int init;
|
static int init;
|
||||||
#if defined(USE_TERMCAP)
|
#ifdef USE_TERMCAP
|
||||||
char *term;
|
char *term;
|
||||||
char buff[2048];
|
char buff[2048];
|
||||||
char *bp;
|
char *bp;
|
||||||
#endif /* defined(USE_TERMCAP) */
|
#endif
|
||||||
#if defined(TIOCGWINSZ)
|
#ifdef TIOCGWINSZ
|
||||||
struct winsize W;
|
struct winsize W;
|
||||||
#endif /* defined(TIOCGWINSZ) */
|
#endif
|
||||||
|
|
||||||
if (init) {
|
if (init) {
|
||||||
#if defined(TIOCGWINSZ)
|
#ifdef TIOCGWINSZ
|
||||||
/* Perhaps we got resized. */
|
/* Perhaps we got resized. */
|
||||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
||||||
&& W.ws_col > 0 && W.ws_row > 0) {
|
&& W.ws_col > 0 && W.ws_row > 0) {
|
||||||
tty_width = (int)W.ws_col;
|
tty_width = (int)W.ws_col;
|
||||||
tty_rows = (int)W.ws_row;
|
tty_rows = (int)W.ws_row;
|
||||||
}
|
}
|
||||||
#endif /* defined(TIOCGWINSZ) */
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
init++;
|
init++;
|
||||||
|
|
||||||
tty_width = tty_rows = 0;
|
tty_width = tty_rows = 0;
|
||||||
#if defined(USE_TERMCAP)
|
#ifdef USE_TERMCAP
|
||||||
bp = &buff[0];
|
bp = &buff[0];
|
||||||
if ((term = getenv("TERM")) == NULL)
|
if ((term = getenv("TERM")) == NULL)
|
||||||
term = "dumb";
|
term = "dumb";
|
||||||
@ -232,14 +249,14 @@ static void tty_info(void)
|
|||||||
backspace = strdup(backspace);
|
backspace = strdup(backspace);
|
||||||
tty_width = tgetnum("co");
|
tty_width = tgetnum("co");
|
||||||
tty_rows = tgetnum("li");
|
tty_rows = tgetnum("li");
|
||||||
#endif /* defined(USE_TERMCAP) */
|
#endif
|
||||||
|
|
||||||
#if defined(TIOCGWINSZ)
|
#ifdef TIOCGWINSZ
|
||||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
|
||||||
tty_width = (int)W.ws_col;
|
tty_width = (int)W.ws_col;
|
||||||
tty_rows = (int)W.ws_row;
|
tty_rows = (int)W.ws_row;
|
||||||
}
|
}
|
||||||
#endif /* defined(TIOCGWINSZ) */
|
#endif
|
||||||
|
|
||||||
if (tty_width <= 0 || tty_rows <= 0) {
|
if (tty_width <= 0 || tty_rows <= 0) {
|
||||||
tty_width = SCREEN_WIDTH;
|
tty_width = SCREEN_WIDTH;
|
||||||
@ -367,7 +384,7 @@ static el_status_t do_case(el_case_t type)
|
|||||||
int count;
|
int count;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
(void)do_forward(CSstay);
|
do_forward(CSstay);
|
||||||
if (OldPoint != Point) {
|
if (OldPoint != Point) {
|
||||||
if ((count = Point - OldPoint) < 0)
|
if ((count = Point - OldPoint) < 0)
|
||||||
count = -count;
|
count = -count;
|
||||||
@ -379,8 +396,9 @@ static el_status_t do_case(el_case_t type)
|
|||||||
if (islower(*p))
|
if (islower(*p))
|
||||||
*p = toupper(*p);
|
*p = toupper(*p);
|
||||||
}
|
}
|
||||||
else if (isupper(*p))
|
else if (isupper(*p)) {
|
||||||
*p = tolower(*p);
|
*p = tolower(*p);
|
||||||
|
}
|
||||||
right(CSmove);
|
right(CSmove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,7 +514,7 @@ static el_status_t do_insert_hist(const char *p)
|
|||||||
return insert_string(p);
|
return insert_string(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static el_status_t do_hist(const char *(*move)())
|
static el_status_t do_hist(const char *(*move)(void))
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
int i;
|
int i;
|
||||||
@ -544,7 +562,7 @@ static int substrcmp(const char *text, const char *pat, size_t len)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *search_hist(const char *search, const char *(*move)())
|
static const char *search_hist(const char *search, const char *(*move)(void))
|
||||||
{
|
{
|
||||||
static char *old_search;
|
static char *old_search;
|
||||||
int len;
|
int len;
|
||||||
@ -610,7 +628,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) {
|
||||||
(void)ring_bell();
|
ring_bell();
|
||||||
return redisplay();
|
return redisplay();
|
||||||
}
|
}
|
||||||
return do_insert_hist(p);
|
return do_insert_hist(p);
|
||||||
@ -723,11 +741,11 @@ static el_status_t kill_line(void)
|
|||||||
i = Point;
|
i = Point;
|
||||||
Point = Repeat;
|
Point = Repeat;
|
||||||
reposition();
|
reposition();
|
||||||
(void)delete_string(i - Point);
|
delete_string(i - Point);
|
||||||
}
|
}
|
||||||
else if (Repeat > Point) {
|
else if (Repeat > Point) {
|
||||||
right(CSmove);
|
right(CSmove);
|
||||||
(void)delete_string(Repeat - Point - 1);
|
delete_string(Repeat - Point - 1);
|
||||||
}
|
}
|
||||||
return CSmove;
|
return CSmove;
|
||||||
}
|
}
|
||||||
@ -794,7 +812,7 @@ static el_status_t meta(void)
|
|||||||
|
|
||||||
if ((c = tty_get()) == EOF)
|
if ((c = tty_get()) == EOF)
|
||||||
return CSeof;
|
return CSeof;
|
||||||
#if defined(ANSI_ARROWS)
|
#ifdef CONFIG_ANSI_ARROWS
|
||||||
/* Also include VT-100 arrows. */
|
/* Also include VT-100 arrows. */
|
||||||
if (c == '[' || c == 'O') {
|
if (c == '[' || c == 'O') {
|
||||||
c = tty_get();
|
c = tty_get();
|
||||||
@ -814,7 +832,7 @@ static el_status_t meta(void)
|
|||||||
case 'H': return beg_line(); /* Home */
|
case 'H': return beg_line(); /* Home */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* defined(ANSI_ARROWS) */
|
#endif /* CONFIG_ANSI_ARROWS */
|
||||||
|
|
||||||
if (isdigit(c)) {
|
if (isdigit(c)) {
|
||||||
for (Repeat = c - '0'; (c = tty_get()) != EOF && isdigit(c); )
|
for (Repeat = c - '0'; (c = tty_get()) != EOF && isdigit(c); )
|
||||||
@ -883,12 +901,12 @@ static el_status_t tty_special(int c)
|
|||||||
Signal = SIGQUIT;
|
Signal = SIGQUIT;
|
||||||
return CSeof;
|
return CSeof;
|
||||||
}
|
}
|
||||||
#if defined(DO_SIGTSTP)
|
#ifdef CONFIG_SIGSTOP
|
||||||
if (c == rl_susp) {
|
if (c == rl_susp) {
|
||||||
Signal = SIGTSTP;
|
Signal = SIGTSTP;
|
||||||
return CSsignal;
|
return CSsignal;
|
||||||
}
|
}
|
||||||
#endif /* defined(DO_SIGTSTP) */
|
#endif
|
||||||
|
|
||||||
return CSdispatch;
|
return CSdispatch;
|
||||||
}
|
}
|
||||||
@ -984,17 +1002,14 @@ static char *read_redirected(void)
|
|||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* For compatibility with FSF readline. */
|
||||||
** For compatibility with FSF readline.
|
|
||||||
*/
|
|
||||||
/* ARGSUSED0 */
|
|
||||||
void rl_reset_terminal(char *p __attribute__((__unused__)))
|
void rl_reset_terminal(char *p __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void rl_initialize(void)
|
void rl_initialize(void)
|
||||||
{
|
{
|
||||||
#ifdef COMPLETE
|
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
@ -1057,7 +1072,7 @@ char *readline(const char *prompt)
|
|||||||
if (Signal > 0) {
|
if (Signal > 0) {
|
||||||
s = Signal;
|
s = Signal;
|
||||||
Signal = 0;
|
Signal = 0;
|
||||||
(void)kill(getpid(), s);
|
kill(getpid(), s);
|
||||||
}
|
}
|
||||||
return (char *)line;
|
return (char *)line;
|
||||||
}
|
}
|
||||||
@ -1170,9 +1185,9 @@ static el_status_t c_complete(void)
|
|||||||
DISPOSE(word);
|
DISPOSE(word);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
s = insert_string(new);
|
s = insert_string(new);
|
||||||
#if ANNOYING_NOISE
|
#ifdef CONFIG_ANNOYING_NOISE
|
||||||
if (!unique)
|
if (!unique)
|
||||||
(void)ring_bell();
|
ring_bell();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
DISPOSE(new);
|
DISPOSE(new);
|
||||||
@ -1294,7 +1309,7 @@ static el_status_t fd_kill_word(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)do_forward(CSstay);
|
do_forward(CSstay);
|
||||||
if (OldPoint != Point) {
|
if (OldPoint != Point) {
|
||||||
i = Point - OldPoint;
|
i = Point - OldPoint;
|
||||||
Point = OldPoint;
|
Point = OldPoint;
|
||||||
@ -1325,7 +1340,7 @@ static el_status_t bk_word(void)
|
|||||||
|
|
||||||
static el_status_t bk_kill_word(void)
|
static el_status_t bk_kill_word(void)
|
||||||
{
|
{
|
||||||
(void)bk_word();
|
bk_word();
|
||||||
if (OldPoint != Point)
|
if (OldPoint != Point)
|
||||||
return delete_string(OldPoint - Point);
|
return delete_string(OldPoint - Point);
|
||||||
return CSstay;
|
return CSstay;
|
||||||
@ -1452,6 +1467,3 @@ static el_keymap_t MetaMap[]= {
|
|||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* $PchId: editline.c,v 1.4 1996/02/22 21:16:56 philip Exp $
|
|
||||||
*/
|
|
||||||
|
@ -1,7 +1,24 @@
|
|||||||
/* $Revision: 5 $
|
/* Internal header file for editline library.
|
||||||
**
|
*
|
||||||
** Internal header file 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.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __PRIVATE_EDITLINE_H__
|
#ifndef __PRIVATE_EDITLINE_H__
|
||||||
#define __PRIVATE_EDITLINE_H__
|
#define __PRIVATE_EDITLINE_H__
|
||||||
|
|
||||||
@ -51,10 +68,10 @@ extern int rl_erase;
|
|||||||
extern int rl_intr;
|
extern int rl_intr;
|
||||||
extern int rl_kill;
|
extern int rl_kill;
|
||||||
extern int rl_quit;
|
extern int rl_quit;
|
||||||
#ifdef DO_SIGTSTP
|
#ifdef CONFIG_SIGSTOP
|
||||||
extern int rl_susp;
|
extern int rl_susp;
|
||||||
#endif
|
#endif
|
||||||
#ifdef COMPLETE
|
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||||
extern char *default_rl_complete();
|
extern char *default_rl_complete();
|
||||||
extern int default_rl_list_possib(char *pathname, char ***avp);
|
extern int default_rl_list_possib(char *pathname, char ***avp);
|
||||||
#endif
|
#endif
|
||||||
@ -62,18 +79,18 @@ extern void rl_ttyset(int Reset);
|
|||||||
extern void rl_add_slash(char *path, char *p);
|
extern void rl_add_slash(char *path, char *p);
|
||||||
|
|
||||||
#ifndef HAVE_STDLIB_H
|
#ifndef HAVE_STDLIB_H
|
||||||
extern char *getenv();
|
extern char *getenv(const char *name);
|
||||||
extern char *malloc();
|
extern char *malloc(size_t size);
|
||||||
extern char *realloc();
|
extern char *realloc(void *ptr, size_t size);
|
||||||
extern char *memcpy();
|
extern char *memcpy(void *dest, const void *src, size_t n);
|
||||||
extern char *strcat();
|
extern char *strcat(char *dest, const char *src);
|
||||||
extern char *strchr();
|
extern char *strchr(const char *s, int c);
|
||||||
extern char *strrchr();
|
extern char *strrchr(const char *s, int c);
|
||||||
extern char *strcpy();
|
extern char *strcpy(char *dest, const char *src);
|
||||||
extern char *strdup();
|
extern char *strdup(const char *s);
|
||||||
extern int strcmp();
|
extern int strcmp(const char *s1, const char *s2);
|
||||||
extern int strlen();
|
extern int strlen(const char *s);
|
||||||
extern int strncmp();
|
extern int strncmp(const char *s1, const char *s2, size_t n);
|
||||||
#endif/* !HAVE_STDLIB */
|
#endif/* !HAVE_STDLIB */
|
||||||
|
|
||||||
#ifdef NEED_STRDUP
|
#ifdef NEED_STRDUP
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
/* $Revision: 5 $
|
/* Unix system-dependant routines for editline library.
|
||||||
**
|
*
|
||||||
** Unix 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 "editline.h"
|
||||||
|
|
||||||
#if defined(HAVE_TCGETATTR)
|
#if defined(HAVE_TCGETATTR)
|
||||||
@ -19,7 +35,7 @@ void rl_ttyset(int Reset)
|
|||||||
rl_eof = old.c_cc[VEOF];
|
rl_eof = old.c_cc[VEOF];
|
||||||
rl_intr = old.c_cc[VINTR];
|
rl_intr = old.c_cc[VINTR];
|
||||||
rl_quit = old.c_cc[VQUIT];
|
rl_quit = old.c_cc[VQUIT];
|
||||||
#ifdef DO_SIGTSTP
|
#ifdef CONFIG_SIGSTOP
|
||||||
rl_susp = old.c_cc[VSUSP];
|
rl_susp = old.c_cc[VSUSP];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -49,7 +65,7 @@ void rl_ttyset(int Reset)
|
|||||||
rl_eof = old.c_cc[VEOF];
|
rl_eof = old.c_cc[VEOF];
|
||||||
rl_intr = old.c_cc[VINTR];
|
rl_intr = old.c_cc[VINTR];
|
||||||
rl_quit = old.c_cc[VQUIT];
|
rl_quit = old.c_cc[VQUIT];
|
||||||
#ifdef DO_SIGTSTP
|
#ifdef CONFIG_SIGSTOP
|
||||||
rl_susp = old.c_cc[VSUSP];
|
rl_susp = old.c_cc[VSUSP];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -73,7 +89,7 @@ void rl_ttyset(int Reset)
|
|||||||
static struct tchars old_tchars;
|
static struct tchars old_tchars;
|
||||||
struct sgttyb new_sgttyb;
|
struct sgttyb new_sgttyb;
|
||||||
struct tchars new_tchars;
|
struct tchars new_tchars;
|
||||||
#ifdef DO_SIGTSTP
|
#ifdef CONFIG_SIGSTOP
|
||||||
struct ltchars old_ltchars;
|
struct ltchars old_ltchars;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,7 +103,7 @@ void rl_ttyset(int Reset)
|
|||||||
rl_intr = old_tchars.t_intrc;
|
rl_intr = old_tchars.t_intrc;
|
||||||
rl_quit = old_tchars.t_quitc;
|
rl_quit = old_tchars.t_quitc;
|
||||||
|
|
||||||
#ifdef DO_SIGTSTP
|
#ifdef CONFIG_SIGSTOP
|
||||||
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
||||||
rl_susp = old_ltchars.t_suspc;
|
rl_susp = old_ltchars.t_suspc;
|
||||||
#endif
|
#endif
|
||||||
@ -119,6 +135,3 @@ void rl_add_slash(char *path, char *p)
|
|||||||
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* $PchId: sysunix.c,v 1.4 1996/02/22 21:16:56 philip Exp $
|
|
||||||
*/
|
|
||||||
|
39
src/unix.h
39
src/unix.h
@ -1,7 +1,26 @@
|
|||||||
/* $Revision: 5 $
|
/* Editline system header file for Unix.
|
||||||
**
|
*
|
||||||
** Editline system header file for Unix.
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EDITLINE_UNIX_H__
|
||||||
|
#define __EDITLINE_UNIX_H__
|
||||||
|
|
||||||
#define CRLF "\r\n"
|
#define CRLF "\r\n"
|
||||||
#define FORWARD STATIC
|
#define FORWARD STATIC
|
||||||
@ -10,18 +29,16 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if defined(USE_DIRENT)
|
#ifdef USE_DIRENT
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
typedef struct dirent DIRENTRY;
|
typedef struct dirent DIRENTRY;
|
||||||
#else
|
#else
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
typedef struct direct DIRENTRY;
|
typedef struct direct DIRENTRY;
|
||||||
#endif /* defined(USE_DIRENT) */
|
#endif
|
||||||
|
|
||||||
#if !defined(S_ISDIR)
|
#ifndef S_ISDIR
|
||||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
#endif /* !defined(S_ISDIR) */
|
#endif
|
||||||
|
|
||||||
/*
|
#endif /* __EDITLINE_UNIX_H__ */
|
||||||
* $PchId: unix.h,v 1.3 1996/02/22 21:18:51 philip Exp $
|
|
||||||
*/
|
|
||||||
|
Loading…
Reference in New Issue
Block a user