mirror of
https://github.com/troglobit/editline.git
synced 2025-05-05 20:11:12 +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. */
|
||||
|
||||
/* 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'. */
|
||||
#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'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
80
configure
vendored
80
configure
vendored
@ -746,8 +746,8 @@ ac_includes_default="\
|
||||
ac_subst_vars='am__EXEEXT_FALSE
|
||||
am__EXEEXT_TRUE
|
||||
LTLIBOBJS
|
||||
COMPLETE_FALSE
|
||||
COMPLETE_TRUE
|
||||
CONFIG_DEFAULT_COMPLETE_FALSE
|
||||
CONFIG_DEFAULT_COMPLETE_TRUE
|
||||
LIBOBJS
|
||||
CPP
|
||||
OTOOL64
|
||||
@ -869,6 +869,8 @@ with_gnu_ld
|
||||
enable_libtool_lock
|
||||
enable_default_complete
|
||||
enable_arrow_keys
|
||||
enable_sigstop
|
||||
enable_terminal_bell
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@ -1509,6 +1511,8 @@ Optional Features:
|
||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--enable-default-complete Enable default completion handler.
|
||||
--enable-arrow-keys Enable ANSI arrow keys.
|
||||
--enable-sigstop Enable SIGSTOP key.
|
||||
--enable-terminal-bell Enable terminal bell on completion.
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@ -4550,13 +4554,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
||||
else
|
||||
lt_cv_nm_interface="BSD nm"
|
||||
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)
|
||||
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)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:4559: output\"" >&5)
|
||||
(eval echo "\"\$as_me:4563: output\"" >&5)
|
||||
cat conftest.out >&5
|
||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||
lt_cv_nm_interface="MS dumpbin"
|
||||
@ -5762,7 +5766,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# 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
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -7292,11 +7296,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-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)
|
||||
ac_status=$?
|
||||
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
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# 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: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-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)
|
||||
ac_status=$?
|
||||
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
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# 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: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-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)
|
||||
ac_status=$?
|
||||
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
|
||||
then
|
||||
# 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: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-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)
|
||||
ac_status=$?
|
||||
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
|
||||
then
|
||||
# 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_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 10178 "configure"
|
||||
#line 10182 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -10271,7 +10275,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 10274 "configure"
|
||||
#line 10278 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11079,11 +11083,11 @@ else
|
||||
fi
|
||||
|
||||
if test x$complete = xtrue; then
|
||||
COMPLETE_TRUE=
|
||||
COMPLETE_FALSE='#'
|
||||
CONFIG_DEFAULT_COMPLETE_TRUE=
|
||||
CONFIG_DEFAULT_COMPLETE_FALSE='#'
|
||||
else
|
||||
COMPLETE_TRUE='#'
|
||||
COMPLETE_FALSE=
|
||||
CONFIG_DEFAULT_COMPLETE_TRUE='#'
|
||||
CONFIG_DEFAULT_COMPLETE_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
@ -11098,7 +11102,37 @@ fi
|
||||
|
||||
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
|
||||
|
||||
@ -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.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${COMPLETE_TRUE}" && test -z "${COMPLETE_FALSE}"; then
|
||||
as_fn_error "conditional \"COMPLETE\" was never defined.
|
||||
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
|
||||
|
||||
|
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])
|
||||
;;
|
||||
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_ARG_ENABLE(arrow-keys,
|
||||
@ -63,8 +63,28 @@ AC_ARG_ENABLE(arrow-keys,
|
||||
[ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no])
|
||||
|
||||
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
||||
AC_DEFINE([ANSI_ARROWS], [],
|
||||
[Define to include ANSI arrow keys support in minix-editline])
|
||||
AC_DEFINE([CONFIG_ANSI_ARROWS], [],
|
||||
[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
|
||||
|
||||
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 <string.h>
|
||||
|
||||
@ -6,10 +26,8 @@ static char *list[] = {
|
||||
"foo ", "bar ", "bsd ", "cli ", "ls ", "cd ", "malloc ", "tee ", NULL
|
||||
};
|
||||
|
||||
/*
|
||||
** Attempt to complete the pathname, returning an allocated copy.
|
||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
||||
*/
|
||||
/* Attempt to complete the pathname, returning an allocated copy.
|
||||
* Fill in *unique if we completed it, or set it to 0 if ambiguous. */
|
||||
static char *my_rl_complete(char *token, int *match)
|
||||
{
|
||||
int i;
|
||||
@ -38,9 +56,7 @@ static char *my_rl_complete(char *token, int *match)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
/* Return all possible completions. */
|
||||
static int my_rl_list_possib(char *token, char ***av)
|
||||
{
|
||||
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 <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
@ -53,7 +69,3 @@ int main(int argc, char *argv[] __attribute__ ((unused)))
|
||||
|
||||
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__
|
||||
#define __EDITLINE_H__
|
||||
|
||||
@ -10,9 +29,7 @@ extern int rl_meta_chars;
|
||||
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 void rl_reset_terminal(char *p);
|
||||
extern void rl_initialize(void);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
lib_LTLIBRARIES = libeditline.la
|
||||
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h
|
||||
if COMPLETE
|
||||
if CONFIG_DEFAULT_COMPLETE
|
||||
# Built-in completion handler.
|
||||
libeditline_la_SOURCES += complete.c
|
||||
AM_CPPFLAGS = -DCOMPLETE
|
||||
|
@ -35,7 +35,7 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
# Built-in completion handler.
|
||||
@COMPLETE_TRUE@am__append_1 = complete.c
|
||||
@CONFIG_DEFAULT_COMPLETE_TRUE@am__append_1 = complete.c
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@ -75,7 +75,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libeditline_la_LIBADD =
|
||||
am__libeditline_la_SOURCES_DIST = editline.c editline.h sysunix.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)
|
||||
libeditline_la_OBJECTS = $(am_libeditline_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
@ -228,7 +228,7 @@ AUTOMAKE_OPTIONS = foreign
|
||||
lib_LTLIBRARIES = libeditline.la
|
||||
libeditline_la_SOURCES = editline.c editline.h sysunix.c unix.h \
|
||||
$(am__append_1)
|
||||
@COMPLETE_TRUE@AM_CPPFLAGS = -DCOMPLETE
|
||||
@CONFIG_DEFAULT_COMPLETE_TRUE@AM_CPPFLAGS = -DCOMPLETE
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
108
src/complete.c
108
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"
|
||||
|
||||
#define MAX_TOTAL_MATCHES (256 << sizeof(char *))
|
||||
|
||||
#if defined(NEED_STRDUP)
|
||||
/*
|
||||
** Return an allocated copy of a string.
|
||||
*/
|
||||
char *
|
||||
strdup(p)
|
||||
char *p;
|
||||
#ifdef NEED_STRDUP
|
||||
/* Return an allocated copy of a string. */
|
||||
char *strdup(const char *p)
|
||||
{
|
||||
char *new;
|
||||
char *new;
|
||||
|
||||
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
||||
(void)strcpy(new, p);
|
||||
|
||||
return new;
|
||||
}
|
||||
#endif /* defined(NEED_STRDUP) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** strcmp-like sorting predicate for qsort.
|
||||
*/
|
||||
static int
|
||||
compare(void *p1, void *p2)
|
||||
/* Wrap strcmp() for qsort() */
|
||||
static int compare(void *p1, void *p2)
|
||||
{
|
||||
char **v1 = (char **)p1;
|
||||
char **v2 = (char **)p2;
|
||||
@ -33,15 +45,9 @@ compare(void *p1, void *p2)
|
||||
return strcmp(*v1, *v2);
|
||||
}
|
||||
|
||||
/*
|
||||
** Fill in *avp with an array of names that match file, up to its length.
|
||||
** Ignore . and .. .
|
||||
*/
|
||||
static int
|
||||
FindMatches(dir, file, avp)
|
||||
char *dir;
|
||||
char *file;
|
||||
char ***avp;
|
||||
/* Fill in *avp with an array of names that match file, up to its length.
|
||||
* Ignore . and .. . */
|
||||
static int FindMatches(char *dir, char *file, char ***avp)
|
||||
{
|
||||
char **av;
|
||||
char **new;
|
||||
@ -52,7 +58,6 @@ FindMatches(dir, file, avp)
|
||||
SIZE_T len;
|
||||
SIZE_T choices;
|
||||
SIZE_T total;
|
||||
#define MAX_TOTAL (256 << sizeof(char *))
|
||||
|
||||
if ((dp = opendir(dir)) == NULL)
|
||||
return 0;
|
||||
@ -70,7 +75,7 @@ FindMatches(dir, file, avp)
|
||||
continue;
|
||||
|
||||
choices++;
|
||||
if ((total += strlen(p)) > MAX_TOTAL) {
|
||||
if ((total += strlen(p)) > MAX_TOTAL_MATCHES) {
|
||||
/* This is a bit too much. */
|
||||
while (ac > 0) DISPOSE(av[--ac]);
|
||||
continue;
|
||||
@ -98,8 +103,8 @@ FindMatches(dir, file, avp)
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
(void)closedir(dp);
|
||||
if (total > MAX_TOTAL) {
|
||||
closedir(dp);
|
||||
if (total > MAX_TOTAL_MATCHES) {
|
||||
char many[sizeof(total) * 3];
|
||||
p = many + sizeof(many);
|
||||
*--p = '\0';
|
||||
@ -114,17 +119,12 @@ FindMatches(dir, file, avp)
|
||||
if (ac)
|
||||
qsort(av, ac, sizeof (char **), compare);
|
||||
}
|
||||
|
||||
return ac;
|
||||
}
|
||||
|
||||
/*
|
||||
** Split a pathname into allocated directory and trailing filename parts.
|
||||
*/
|
||||
static int
|
||||
SplitPath(path, dirpart, filepart)
|
||||
char *path;
|
||||
char **dirpart;
|
||||
char **filepart;
|
||||
/* Split a pathname into allocated directory and trailing filename parts. */
|
||||
static int SplitPath(char *path, char **dirpart, char **filepart)
|
||||
{
|
||||
static char DOT[] = ".";
|
||||
char *dpart;
|
||||
@ -149,17 +149,13 @@ SplitPath(path, dirpart, filepart)
|
||||
}
|
||||
*dirpart = dpart;
|
||||
*filepart = fpart;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Attempt to complete the pathname, returning an allocated copy.
|
||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
||||
*/
|
||||
char *
|
||||
default_rl_complete(pathname, unique)
|
||||
char *pathname;
|
||||
int *unique;
|
||||
/* Attempt to complete the pathname, returning an allocated copy.
|
||||
* Fill in *unique if we completed it, or set it to 0 if ambiguous. */
|
||||
char *default_rl_complete(char *pathname, int *unique)
|
||||
{
|
||||
char **av;
|
||||
char *dir;
|
||||
@ -174,9 +170,11 @@ default_rl_complete(pathname, unique)
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return NULL;
|
||||
|
||||
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -222,16 +220,12 @@ default_rl_complete(pathname, unique)
|
||||
for (i = 0; i < ac; i++)
|
||||
DISPOSE(av[i]);
|
||||
DISPOSE(av);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
int
|
||||
default_rl_list_possib(pathname, avp)
|
||||
char *pathname;
|
||||
char ***avp;
|
||||
/* Return all possible completions. */
|
||||
int default_rl_list_possib(char *pathname, char ***avp)
|
||||
{
|
||||
char *dir;
|
||||
char *file;
|
||||
@ -239,12 +233,10 @@ default_rl_list_possib(pathname, avp)
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return 0;
|
||||
|
||||
ac = FindMatches(dir, file, avp);
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
|
||||
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 <signal.h>
|
||||
#include <errno.h>
|
||||
@ -64,9 +81,9 @@ int rl_erase;
|
||||
int rl_intr;
|
||||
int rl_kill;
|
||||
int rl_quit;
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
int rl_susp;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
static const char NIL[] = "";
|
||||
static const char *Input = NIL;
|
||||
@ -105,12 +122,12 @@ int (*rl_list_possib)(char *token, char ***av);
|
||||
** Declarations.
|
||||
*/
|
||||
static char *editinput(void);
|
||||
#if defined(USE_TERMCAP)
|
||||
#ifdef USE_TERMCAP
|
||||
extern char *getenv(void);
|
||||
extern char *tgetstr(void);
|
||||
extern int tgetent(void);
|
||||
extern int tgetnum(void);
|
||||
#endif /* defined(USE_TERMCAP) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** TTY input/output functions.
|
||||
@ -196,30 +213,30 @@ static void tty_backn(int n)
|
||||
static void tty_info(void)
|
||||
{
|
||||
static int init;
|
||||
#if defined(USE_TERMCAP)
|
||||
#ifdef USE_TERMCAP
|
||||
char *term;
|
||||
char buff[2048];
|
||||
char *bp;
|
||||
#endif /* defined(USE_TERMCAP) */
|
||||
#if defined(TIOCGWINSZ)
|
||||
#endif
|
||||
#ifdef TIOCGWINSZ
|
||||
struct winsize W;
|
||||
#endif /* defined(TIOCGWINSZ) */
|
||||
#endif
|
||||
|
||||
if (init) {
|
||||
#if defined(TIOCGWINSZ)
|
||||
#ifdef TIOCGWINSZ
|
||||
/* Perhaps we got resized. */
|
||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
||||
&& W.ws_col > 0 && W.ws_row > 0) {
|
||||
tty_width = (int)W.ws_col;
|
||||
tty_rows = (int)W.ws_row;
|
||||
}
|
||||
#endif /* defined(TIOCGWINSZ) */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
init++;
|
||||
|
||||
tty_width = tty_rows = 0;
|
||||
#if defined(USE_TERMCAP)
|
||||
#ifdef USE_TERMCAP
|
||||
bp = &buff[0];
|
||||
if ((term = getenv("TERM")) == NULL)
|
||||
term = "dumb";
|
||||
@ -232,14 +249,14 @@ static void tty_info(void)
|
||||
backspace = strdup(backspace);
|
||||
tty_width = tgetnum("co");
|
||||
tty_rows = tgetnum("li");
|
||||
#endif /* defined(USE_TERMCAP) */
|
||||
#endif
|
||||
|
||||
#if defined(TIOCGWINSZ)
|
||||
#ifdef TIOCGWINSZ
|
||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
|
||||
tty_width = (int)W.ws_col;
|
||||
tty_rows = (int)W.ws_row;
|
||||
}
|
||||
#endif /* defined(TIOCGWINSZ) */
|
||||
#endif
|
||||
|
||||
if (tty_width <= 0 || tty_rows <= 0) {
|
||||
tty_width = SCREEN_WIDTH;
|
||||
@ -323,7 +340,7 @@ static el_status_t ring_bell(void)
|
||||
|
||||
static el_status_t do_macro(int c)
|
||||
{
|
||||
char name[4];
|
||||
char name[4];
|
||||
|
||||
name[0] = '_';
|
||||
name[1] = c;
|
||||
@ -367,7 +384,7 @@ static el_status_t do_case(el_case_t type)
|
||||
int count;
|
||||
char *p;
|
||||
|
||||
(void)do_forward(CSstay);
|
||||
do_forward(CSstay);
|
||||
if (OldPoint != Point) {
|
||||
if ((count = Point - OldPoint) < 0)
|
||||
count = -count;
|
||||
@ -379,8 +396,9 @@ static el_status_t do_case(el_case_t type)
|
||||
if (islower(*p))
|
||||
*p = toupper(*p);
|
||||
}
|
||||
else if (isupper(*p))
|
||||
else if (isupper(*p)) {
|
||||
*p = tolower(*p);
|
||||
}
|
||||
right(CSmove);
|
||||
}
|
||||
}
|
||||
@ -496,7 +514,7 @@ static el_status_t do_insert_hist(const char *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;
|
||||
int i;
|
||||
@ -544,7 +562,7 @@ static int substrcmp(const char *text, const char *pat, size_t len)
|
||||
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;
|
||||
int len;
|
||||
@ -610,7 +628,7 @@ static el_status_t h_search(void)
|
||||
p = search_hist(p, move);
|
||||
clear_line();
|
||||
if (p == NULL) {
|
||||
(void)ring_bell();
|
||||
ring_bell();
|
||||
return redisplay();
|
||||
}
|
||||
return do_insert_hist(p);
|
||||
@ -723,11 +741,11 @@ static el_status_t kill_line(void)
|
||||
i = Point;
|
||||
Point = Repeat;
|
||||
reposition();
|
||||
(void)delete_string(i - Point);
|
||||
delete_string(i - Point);
|
||||
}
|
||||
else if (Repeat > Point) {
|
||||
right(CSmove);
|
||||
(void)delete_string(Repeat - Point - 1);
|
||||
delete_string(Repeat - Point - 1);
|
||||
}
|
||||
return CSmove;
|
||||
}
|
||||
@ -794,7 +812,7 @@ static el_status_t meta(void)
|
||||
|
||||
if ((c = tty_get()) == EOF)
|
||||
return CSeof;
|
||||
#if defined(ANSI_ARROWS)
|
||||
#ifdef CONFIG_ANSI_ARROWS
|
||||
/* Also include VT-100 arrows. */
|
||||
if (c == '[' || c == 'O') {
|
||||
c = tty_get();
|
||||
@ -814,7 +832,7 @@ static el_status_t meta(void)
|
||||
case 'H': return beg_line(); /* Home */
|
||||
}
|
||||
}
|
||||
#endif /* defined(ANSI_ARROWS) */
|
||||
#endif /* CONFIG_ANSI_ARROWS */
|
||||
|
||||
if (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;
|
||||
return CSeof;
|
||||
}
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
if (c == rl_susp) {
|
||||
Signal = SIGTSTP;
|
||||
return CSsignal;
|
||||
}
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
return CSdispatch;
|
||||
}
|
||||
@ -984,17 +1002,14 @@ static char *read_redirected(void)
|
||||
return line;
|
||||
}
|
||||
|
||||
/*
|
||||
** For compatibility with FSF readline.
|
||||
*/
|
||||
/* ARGSUSED0 */
|
||||
/* For compatibility with FSF readline. */
|
||||
void rl_reset_terminal(char *p __attribute__((__unused__)))
|
||||
{
|
||||
}
|
||||
|
||||
void rl_initialize(void)
|
||||
{
|
||||
#ifdef COMPLETE
|
||||
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||
int done = 0;
|
||||
|
||||
if (!done)
|
||||
@ -1057,7 +1072,7 @@ char *readline(const char *prompt)
|
||||
if (Signal > 0) {
|
||||
s = Signal;
|
||||
Signal = 0;
|
||||
(void)kill(getpid(), s);
|
||||
kill(getpid(), s);
|
||||
}
|
||||
return (char *)line;
|
||||
}
|
||||
@ -1170,9 +1185,9 @@ static el_status_t c_complete(void)
|
||||
DISPOSE(word);
|
||||
if (len > 0) {
|
||||
s = insert_string(new);
|
||||
#if ANNOYING_NOISE
|
||||
#ifdef CONFIG_ANNOYING_NOISE
|
||||
if (!unique)
|
||||
(void)ring_bell();
|
||||
ring_bell();
|
||||
#endif
|
||||
}
|
||||
DISPOSE(new);
|
||||
@ -1294,7 +1309,7 @@ static el_status_t fd_kill_word(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
(void)do_forward(CSstay);
|
||||
do_forward(CSstay);
|
||||
if (OldPoint != Point) {
|
||||
i = Point - OldPoint;
|
||||
Point = OldPoint;
|
||||
@ -1325,7 +1340,7 @@ static el_status_t bk_word(void)
|
||||
|
||||
static el_status_t bk_kill_word(void)
|
||||
{
|
||||
(void)bk_word();
|
||||
bk_word();
|
||||
if (OldPoint != Point)
|
||||
return delete_string(OldPoint - Point);
|
||||
return CSstay;
|
||||
@ -1452,6 +1467,3 @@ static el_keymap_t MetaMap[]= {
|
||||
{ 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__
|
||||
#define __PRIVATE_EDITLINE_H__
|
||||
|
||||
@ -51,10 +68,10 @@ extern int rl_erase;
|
||||
extern int rl_intr;
|
||||
extern int rl_kill;
|
||||
extern int rl_quit;
|
||||
#ifdef DO_SIGTSTP
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
extern int rl_susp;
|
||||
#endif
|
||||
#ifdef COMPLETE
|
||||
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||
extern char *default_rl_complete();
|
||||
extern int default_rl_list_possib(char *pathname, char ***avp);
|
||||
#endif
|
||||
@ -62,18 +79,18 @@ extern void rl_ttyset(int Reset);
|
||||
extern void rl_add_slash(char *path, char *p);
|
||||
|
||||
#ifndef HAVE_STDLIB_H
|
||||
extern char *getenv();
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern char *memcpy();
|
||||
extern char *strcat();
|
||||
extern char *strchr();
|
||||
extern char *strrchr();
|
||||
extern char *strcpy();
|
||||
extern char *strdup();
|
||||
extern int strcmp();
|
||||
extern int strlen();
|
||||
extern int strncmp();
|
||||
extern char *getenv(const char *name);
|
||||
extern char *malloc(size_t size);
|
||||
extern char *realloc(void *ptr, size_t size);
|
||||
extern char *memcpy(void *dest, const void *src, size_t n);
|
||||
extern char *strcat(char *dest, const char *src);
|
||||
extern char *strchr(const char *s, int c);
|
||||
extern char *strrchr(const char *s, int c);
|
||||
extern char *strcpy(char *dest, const char *src);
|
||||
extern char *strdup(const char *s);
|
||||
extern int strcmp(const char *s1, const char *s2);
|
||||
extern int strlen(const char *s);
|
||||
extern int strncmp(const char *s1, const char *s2, size_t n);
|
||||
#endif/* !HAVE_STDLIB */
|
||||
|
||||
#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"
|
||||
|
||||
#if defined(HAVE_TCGETATTR)
|
||||
@ -19,7 +35,7 @@ void rl_ttyset(int Reset)
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#ifdef DO_SIGTSTP
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif
|
||||
|
||||
@ -49,7 +65,7 @@ void rl_ttyset(int Reset)
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#ifdef DO_SIGTSTP
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif
|
||||
|
||||
@ -73,7 +89,7 @@ void rl_ttyset(int Reset)
|
||||
static struct tchars old_tchars;
|
||||
struct sgttyb new_sgttyb;
|
||||
struct tchars new_tchars;
|
||||
#ifdef DO_SIGTSTP
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
struct ltchars old_ltchars;
|
||||
#endif
|
||||
|
||||
@ -87,7 +103,7 @@ void rl_ttyset(int Reset)
|
||||
rl_intr = old_tchars.t_intrc;
|
||||
rl_quit = old_tchars.t_quitc;
|
||||
|
||||
#ifdef DO_SIGTSTP
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
||||
rl_susp = old_ltchars.t_suspc;
|
||||
#endif
|
||||
@ -119,6 +135,3 @@ void rl_add_slash(char *path, char *p)
|
||||
(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 FORWARD STATIC
|
||||
@ -10,18 +29,16 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(USE_DIRENT)
|
||||
#ifdef USE_DIRENT
|
||||
#include <dirent.h>
|
||||
typedef struct dirent DIRENTRY;
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
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)
|
||||
#endif /* !defined(S_ISDIR) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* $PchId: unix.h,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||
*/
|
||||
#endif /* __EDITLINE_UNIX_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user