mirror of
https://github.com/troglobit/editline.git
synced 2025-09-17 09:28:10 +08:00
Compare commits
82 Commits
1.13.0
...
readline-c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9b3137eb1b | ||
![]() |
916fac7cad | ||
![]() |
1c89c9886c | ||
![]() |
de6ff117bb | ||
![]() |
5e9177fd18 | ||
![]() |
27fcc878a1 | ||
![]() |
5de90af58f | ||
![]() |
0a75b182b1 | ||
![]() |
6a8ecd7e2e | ||
![]() |
bdf5384c5b | ||
![]() |
ff404e2088 | ||
![]() |
d04bdaf38f | ||
![]() |
aea0d60478 | ||
![]() |
04a0cbd902 | ||
![]() |
55aaddbc54 | ||
![]() |
dde4471eda | ||
![]() |
76ec5adba6 | ||
![]() |
80ca9e1811 | ||
![]() |
b48de203e7 | ||
![]() |
3fedfd4444 | ||
![]() |
c0d7a14490 | ||
![]() |
f1edf7ae52 | ||
![]() |
2a9b087bbc | ||
![]() |
f617f84293 | ||
![]() |
bde0c0c9d6 | ||
![]() |
02acd55b2e | ||
![]() |
167059d159 | ||
![]() |
20c55a58da | ||
![]() |
0d9ce0ce06 | ||
![]() |
67e9aa3f2b | ||
![]() |
dbad0d0871 | ||
![]() |
f16cbece5a | ||
![]() |
be921400bb | ||
![]() |
83e4837f39 | ||
![]() |
a7eea67253 | ||
![]() |
8e13c7b5ae | ||
![]() |
02ea37e4de | ||
![]() |
c7b78df006 | ||
![]() |
5a8ad742d9 | ||
![]() |
522e534448 | ||
![]() |
d4aa5ac293 | ||
![]() |
a848011073 | ||
![]() |
ceb1995733 | ||
![]() |
98b846c8b1 | ||
![]() |
511a1a65a4 | ||
![]() |
64219dc1f0 | ||
![]() |
b51dad6408 | ||
![]() |
45bae5b240 | ||
![]() |
a855f4e0e6 | ||
![]() |
cc1fd1e9dc | ||
![]() |
536dcacb06 | ||
![]() |
009d3f0568 | ||
![]() |
60245e5e51 | ||
![]() |
576e437290 | ||
![]() |
6d2f4c99a3 | ||
![]() |
8b85bab216 | ||
![]() |
a0ec848f7b | ||
![]() |
d76ca9f1d6 | ||
![]() |
98fbc6cd41 | ||
![]() |
4c4a7e808c | ||
![]() |
7d0aff5ba3 | ||
![]() |
f874ad60ab | ||
![]() |
2d2ec7db98 | ||
![]() |
ca56b74763 | ||
![]() |
89261724d2 | ||
![]() |
885475fc49 | ||
![]() |
ad0fee03aa | ||
![]() |
da4bd00eef | ||
![]() |
3c4cf96bfc | ||
![]() |
00dd651835 | ||
![]() |
34a314c8e7 | ||
![]() |
4c9c71faae | ||
![]() |
cbf276d9ff | ||
![]() |
722dae35a2 | ||
![]() |
c52e75cb01 | ||
![]() |
e16f245672 | ||
![]() |
bc6dd1c34e | ||
![]() |
07fe826324 | ||
![]() |
9973cc2a9a | ||
![]() |
348eb97440 | ||
![]() |
e0c7e38d4e | ||
![]() |
e8fc7788aa |
15
.bzrignore → .gitignore
vendored
15
.bzrignore → .gitignore
vendored
@@ -4,13 +4,22 @@ autom4te.cache
|
||||
config.h
|
||||
config.log
|
||||
config.status
|
||||
stamp-h1
|
||||
libtool
|
||||
examples/.deps
|
||||
examples/Makefile
|
||||
examples/cli
|
||||
examples/cli.o
|
||||
examples/testit
|
||||
man/Makefile
|
||||
man/Makefile
|
||||
examples/testit.o
|
||||
include/Makefile
|
||||
man/Makefile
|
||||
man/Makefile
|
||||
src/.deps
|
||||
src/Makefile
|
||||
src/*.o
|
||||
src/*.lo
|
||||
src/libeditline.a
|
||||
src/libeditline.la
|
||||
stamp-h1
|
||||
*~
|
||||
*/.libs/
|
19
Make.os9
Normal file
19
Make.os9
Normal file
@@ -0,0 +1,19 @@
|
||||
## $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) >$@
|
@@ -1,44 +0,0 @@
|
||||
## $Revision: 1390 $
|
||||
##
|
||||
## Unix makefile for editline library.
|
||||
##
|
||||
|
||||
|
||||
## Set your options:
|
||||
## -DANSI_ARROWS ANSI arrows keys work like emacs.
|
||||
## -DHAVE_STDLIB Have <stdlib.h>.
|
||||
## -DHAVE_TCGETATTR Have , .
|
||||
## -DHAVE_TERMIO Have "struct termio" and <termio.h>
|
||||
## (If neither of above two, we use <sgttyb.h> and BSD ioctl's)
|
||||
## -DHIDE Make static functions static (non debug).
|
||||
## -DHIST_SIZE=n History size.
|
||||
## -DNEED_STRDUP Don't have .
|
||||
## -DUNIQUE_HISTORY Don't save command if same as last one.
|
||||
## -DUSE_DIRENT Use <dirent.h>, not <sys/dir.h>?
|
||||
## -DUSE_TERMCAP Use the termcap library for terminal size
|
||||
## see LDFLAGS, below, if you set this.
|
||||
## -DNEED_PERROR Don't have (used in testit)
|
||||
DEFS="-DANSI_ARROWS -DHAVE_STDLIB -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT \
|
||||
-DHIST_SIZE=100 -DUSE_TERMCAP -DSYS_UNIX"
|
||||
#-DNEED_STRDUP
|
||||
|
||||
CFLAGS="-O -D_MINIX -D_POSIX_SOURCE $DEFS -wo"
|
||||
#CC1 = $(CC) $(CFLAGS) -c
|
||||
|
||||
## If you have -DUSE_TERMCAP, set this as appropriate:
|
||||
#LDFLAGS = -ltermlib
|
||||
#LDFLAGS = -ltermcap
|
||||
|
||||
## End of configuration.
|
||||
|
||||
#SOURCES = editline.c complete.c sysunix.c
|
||||
#LIBRARY = ../libedit.a
|
||||
LIBRARIES=libedit
|
||||
#OBJECTS = editline.o complete.o sysunix.o
|
||||
libedit_FILES="editline.c complete.c sysunix.c"
|
||||
#SHARFILES = README Makefile editline.3 editline.h unix.h editline.c \
|
||||
|
||||
TYPE=both
|
||||
#include ../Makefile.inc
|
||||
|
||||
#$(call ADDDEPENDENCIES,$(libedit_OBJECTS),editline.h)
|
@@ -1,3 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
EXTRA_DIST = LICENSE
|
||||
SUBDIRS = src include man examples
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = LICENSE
|
||||
SUBDIRS = src include man examples
|
||||
|
95
Makefile.in
95
Makefile.in
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -31,12 +31,18 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(top_srcdir)/configure NEWS TODO depcomp install-sh missing
|
||||
$(top_srcdir)/configure NEWS TODO config.guess config.sub \
|
||||
depcomp install-sh ltmain.sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
@@ -107,7 +113,9 @@ distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -120,24 +128,36 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
@@ -147,29 +167,40 @@ PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TERMLIBS = @TERMLIBS@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -178,6 +209,7 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -194,6 +226,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = LICENSE
|
||||
SUBDIRS = src include man examples
|
||||
all: config.h
|
||||
@@ -252,6 +285,15 @@ $(srcdir)/config.h.in: $(am__configure_deps)
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
@@ -259,7 +301,7 @@ distclean-hdr:
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
@@ -284,7 +326,7 @@ $(RECURSIVE_TARGETS):
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
@@ -448,7 +490,8 @@ distdir: $(DISTFILES)
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
@@ -492,17 +535,17 @@ dist dist-all: distdir
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
@@ -593,12 +636,13 @@ maintainer-clean-generic:
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
@@ -648,7 +692,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
@@ -665,18 +709,19 @@ uninstall-am:
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||
distclean distclean-generic distclean-hdr distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
46
README
46
README
@@ -1,33 +1,35 @@
|
||||
README -*-text-*-
|
||||
|
||||
This is a line editing library. It can be linked into almost any program to provide
|
||||
command-line editing and history.
|
||||
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 readline library, but it is a fraction of the size
|
||||
(and offers fewer features). It does not use standard I/O. It is distributed under
|
||||
a "C News-like" copyright, see the file LICENSE for details.
|
||||
It is call-compatible with the FSF readline library, but it is a fraction of
|
||||
the size (and offers fewer features). It does not use standard I/O. It is
|
||||
distributed under a "C News-like" copyright, see the file LICENSE for details.
|
||||
|
||||
Configuration is made by supplying different options to the GNU configure script. In
|
||||
the examples/ directory you can find a couple of small & slow shell implementations
|
||||
Configuration is made by supplying different options to the GNU configure
|
||||
script. In the examples/ directory you can find some small code snippets
|
||||
used for testing.
|
||||
|
||||
Before finding out about the Debian version I was on the lookout for a really small
|
||||
replacement for the GNU readline package. Not only was it large and GPL:ed (instead
|
||||
of LGPL:ed), it also depends on libncurses, so 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!
|
||||
Before finding out about the Debian version I was on the lookout for a really
|
||||
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!
|
||||
|
||||
In 2000 Jim Studt packaged libeditline for Debian[1], the exact origin of the Debian
|
||||
code base is unclear, see the Sid package[2] for details. There were some notable
|
||||
differences between that version and the upstream Minix sources, all of which have
|
||||
now been merged here.
|
||||
In 2000 Jim Studt packaged libeditline for Debian[1], the exact origin of the
|
||||
Debian code base is unclear, see the Sid package[2] for details. There were
|
||||
some notable differences between that version and the upstream Minix sources,
|
||||
all of which have now been merged here.
|
||||
|
||||
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 package and a
|
||||
different versioning scheme. In June 2009, I decided to line up alongside Debian,
|
||||
with the intent of merging the efforts. Sorry for any confusion this might cause.
|
||||
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
|
||||
package and a different versioning scheme. In June 2009, I decided to line up
|
||||
alongside Debian, with the intent of merging the efforts. Sorry for any
|
||||
confusion this might cause.
|
||||
|
||||
Enjoy,
|
||||
Joachim Nilsson <troglobit()vmlinux!org>
|
||||
|
10
TODO
10
TODO
@@ -1,6 +1,12 @@
|
||||
TODO
|
||||
|
||||
* Add --enable-FEATURE for remaining features defined in Makefile-minix.in
|
||||
* Add support for rl_bind_key(), currently one needs to "hack" the Map[]
|
||||
* Port "fileman" example from BSD libedit, http://www.thrysoee.dk/editline/
|
||||
* 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.
|
||||
* Add support for inhibiting completion: rl_inhibit_completion
|
||||
* Make "char *rl_prompt" globally visible.
|
||||
* Add support for rl_set_prompt().
|
||||
* Add support for --enable-utf8 to configure
|
||||
* 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
|
||||
|
||||
|
15
aclocal.m4
vendored
15
aclocal.m4
vendored
@@ -1,4 +1,4 @@
|
||||
# generated automatically by aclocal 1.11 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
|
||||
[m4_warning([this file was generated for autoconf 2.64.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
|
||||
[m4_warning([this file was generated for autoconf 2.65.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
@@ -34,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11], [],
|
||||
m4_if([$1], [1.11.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -50,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.11.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
@@ -976,3 +976,8 @@ AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([m4/libtool.m4])
|
||||
m4_include([m4/ltoptions.m4])
|
||||
m4_include([m4/ltsugar.m4])
|
||||
m4_include([m4/ltversion.m4])
|
||||
m4_include([m4/lt~obsolete.m4])
|
||||
|
1533
config.guess
vendored
Executable file
1533
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
41
config.h.in
41
config.h.in
@@ -1,15 +1,39 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to include ANSI arrow keys support in minix-editline */
|
||||
#undef ANSI_ARROWS
|
||||
/* Default visibility */
|
||||
#undef API_EXPORTED
|
||||
|
||||
/* 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 the default completion handler. */
|
||||
#undef CONFIG_DEFAULT_COMPLETE
|
||||
|
||||
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
||||
#undef CONFIG_SIGSTOP
|
||||
|
||||
/* Define to skip duplicate lines in the scrollback history. */
|
||||
#undef CONFIG_UNIQUE_HISTORY
|
||||
|
||||
/* Define to use the termcap library for terminal size. */
|
||||
#undef CONFIG_USE_TERMCAP
|
||||
|
||||
/* Define to 1 if `TIOCGWINSZ' requires <sys/ioctl.h>. */
|
||||
#undef GWINSZ_IN_SYS_IOCTL
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@@ -19,6 +43,9 @@
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <ncurses/termcap.h> header file. */
|
||||
#undef HAVE_NCURSES_TERMCAP_H
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
@@ -73,6 +100,9 @@
|
||||
/* Define to 1 if you have the `tcgetattr' function. */
|
||||
#undef HAVE_TCGETATTR
|
||||
|
||||
/* Define to 1 if you have the <termcap.h> header file. */
|
||||
#undef HAVE_TERMCAP_H
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
@@ -82,13 +112,14 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Enable static keyword, hides internal methods. */
|
||||
#undef HIDE
|
||||
|
||||
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
||||
slash. */
|
||||
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
|
1693
config.sub
vendored
Executable file
1693
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
163
configure.ac
163
configure.ac
@@ -1,10 +1,22 @@
|
||||
# Minix libeditline -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (c) 2008-2010 Joachim Nilsson <troglobit()vmlinux!org>
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT(editline, 1.13.0, joachim.nilsson@vmlinux.org)
|
||||
AC_INIT(editline, 1.14.0-rc1, troglobit@vmlinux.org)
|
||||
AC_CONFIG_SRCDIR([src/editline.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# Prepare automake
|
||||
AM_INIT_AUTOMAKE([dist-bzip2 dist-lzma])
|
||||
@@ -14,59 +26,150 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Checks for libraries.
|
||||
LT_INIT
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STAT
|
||||
AC_HEADER_STDC
|
||||
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
||||
# mess up the traditional malloc check.
|
||||
AC_CHECK_HEADERS([malloc.h signal.h sgtty.h stdlib.h string.h termio.h termios.h])
|
||||
AC_CHECK_HEADERS([malloc.h signal.h stdlib.h string.h termcap.h termio.h termios.h sgtty.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STAT
|
||||
# In termios.h or in sys/ioctl.g?
|
||||
AC_HEADER_TIOCGWINSZ
|
||||
|
||||
# Overrides and types, should be a check.
|
||||
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
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
||||
# mess up the traditional malloc check.
|
||||
#AC_FUNC_MALLOC
|
||||
#AC_FUNC_REALLOC
|
||||
AC_FUNC_STAT
|
||||
AC_CHECK_FUNCS([strchr strdup strrchr tcgetattr perror])
|
||||
|
||||
AC_ARG_ENABLE([default-complete],
|
||||
[ --enable-default-complete Enable default completion handler.],[
|
||||
case "${enableval}" in
|
||||
yes)
|
||||
complete=true
|
||||
;;
|
||||
no)
|
||||
complete=false
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([bad value ${enableval} for --enable-default-complete])
|
||||
;;
|
||||
esac],[complete=false])
|
||||
AM_CONDITIONAL([COMPLETE], [test x$complete = xtrue])
|
||||
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,
|
||||
[AS_HELP_STRING([--disable-default-complete], [Disable default (filename) completion handler.])],
|
||||
, AC_DEFINE(CONFIG_DEFAULT_COMPLETE, 1, [Define to enable the default completion handler.]))
|
||||
|
||||
ac_enable_arrow_keys=no
|
||||
AC_ARG_ENABLE(arrow-keys,
|
||||
[ --enable-arrow-keys Enable ANSI arrow keys.],
|
||||
[ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no])
|
||||
[AS_HELP_STRING([--disable-arrow-keys], [Disable ANSI arrow keys.])],
|
||||
, AC_DEFINE(CONFIG_ANSI_ARROWS, 1, [Define to include ANSI arrow keys support.]))
|
||||
|
||||
if test "x${ac_enable_arrow_keys}" = xyes ; then
|
||||
AC_DEFINE([ANSI_ARROWS], [],
|
||||
[Define to include ANSI arrow keys support in minix-editline])
|
||||
AC_ARG_ENABLE(sigstop,
|
||||
[AS_HELP_STRING([--enable-sigstop], [Enable SIGSTOP key.])],
|
||||
AC_DEFINE([CONFIG_SIGSTOP], 1, [Define to enable SIGSTOP (Ctrl-Z) key.]))
|
||||
|
||||
AC_ARG_ENABLE(terminal-bell,
|
||||
[AS_HELP_STRING([--enable-terminal-bell], [Enable terminal bell on completion.])],
|
||||
AC_DEFINE([CONFIG_ANNOYING_NOISE], 1, [Define to enable terminal bell on completion.]))
|
||||
|
||||
AC_ARG_ENABLE(termcap,
|
||||
[AS_HELP_STRING([--enable-termcap], [Use termcap library to query terminal size.])],
|
||||
AC_DEFINE([CONFIG_USE_TERMCAP], 1, [Define to use the termcap library for terminal size.]))
|
||||
|
||||
# Restore gnu89 inline semantics on gcc 4.3 and newer
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fgnu89-inline"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
|
||||
[VISIBILITY_CFLAGS="-fvisibility=hidden"
|
||||
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility]) ],
|
||||
[ VISIBILITY_CFLAGS=""
|
||||
AC_DEFINE([API_EXPORTED], [], [Default visibility]) ],
|
||||
])
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# check for -Wno-pointer-sign compiler support (GCC >= 4)
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wno-pointer-sign"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
|
||||
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow -Wcast-qual"
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
### The following magic for determining the location of termcap library is from GNU Texinfo
|
||||
### http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||
if test x$enable_termcap = "xyes"; then
|
||||
# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
|
||||
# rather ncurses. So we check for it.
|
||||
TERMLIBS=
|
||||
# Check for termlib before termcap because Solaris termcap needs libucb.
|
||||
TERMLIB_VARIANTS="termlib termcap terminfo ncurses curses"
|
||||
for termlib in ${TERMLIB_VARIANTS}; do
|
||||
AC_CHECK_LIB(${termlib}, tgetent,
|
||||
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
|
||||
done
|
||||
# don't bother warning on djgpp, it doesn't have a term library, it
|
||||
# ports each termcap-needing program separately according to its needs.
|
||||
if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
|
||||
AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}])
|
||||
fi
|
||||
|
||||
# Checks for variables.
|
||||
# HP-UX 9 (at least) needs -lncurses which defines termcap variables PC etc.
|
||||
AC_MSG_CHECKING(for library with termcap variables)
|
||||
AC_CACHE_VAL(ac_cv_var_ospeed,
|
||||
[oldLIBS=$LIBS
|
||||
for trylib in $termlib ${TERMLIB_VARIANTS}; do
|
||||
if test "x$trylib" != "x$termlib"; then
|
||||
LIBS="$oldLIBS -l$termlib -l$trylib"
|
||||
else
|
||||
LIBS="$oldLIBS -l$termlib"
|
||||
fi
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[#ifdef HAVE_NCURSES_TERMCAP_H
|
||||
#include <ncurses/termcap.h>
|
||||
#else
|
||||
#ifdef HAVE_TERMCAP_H
|
||||
#include <termcap.h>
|
||||
#else
|
||||
#undef PC
|
||||
char *BC;
|
||||
char **UP;
|
||||
char PC;
|
||||
short ospeed;
|
||||
#endif
|
||||
#endif
|
||||
/* Make sure all variables actually exist. AIX 4.3 has ospeed but no BC.
|
||||
--Andreas Ley <andy@rz.uni-karlsruhe.de> 24 Aug 2000. */
|
||||
BC++;
|
||||
UP++;
|
||||
PC++;
|
||||
return ospeed != 0;
|
||||
]])], [ac_cv_var_ospeed=$trylib; break])
|
||||
done
|
||||
LIBS=$oldLIBS
|
||||
])
|
||||
AC_MSG_RESULT($ac_cv_var_ospeed)
|
||||
if test -n "$ac_cv_var_ospeed" \
|
||||
&& test "x$termlib" != "x$ac_cv_var_ospeed"; then
|
||||
TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
|
||||
fi
|
||||
AC_SUBST(TERMLIBS)#
|
||||
fi
|
||||
|
||||
# Do not use <ncurses/termcap.h> unless we're linking with ncurses.
|
||||
# Must come after the termlib tests.
|
||||
if test "x$termlib" = xncurses; then
|
||||
# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
|
||||
AC_CHECK_HEADERS(ncurses/termcap.h)
|
||||
fi
|
||||
### End-of-Termcap magic from http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
||||
|
||||
|
9
debian/changelog
vendored
9
debian/changelog
vendored
@@ -1,3 +1,12 @@
|
||||
editline (1.12-6) unstable; urgency=low
|
||||
|
||||
* Switch package format to 3.0 (quilt).
|
||||
* 200_fix-truncation-at-64-char.diff: fix invalid 64-char truncation in
|
||||
batch mode, courtesy of Mark O'Donohue. Thanks to Damyan Ivanov for
|
||||
forwarding the patch from Ubuntu (Closes: #508640).
|
||||
|
||||
-- Sam Hocevar <sho@debian.org> Sun, 03 Jan 2010 15:45:34 +0100
|
||||
|
||||
editline (1.12-5) unstable; urgency=low
|
||||
|
||||
* New maintainer (Closes: #229962).
|
||||
|
2
debian/compat
vendored
2
debian/compat
vendored
@@ -1 +1 @@
|
||||
4
|
||||
5
|
||||
|
10
debian/control
vendored
10
debian/control
vendored
@@ -1,14 +1,14 @@
|
||||
Source: editline
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Build-Depends: debhelper (>= 4.0), libtool
|
||||
Maintainer: Sam Hocevar (Debian packages) <sam+deb@zoy.org>
|
||||
Standards-Version: 3.6.1.0
|
||||
Build-Depends: debhelper (>= 5.0), libtool
|
||||
Maintainer: Sam Hocevar <sho@debian.org>
|
||||
Standards-Version: 3.8.3
|
||||
|
||||
Package: libeditline-dev
|
||||
Architecture: any
|
||||
Section: libdevel
|
||||
Depends: libeditline0 (= ${Source-Version})
|
||||
Depends: libeditline0 (= ${binary:Version}), ${misc:Depends}
|
||||
Description: development files for libeditline
|
||||
This is a line-editing library. It can be linked into almost any program
|
||||
to provide command-line editing and recall. It is call-compatible with a
|
||||
@@ -21,7 +21,7 @@ Description: development files for libeditline
|
||||
Package: libeditline0
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: line editing library similar to readline
|
||||
This is a line-editing library. It can be linked into almost any program
|
||||
to provide command-line editing and recall. It is call-compatible with a
|
||||
|
9
debian/rules
vendored
9
debian/rules
vendored
@@ -19,7 +19,7 @@ clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
-$(MAKE) clean
|
||||
[ ! -f Makefile ] || $(MAKE) clean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -34,21 +34,18 @@ install: build
|
||||
binary-indep: build install
|
||||
|
||||
binary-arch: build install
|
||||
# dh_testversion
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
|
||||
# build libeditline${major} package by moving files from editline-dev
|
||||
# build libeditline${major} package by moving files from editline-dev
|
||||
dh_movefiles --sourcedir=debian/libeditline-dev \
|
||||
-plibeditline$(major) \
|
||||
usr/lib/libeditline.so.$(major) \
|
||||
usr/lib/libeditline.so.$(version)
|
||||
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
dh_installmenu
|
||||
dh_installmanpages
|
||||
rm -r debian/libeditline0/usr/share/man/
|
||||
rm -rf debian/libeditline0/usr/share/man/
|
||||
dh_installcron
|
||||
dh_installinfo
|
||||
dh_installchangelogs
|
||||
|
@@ -1,7 +1,6 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
LDADD = $(top_builddir)/src/libeditline.a
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
|
||||
# TODO: Port "fileman" example from BSD editline
|
||||
noinst_PROGRAMS = testit cli
|
||||
noinst_PROGRAMS = testit cli fileman
|
||||
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = -static
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -32,11 +32,16 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
noinst_PROGRAMS = testit$(EXEEXT) cli$(EXEEXT)
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = testit$(EXEEXT) cli$(EXEEXT) fileman$(EXEEXT)
|
||||
subdir = examples
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -47,17 +52,32 @@ PROGRAMS = $(noinst_PROGRAMS)
|
||||
cli_SOURCES = cli.c
|
||||
cli_OBJECTS = cli.$(OBJEXT)
|
||||
cli_LDADD = $(LDADD)
|
||||
cli_DEPENDENCIES = $(top_builddir)/src/libeditline.a
|
||||
am__DEPENDENCIES_1 =
|
||||
cli_DEPENDENCIES = $(top_builddir)/src/libeditline.la \
|
||||
$(am__DEPENDENCIES_1)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
fileman_SOURCES = fileman.c
|
||||
fileman_OBJECTS = fileman.$(OBJEXT)
|
||||
fileman_LDADD = $(LDADD)
|
||||
fileman_DEPENDENCIES = $(top_builddir)/src/libeditline.la \
|
||||
$(am__DEPENDENCIES_1)
|
||||
testit_SOURCES = testit.c
|
||||
testit_OBJECTS = testit.$(OBJEXT)
|
||||
testit_LDADD = $(LDADD)
|
||||
testit_DEPENDENCIES = $(top_builddir)/src/libeditline.a
|
||||
testit_DEPENDENCIES = $(top_builddir)/src/libeditline.la \
|
||||
$(am__DEPENDENCIES_1)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
@@ -65,21 +85,25 @@ AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = cli.c testit.c
|
||||
DIST_SOURCES = cli.c testit.c
|
||||
SOURCES = cli.c fileman.c testit.c
|
||||
DIST_SOURCES = cli.c fileman.c testit.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -92,24 +116,36 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
@@ -119,29 +155,40 @@ PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TERMLIBS = @TERMLIBS@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -150,6 +197,7 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -166,12 +214,12 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
LDADD = $(top_builddir)/src/libeditline.a
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||
AM_LDFLAGS = -static
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
@@ -204,10 +252,19 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
cli$(EXEEXT): $(cli_OBJECTS) $(cli_DEPENDENCIES)
|
||||
@rm -f cli$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(cli_OBJECTS) $(cli_LDADD) $(LIBS)
|
||||
fileman$(EXEEXT): $(fileman_OBJECTS) $(fileman_DEPENDENCIES)
|
||||
@rm -f fileman$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(fileman_OBJECTS) $(fileman_LDADD) $(LIBS)
|
||||
testit$(EXEEXT): $(testit_OBJECTS) $(testit_DEPENDENCIES)
|
||||
@rm -f testit$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(testit_OBJECTS) $(testit_LDADD) $(LIBS)
|
||||
@@ -219,6 +276,7 @@ distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cli.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileman.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testit.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@@ -237,6 +295,20 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
@@ -350,7 +422,8 @@ maintainer-clean-generic:
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
@@ -405,7 +478,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
@@ -420,17 +494,17 @@ uninstall-am:
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstPROGRAMS ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am
|
||||
clean-libtool clean-noinstPROGRAMS ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
@@ -1,16 +1,36 @@
|
||||
/* 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>
|
||||
|
||||
char *list[] = {
|
||||
#define HISTORY "/tmp/.cli-history"
|
||||
|
||||
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.
|
||||
*/
|
||||
char *my_rl_complete(char *token, int *match)
|
||||
/* 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;
|
||||
int index = -1;
|
||||
@@ -38,10 +58,8 @@ char *my_rl_complete(char *token, int *match)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
int my_rl_list_possib(char *token, char ***av)
|
||||
/* Return all possible completions. */
|
||||
static int my_rl_list_possib(char *token, char ***av)
|
||||
{
|
||||
int i, num, total = 0;
|
||||
char **copy;
|
||||
@@ -62,19 +80,45 @@ int my_rl_list_possib(char *token, char ***av)
|
||||
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)))
|
||||
{
|
||||
char *line;
|
||||
char *prompt = "cli> ";
|
||||
|
||||
/* Setup callbacks */
|
||||
rl_complete = &my_rl_complete;
|
||||
rl_list_possib = &my_rl_list_possib;
|
||||
rl_set_complete_func(&my_rl_complete);
|
||||
rl_set_list_possib_func(&my_rl_list_possib);
|
||||
el_bind_key('?', list_possible);
|
||||
read_history(HISTORY);
|
||||
|
||||
while ((line = readline(prompt)) != NULL) {
|
||||
(void)printf("\t\t\t|%s|\n", line);
|
||||
printf("\t\t\t|%s|\n", line);
|
||||
free(line);
|
||||
}
|
||||
|
||||
write_history(HISTORY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
499
examples/fileman.c
Normal file
499
examples/fileman.c
Normal file
@@ -0,0 +1,499 @@
|
||||
/* fileman.c -- A tiny application which demonstrates how to use the
|
||||
GNU Readline library. This application interactively allows users
|
||||
to manipulate files and their modes.
|
||||
|
||||
NOTE: this was taken from the GNU Readline documentation and ported
|
||||
to libedit. A commad to output the history list was added.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
/* GNU readline
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
*/
|
||||
/* NetBSD libedit
|
||||
#include <editline/readline.h>
|
||||
*/
|
||||
#include <editline.h>
|
||||
|
||||
void * xmalloc (size_t size);
|
||||
void too_dangerous (char *caller);
|
||||
void initialize_readline ();
|
||||
int execute_line (char *line);
|
||||
int valid_argument (char *caller, char *arg);
|
||||
|
||||
typedef int rl_icpfunc_t (char *);
|
||||
|
||||
/* The names of functions that actually do the manipulation. */
|
||||
int com_list (char *);
|
||||
int com_view (char *);
|
||||
int com_history (char *);
|
||||
int com_rename(char *);
|
||||
int com_stat(char *);
|
||||
int com_pwd(char *);
|
||||
int com_delete(char *);
|
||||
int com_help(char *);
|
||||
int com_cd(char *);
|
||||
int com_quit(char *);
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
|
||||
typedef struct {
|
||||
char *name; /* User printable name of the function. */
|
||||
rl_icpfunc_t *func; /* Function to call to do the job. */
|
||||
char *doc; /* Documentation for this function. */
|
||||
} COMMAND;
|
||||
|
||||
COMMAND commands[] = {
|
||||
{ "cd", com_cd, "Change to directory DIR" },
|
||||
{ "delete", com_delete, "Delete FILE" },
|
||||
{ "help", com_help, "Display this text" },
|
||||
{ "?", com_help, "Synonym for `help'" },
|
||||
{ "list", com_list, "List files in DIR" },
|
||||
{ "ls", com_list, "Synonym for `list'" },
|
||||
{ "pwd", com_pwd, "Print the current working directory" },
|
||||
{ "quit", com_quit, "Quit using Fileman" },
|
||||
{ "rename", com_rename, "Rename FILE to NEWNAME" },
|
||||
{ "stat", com_stat, "Print out statistics on FILE" },
|
||||
{ "view", com_view, "View the contents of FILE" },
|
||||
{ "history", com_history, "List editline history" },
|
||||
{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
char *stripwhite ();
|
||||
COMMAND *find_command ();
|
||||
|
||||
/* The name of this program, as taken from argv[0]. */
|
||||
char *progname;
|
||||
|
||||
/* When non-zero, this means the user is done using this program. */
|
||||
int done;
|
||||
|
||||
char *
|
||||
dupstr (char* s)
|
||||
{
|
||||
char *r;
|
||||
|
||||
r = xmalloc (strlen (s) + 1);
|
||||
strcpy (r, s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
initialize_readline(); /* Bind our completer. */
|
||||
|
||||
stifle_history(7);
|
||||
|
||||
/* Loop reading and executing lines until the user quits. */
|
||||
for ( ; done == 0; )
|
||||
{
|
||||
line = readline ("FileMan: ");
|
||||
|
||||
if (!line)
|
||||
break;
|
||||
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
s = stripwhite(line);
|
||||
|
||||
if (*s) {
|
||||
|
||||
char* expansion;
|
||||
int result;
|
||||
|
||||
result = history_expand(s, &expansion);
|
||||
|
||||
if (result < 0 || result == 2) {
|
||||
fprintf(stderr, "%s\n", expansion);
|
||||
} else {
|
||||
add_history(expansion);
|
||||
execute_line(expansion);
|
||||
}
|
||||
free(expansion);
|
||||
}
|
||||
|
||||
free(line);
|
||||
}
|
||||
exit (0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Execute a command line. */
|
||||
int
|
||||
execute_line (char *line)
|
||||
{
|
||||
register int i;
|
||||
COMMAND *command;
|
||||
char *word;
|
||||
|
||||
/* Isolate the command word. */
|
||||
i = 0;
|
||||
while (line[i] && isspace (line[i]))
|
||||
i++;
|
||||
word = line + i;
|
||||
|
||||
while (line[i] && !isspace (line[i]))
|
||||
i++;
|
||||
|
||||
if (line[i])
|
||||
line[i++] = '\0';
|
||||
|
||||
command = find_command (word);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
fprintf (stderr, "%s: No such command for FileMan.\n", word);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Get argument to command, if any. */
|
||||
while (isspace (line[i]))
|
||||
i++;
|
||||
|
||||
word = line + i;
|
||||
|
||||
/* Call the function. */
|
||||
return ((*(command->func)) (word));
|
||||
}
|
||||
|
||||
/* Look up NAME as the name of a command, and return a pointer to that
|
||||
command. Return a NULL pointer if NAME isn't a command name. */
|
||||
COMMAND *
|
||||
find_command (char *name)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
if (strcmp (name, commands[i].name) == 0)
|
||||
return (&commands[i]);
|
||||
|
||||
return ((COMMAND *)NULL);
|
||||
}
|
||||
|
||||
/* Strip whitespace from the start and end of STRING. Return a pointer
|
||||
into STRING. */
|
||||
char *
|
||||
stripwhite (char *string)
|
||||
{
|
||||
register char *s, *t;
|
||||
|
||||
for (s = string; isspace (*s); s++)
|
||||
;
|
||||
|
||||
if (*s == 0)
|
||||
return (s);
|
||||
|
||||
t = s + strlen (s) - 1;
|
||||
while (t > s && isspace (*t))
|
||||
t--;
|
||||
*++t = '\0';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Interface to Readline Completion */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *command_generator(const char *, int);
|
||||
char **fileman_completion(const char *, int, int);
|
||||
|
||||
/* Tell the GNU Readline library how to complete. We want to try to
|
||||
complete on command names if this is the first word in the line, or
|
||||
on filenames if not. */
|
||||
void
|
||||
initialize_readline ()
|
||||
{
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "FileMan";
|
||||
|
||||
/* Tell the completer that we want a crack first. */
|
||||
rl_attempted_completion_function = fileman_completion;
|
||||
}
|
||||
|
||||
/* Attempt to complete on the contents of TEXT. START and END
|
||||
bound the region of rl_line_buffer that contains the word to
|
||||
complete. TEXT is the word to complete. We can use the entire
|
||||
contents of rl_line_buffer in case we want to do some simple
|
||||
parsing. Returnthe array of matches, or NULL if there aren't any. */
|
||||
char **
|
||||
fileman_completion (const char* text, int start, int end)
|
||||
{
|
||||
char **matches;
|
||||
|
||||
matches = (char **)NULL;
|
||||
|
||||
/* If this word is at the start of the line, then it is a command
|
||||
to complete. Otherwise it is the name of a file in the current
|
||||
directory. */
|
||||
if (start == 0)
|
||||
/* TODO */
|
||||
matches = completion_matches (text, command_generator);
|
||||
/* matches = rl_completion_matches (text, command_generator); */
|
||||
|
||||
return (matches);
|
||||
}
|
||||
|
||||
/* Generator function for command completion. STATE lets us
|
||||
know whether to start from scratch; without any state
|
||||
(i.e. STATE == 0), then we start at the top of the list. */
|
||||
char *
|
||||
command_generator (text, state)
|
||||
const char *text;
|
||||
int state;
|
||||
{
|
||||
static int list_index, len;
|
||||
char *name;
|
||||
|
||||
/* If this is a new word to complete, initialize now. This
|
||||
includes saving the length of TEXT for efficiency, and
|
||||
initializing the index variable to 0. */
|
||||
if (!state)
|
||||
{
|
||||
list_index = 0;
|
||||
len = strlen (text);
|
||||
}
|
||||
|
||||
/* Return the next name which partially matches from the
|
||||
command list. */
|
||||
while (name = commands[list_index].name)
|
||||
{
|
||||
list_index++;
|
||||
|
||||
if (strncmp (name, text, len) == 0)
|
||||
return (dupstr(name));
|
||||
}
|
||||
|
||||
/* If no names matched, then return NULL. */
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* FileMan Commands */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* String to pass to system (). This is for the LIST, VIEW and RENAME
|
||||
commands. */
|
||||
static char syscom[1024];
|
||||
|
||||
/* List the file(s) named in arg. */
|
||||
int
|
||||
com_list (char *arg)
|
||||
{
|
||||
if (!arg)
|
||||
arg = "";
|
||||
|
||||
sprintf (syscom, "ls -FClg %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
int
|
||||
com_view (char *arg)
|
||||
{
|
||||
if (!valid_argument ("view", arg))
|
||||
return 1;
|
||||
|
||||
sprintf (syscom, "more %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
int
|
||||
com_history(char* arg)
|
||||
{
|
||||
HIST_ENTRY *he;
|
||||
|
||||
/* rewind history */
|
||||
while (next_history())
|
||||
;
|
||||
|
||||
for (he = current_history(); he != NULL; he = previous_history()) {
|
||||
//printf("%5d %s\n", *((int*)he->data) - 1, he->line);
|
||||
printf("%s\n", he->line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
com_rename (char *arg)
|
||||
{
|
||||
too_dangerous ("rename");
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
com_stat (char *arg)
|
||||
{
|
||||
struct stat finfo;
|
||||
|
||||
if (!valid_argument ("stat", arg))
|
||||
return (1);
|
||||
|
||||
if (stat (arg, &finfo) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return (1);
|
||||
}
|
||||
|
||||
printf ("Statistics for `%s':\n", arg);
|
||||
|
||||
printf ("%s has %ld link%s, and is %lld byte%s in length.\n", arg,
|
||||
(long) finfo.st_nlink,
|
||||
(finfo.st_nlink == 1) ? "" : "s",
|
||||
(long long) finfo.st_size,
|
||||
(finfo.st_size == 1) ? "" : "s");
|
||||
printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
|
||||
printf (" Last access at: %s", ctime (&finfo.st_atime));
|
||||
printf (" Last modified at: %s", ctime (&finfo.st_mtime));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
com_delete (char *arg)
|
||||
{
|
||||
too_dangerous ("delete");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Print out help for ARG, or for all of the commands if ARG is
|
||||
not present. */
|
||||
int
|
||||
com_help (char *arg)
|
||||
{
|
||||
register int i;
|
||||
int printed = 0;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
if (!*arg || (strcmp (arg, commands[i].name) == 0))
|
||||
{
|
||||
printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
|
||||
printed++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!printed)
|
||||
{
|
||||
printf ("No commands match `%s'. Possibilties are:\n", arg);
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
/* Print in six columns. */
|
||||
if (printed == 6)
|
||||
{
|
||||
printed = 0;
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
printf ("%s\t", commands[i].name);
|
||||
printed++;
|
||||
}
|
||||
|
||||
if (printed)
|
||||
printf ("\n");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Change to the directory ARG. */
|
||||
int
|
||||
com_cd (char *arg)
|
||||
{
|
||||
if (chdir (arg) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
com_pwd ("");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Print out the current working directory. */
|
||||
int
|
||||
com_pwd (char* ignore)
|
||||
{
|
||||
char dir[1024], *s;
|
||||
|
||||
s = (char*)getcwd(dir, sizeof(dir) - 1);
|
||||
if (s == 0)
|
||||
{
|
||||
printf ("Error getting pwd: %s\n", dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("Current directory is %s\n", dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The user wishes to quit using this program. Just set DONE
|
||||
non-zero. */
|
||||
int
|
||||
com_quit (char *arg)
|
||||
{
|
||||
done = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Function which tells you that you can't do this. */
|
||||
void
|
||||
too_dangerous (char *caller)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: Too dangerous for me to distribute.\n",
|
||||
caller);
|
||||
fprintf (stderr, "Write it yourself.\n");
|
||||
}
|
||||
|
||||
/* Return non-zero if ARG is a valid argument for CALLER,
|
||||
else print an error message and return zero. */
|
||||
int
|
||||
valid_argument (char *caller, char *arg)
|
||||
{
|
||||
if (!arg || !*arg)
|
||||
{
|
||||
fprintf (stderr, "%s: Argument required.\n", caller);
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void *
|
||||
xmalloc (size_t size)
|
||||
{
|
||||
register void *value = (void*)malloc(size);
|
||||
if (value == 0)
|
||||
fprintf(stderr, "virtual memory exhausted");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
99
examples/testit.c
Executable file → Normal file
99
examples/testit.c
Executable file → Normal file
@@ -1,74 +1,64 @@
|
||||
/* $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>
|
||||
#if defined(HAVE_STDLIB_H)
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if defined(HAVE_STRING_H)
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "editline.h"
|
||||
|
||||
extern char *readline();
|
||||
extern void add_history();
|
||||
|
||||
#if !defined(HAVE_STDLIB_H)
|
||||
extern int free();
|
||||
extern int system();
|
||||
extern void exit();
|
||||
extern char *getenv();
|
||||
#endif /* !defined(HAVE_STDLIB) */
|
||||
#if !defined(HAVE_STRING_H)
|
||||
extern int strncmp();
|
||||
#endif
|
||||
#if !defined(HAVE_UNISTD_H)
|
||||
extern int chdir();
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_PERROR)
|
||||
void
|
||||
perror(s)
|
||||
char *s;
|
||||
#ifndef HAVE_PERROR
|
||||
extern int errno;
|
||||
void perror(char *s)
|
||||
{
|
||||
extern int errno;
|
||||
|
||||
(voidf)printf(stderr, "%s: error %d\n", s, errno);
|
||||
fprintf(stderr, "%s: error %d\n", s, errno);
|
||||
}
|
||||
#endif /* defined(NEED_PERROR) */
|
||||
#endif /* !HAVE_PERROR */
|
||||
|
||||
|
||||
/* ARGSUSED1 */
|
||||
int
|
||||
main(ac, av)
|
||||
int ac;
|
||||
char *av[] __attribute__ ((unused));
|
||||
int main(int argc, char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
char *prompt;
|
||||
char *p;
|
||||
int doit;
|
||||
int doit;
|
||||
char *prompt, *p;
|
||||
|
||||
doit = ac == 1;
|
||||
doit = argc == 1;
|
||||
if ((prompt = getenv("TESTPROMPT")) == NULL)
|
||||
prompt = "testit> ";
|
||||
prompt = "testit> ";
|
||||
|
||||
while ((p = readline(prompt)) != NULL) {
|
||||
(void)printf("\t\t\t|%s|\n", p);
|
||||
printf("\t\t\t|%s|\n", p);
|
||||
if (doit) {
|
||||
if (strncmp(p, "cd ", 3) == 0) {
|
||||
if (chdir(&p[3]) < 0) {
|
||||
if (chdir(&p[3]) < 0)
|
||||
perror(&p[3]);
|
||||
}
|
||||
}
|
||||
else if (system(p) != 0) {
|
||||
} else if (system(p) != 0) {
|
||||
perror(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_history(p);
|
||||
free(p);
|
||||
}
|
||||
@@ -76,6 +66,11 @@ main(ac, av)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* $PchId: testit.c,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||
/**
|
||||
* Local Variables:
|
||||
* version-control: t
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "ellemtel"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -32,11 +32,16 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = include
|
||||
DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -79,7 +84,9 @@ CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -92,24 +99,36 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
@@ -119,29 +138,40 @@ PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TERMLIBS = @TERMLIBS@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -150,6 +180,7 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -201,6 +232,12 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-library_includeHEADERS: $(library_include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(library_includedir)" || $(MKDIR_P) "$(DESTDIR)$(library_includedir)"
|
||||
@@ -338,7 +375,7 @@ maintainer-clean-generic:
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
@@ -390,7 +427,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
@@ -405,16 +442,17 @@ uninstall-am: uninstall-library_includeHEADERS
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
ctags distclean distclean-generic distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-library_includeHEADERS \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
uninstall uninstall-am uninstall-library_includeHEADERS
|
||||
clean-libtool ctags distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-library_includeHEADERS install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-library_includeHEADERS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
@@ -1,19 +1,86 @@
|
||||
/* 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__
|
||||
|
||||
/* Assign these to get command completion, see cli.c for
|
||||
* example usage. */
|
||||
extern char *(*rl_complete)(char *token, int *match);
|
||||
extern int (*rl_list_possib)(char *token, char ***av);
|
||||
/* Command status codes. */
|
||||
typedef enum {
|
||||
CSdone, CSeof, CSmove, CSdispatch, CSstay, CSsignal
|
||||
} el_status_t;
|
||||
|
||||
/* Editline specific types, despite rl_ prefix. From Heimdal project. */
|
||||
typedef char* rl_complete_func_t(char*, int*);
|
||||
typedef int rl_list_possib_func_t(char*, char***);
|
||||
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") */
|
||||
extern int rl_meta_chars;
|
||||
|
||||
/* Editline specific functions. */
|
||||
extern char * el_find_word(void);
|
||||
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 GNU Readline. */
|
||||
extern int rl_point;
|
||||
extern int rl_mark;
|
||||
extern int rl_end;
|
||||
extern char *rl_line_buffer;
|
||||
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_hist_size; /* size of history scrollback buffer, default: 15 */
|
||||
|
||||
/*
|
||||
** For compatibility with FSF readline.
|
||||
*/
|
||||
extern void rl_reset_terminal(char *p);
|
||||
extern void rl_initialize(void);
|
||||
extern void rl_reset_terminal(const char *terminal_name);
|
||||
|
||||
extern void rl_prep_terminal(int meta_flag);
|
||||
extern void rl_deprep_terminal(void);
|
||||
|
||||
extern int rl_getc(void);
|
||||
|
||||
extern char *readline(const char *prompt);
|
||||
extern void add_history(char *line); /* OBSOLETE: Made part of readline(). -- kjb */
|
||||
extern void add_history(const char *line);
|
||||
|
||||
extern int read_history(const char *filename);
|
||||
extern int write_history(const char *filename);
|
||||
|
||||
extern rl_complete_func_t *rl_set_complete_func(rl_complete_func_t *func);
|
||||
extern rl_list_possib_func_t *rl_set_list_possib_func(rl_list_possib_func_t *func);
|
||||
|
||||
extern char *(*rl_completion_entry_function)(const char *text, int state);
|
||||
extern char *rl_filename_completion_function(const char *text, int state);
|
||||
|
||||
extern int rl_attempted_completion_over;
|
||||
extern char **(*rl_attempted_completion_function)(const char *text, int start, int end);
|
||||
|
||||
#endif /* __EDITLINE_H__ */
|
||||
|
7377
m4/libtool.m4
vendored
Normal file
7377
m4/libtool.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
368
m4/ltoptions.m4
vendored
Normal file
368
m4/ltoptions.m4
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [0], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[pic_mode="$withval"],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
123
m4/ltsugar.m4
vendored
Normal file
123
m4/ltsugar.m4
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
23
m4/ltversion.m4
vendored
Normal file
23
m4/ltversion.m4
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3017 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6b])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3017])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.6b'
|
||||
macro_revision='1.3017'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
92
m4/lt~obsolete.m4
vendored
Normal file
92
m4/lt~obsolete.m4
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -31,11 +31,16 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = man
|
||||
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -78,7 +83,9 @@ MANS = $(dist_man_MANS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -91,24 +98,36 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
@@ -118,29 +137,40 @@ PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TERMLIBS = @TERMLIBS@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -149,6 +179,7 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -199,6 +230,12 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man3: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
|
||||
@@ -321,7 +358,7 @@ maintainer-clean-generic:
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
@@ -373,7 +410,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
@@ -389,16 +426,17 @@ uninstall-man: uninstall-man3
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man3 install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
|
||||
uninstall-am uninstall-man uninstall-man3
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-man3 \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
uninstall uninstall-am uninstall-man uninstall-man3
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
106
man/editline.3
106
man/editline.3
@@ -3,54 +3,43 @@
|
||||
editline \- command-line editing library with history
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B "char *"
|
||||
.B "readline(prompt)"
|
||||
.B " char *prompt;"
|
||||
|
||||
.B "void"
|
||||
.B "add_history(line)"
|
||||
.B " char *line;"
|
||||
.B "char *readline(char *prompt);"
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Editline
|
||||
is a library that provides an line-editing interface with text recall.
|
||||
It is intended to be compatible with the
|
||||
is a library that provides an line-editing interface with history.
|
||||
It is intended to be functionally equivalent with the
|
||||
.I readline
|
||||
library provided by the Free Software Foundation, but much smaller.
|
||||
The bulk of this manual page describes the user interface.
|
||||
.PP
|
||||
The
|
||||
.I readline
|
||||
routine returns a line of text with the trailing newline removed.
|
||||
The data is returned in a buffer allocated with
|
||||
.I readline()
|
||||
function displays the given
|
||||
.I prompt
|
||||
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),
|
||||
so the space should be released with
|
||||
.IR free (3)
|
||||
when the calling program is done with it.
|
||||
Before accepting input from the user, the specified
|
||||
.I prompt
|
||||
is displayed on the terminal.
|
||||
.PP
|
||||
Each line returned is copied to the internal history list, unless it happens
|
||||
to be equal to the previous line.
|
||||
to be equal to the previous line. This is configurable if you are building editline
|
||||
from source.
|
||||
.SS "User Interface"
|
||||
A program that uses this library provides a simple emacs-like editing
|
||||
interface to its users.
|
||||
A line may be edited before it is sent to the calling program by typing either
|
||||
control characters or escape sequences.
|
||||
A control character, shown as a caret followed by a letter, is typed by
|
||||
holding down the ``control'' key while the letter is typed.
|
||||
For example, ``^A'' is a control-A.
|
||||
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''.
|
||||
A program that uses this library provides a simple emacs-like editing interface to
|
||||
its users. A line may be edited before it is sent to the calling program by typing
|
||||
either control characters or escape sequences. A control character, shown as a caret
|
||||
followed by a letter, is typed by holding down the ``control'' key while the letter
|
||||
is typed. For example, ``^A'' is a control-A. 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
|
||||
An editing command may be typed anywhere on the line, not just at the
|
||||
beginning.
|
||||
In addition, a return may also be typed anywhere on the line, not just at
|
||||
the end.
|
||||
An editing command may be typed anywhere on the line, not just at the beginning. In
|
||||
addition, a return may also be typed anywhere on the line, not just at the end.
|
||||
.PP
|
||||
Most editing commands may be given a repeat count,
|
||||
.IR n ,
|
||||
@@ -81,8 +70,8 @@ The following control characters are accepted:
|
||||
^M Done with line (alternate return key)
|
||||
^N Get next line from history [n]
|
||||
^P Get previous line from history [n]
|
||||
^R Search backward (forward if [n]) through history for text;
|
||||
\& must start line if text begins with an uparrow
|
||||
^R Search backward (forward if [n]) through history for
|
||||
\& text; must start line if text begins with an uparrow
|
||||
^T Transpose characters
|
||||
^V Insert next character, even if it is an edit command
|
||||
^W Wipe to the mark
|
||||
@@ -102,14 +91,15 @@ ESC\ ^H Delete previous word (backspace key) [n]
|
||||
ESC\ DEL Delete previous word (delete key) [n]
|
||||
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
|
||||
ESC\ \. Get the last (or [n]'th) word from previous line
|
||||
ESC\ \? Show possible completions; see below
|
||||
ESC\ ? Show possible completions; see below
|
||||
ESC\ < Move to start of history
|
||||
ESC\ > Move to end of history
|
||||
ESC\ b Move backward a word [n]
|
||||
ESC\ d Delete word under cursor [n]
|
||||
ESC\ f Move forward a word [n]
|
||||
ESC\ l Make word lowercase [n]
|
||||
ESC\ m Toggle if 8bit chars display normally or with ``M\-'' prefix
|
||||
ESC\ m Toggle if 8bit chars display normally or with an
|
||||
\& ``M\-'' prefix
|
||||
ESC\ u Make word uppercase [n]
|
||||
ESC\ y Yank back last killed text
|
||||
ESC\ v Show library version
|
||||
@@ -164,11 +154,41 @@ for you:
|
||||
.RE
|
||||
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
||||
is shown in italics.
|
||||
.SH "BUGS AND LIMITATIONS"
|
||||
Doesn't know how to handle multiple lines.
|
||||
.SH AUTHORS
|
||||
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
|
||||
and Rich $alz <rsalz@osf.org>.
|
||||
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
|
||||
|
||||
.\" $PchId: editline.3,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||
.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"
|
||||
Doesn't know how to handle multiple lines or unicode characters well. See the TODO
|
||||
file in the distribution if you want to help out.
|
||||
|
||||
.SH AUTHORS
|
||||
The original editline library was created by Simmule R. Turner and Rich $alz. It is
|
||||
now maintained in several forks: Heimdal, Festival speech tools, Mozilla, Google
|
||||
Gadgets for Linux, and many other places. The original manual page was made by DaviD
|
||||
W. Sanderson. This version was made by Joachim Nilsson <troglobit@gmail.com>.
|
||||
|
||||
|
@@ -1,8 +1,3 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
lib_LIBRARIES = libeditline.a
|
||||
libeditline_a_SOURCES = editline.c editline.h sysunix.c unix.h
|
||||
if COMPLETE
|
||||
# Built-in completion handler.
|
||||
libeditline_a_SOURCES += complete.c
|
||||
AM_CPPFLAGS = -DCOMPLETE
|
||||
endif
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
lib_LTLIBRARIES = libeditline.la
|
||||
libeditline_la_SOURCES = editline.c editline.h complete.c sysunix.c unix.h
|
||||
|
184
src/Makefile.in
184
src/Makefile.in
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@@ -32,12 +32,15 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
# Built-in completion handler.
|
||||
@COMPLETE_TRUE@am__append_1 = complete.c
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -66,48 +69,49 @@ am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LIBRARIES = $(lib_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
AM_V_AR = $(am__v_AR_$(V))
|
||||
am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_AR_0 = @echo " AR " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
libeditline_a_AR = $(AR) $(ARFLAGS)
|
||||
libeditline_a_LIBADD =
|
||||
am__libeditline_a_SOURCES_DIST = editline.c editline.h sysunix.c \
|
||||
unix.h complete.c
|
||||
@COMPLETE_TRUE@am__objects_1 = complete.$(OBJEXT)
|
||||
am_libeditline_a_OBJECTS = editline.$(OBJEXT) sysunix.$(OBJEXT) \
|
||||
$(am__objects_1)
|
||||
libeditline_a_OBJECTS = $(am_libeditline_a_OBJECTS)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libeditline_la_LIBADD =
|
||||
am_libeditline_la_OBJECTS = editline.lo complete.lo sysunix.lo
|
||||
libeditline_la_OBJECTS = $(am_libeditline_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(libeditline_a_SOURCES)
|
||||
DIST_SOURCES = $(am__libeditline_a_SOURCES_DIST)
|
||||
SOURCES = $(libeditline_la_SOURCES)
|
||||
DIST_SOURCES = $(libeditline_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -120,24 +124,36 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
@@ -147,29 +163,40 @@ PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TERMLIBS = @TERMLIBS@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -178,6 +205,7 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -194,14 +222,12 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
lib_LIBRARIES = libeditline.a
|
||||
libeditline_a_SOURCES = editline.c editline.h sysunix.c unix.h \
|
||||
$(am__append_1)
|
||||
@COMPLETE_TRUE@AM_CPPFLAGS = -DCOMPLETE
|
||||
lib_LTLIBRARIES = libeditline.la
|
||||
libeditline_la_SOURCES = editline.c editline.h complete.c sysunix.c unix.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
@@ -232,42 +258,39 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLIBRARIES: $(lib_LIBRARIES)
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
|
||||
@$(POST_INSTALL)
|
||||
@list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
$(am__strip_dir) \
|
||||
echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
|
||||
( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
|
||||
else :; fi; \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-libLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(libdir)' && rm -f "$$files" )"; \
|
||||
cd "$(DESTDIR)$(libdir)" && rm -f $$files
|
||||
|
||||
clean-libLIBRARIES:
|
||||
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
|
||||
libeditline.a: $(libeditline_a_OBJECTS) $(libeditline_a_DEPENDENCIES)
|
||||
$(AM_V_at)-rm -f libeditline.a
|
||||
$(AM_V_AR)$(libeditline_a_AR) libeditline.a $(libeditline_a_OBJECTS) $(libeditline_a_LIBADD)
|
||||
$(AM_V_at)$(RANLIB) libeditline.a
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libeditline.la: $(libeditline_la_OBJECTS) $(libeditline_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libeditline_la_OBJECTS) $(libeditline_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
@@ -275,9 +298,9 @@ mostlyclean-compile:
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complete.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editline.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysunix.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complete.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editline.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysunix.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@@ -295,6 +318,20 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
@@ -379,7 +416,7 @@ distdir: $(DISTFILES)
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
@@ -411,7 +448,8 @@ maintainer-clean-generic:
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
@@ -437,7 +475,7 @@ install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLIBRARIES
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
@@ -466,7 +504,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
@@ -476,22 +515,23 @@ ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libLIBRARIES
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-libLIBRARIES install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-libLIBRARIES
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
247
src/complete.c
Executable file → Normal file
247
src/complete.c
Executable file → Normal file
@@ -1,58 +1,50 @@
|
||||
/* $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;
|
||||
/* Wrap strcmp() for qsort() -- weird construct to pass -Wcast-qual */
|
||||
static int compare(const void *p1, const void *p2)
|
||||
{
|
||||
char *new;
|
||||
|
||||
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
||||
(void)strcpy(new, p);
|
||||
return new;
|
||||
}
|
||||
#endif /* defined(NEED_STRDUP) */
|
||||
|
||||
/*
|
||||
** strcmp-like sorting predicate for qsort.
|
||||
*/
|
||||
static int
|
||||
compare(void *p1, void *p2)
|
||||
{
|
||||
char **v1 = (char **)p1;
|
||||
char **v2 = (char **)p2;
|
||||
char *const *v1 = (char *const *)p1;
|
||||
char *const *v2 = (char *const *)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;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
DIRENTRY *ep;
|
||||
SIZE_T ac;
|
||||
SIZE_T len;
|
||||
SIZE_T choices;
|
||||
SIZE_T total;
|
||||
#define MAX_TOTAL (256 << sizeof(char *))
|
||||
size_t ac;
|
||||
size_t len;
|
||||
size_t choices;
|
||||
size_t total;
|
||||
|
||||
if ((dp = opendir(dir)) == NULL)
|
||||
return 0;
|
||||
@@ -70,27 +62,28 @@ 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]);
|
||||
while (ac > 0) free(av[--ac]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ac % MEM_INC) == 0) {
|
||||
if ((new = NEW(char*, ac + MEM_INC)) == NULL) {
|
||||
new = malloc(sizeof(char *) * (ac + MEM_INC));
|
||||
if (!new) {
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
if (ac) {
|
||||
COPYFROMTO(new, av, ac * sizeof (char **));
|
||||
DISPOSE(av);
|
||||
memcpy(new, av, ac * sizeof(char **));
|
||||
free(av);
|
||||
}
|
||||
*avp = av = new;
|
||||
}
|
||||
|
||||
if ((av[ac] = strdup(p)) == NULL) {
|
||||
if (ac == 0)
|
||||
DISPOSE(av);
|
||||
free(av);
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
@@ -98,8 +91,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 +107,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;
|
||||
@@ -134,49 +122,56 @@ SplitPath(path, dirpart, filepart)
|
||||
if ((dpart = strdup(DOT)) == NULL)
|
||||
return -1;
|
||||
if ((fpart = strdup(path)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
free(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ((dpart = strdup(path)) == NULL)
|
||||
return -1;
|
||||
dpart[fpart - path + 1] = '\0';
|
||||
if ((fpart = strdup(++fpart)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
if ((fpart = strdup(fpart + 1)) == NULL) {
|
||||
free(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*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;
|
||||
static rl_complete_func_t *el_complete_func = NULL;
|
||||
|
||||
/* For compatibility with the Heimdal project. */
|
||||
rl_complete_func_t *rl_set_complete_func(rl_complete_func_t *func)
|
||||
{
|
||||
rl_complete_func_t *old = el_complete_func;
|
||||
el_complete_func = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* Attempt to complete the pathname, returning an allocated copy.
|
||||
* Fill in *match if we completed it, or set it to 0 if ambiguous. */
|
||||
char *el_filename_complete(char *pathname, int *match)
|
||||
{
|
||||
char **av;
|
||||
char *dir;
|
||||
char *file;
|
||||
char *new;
|
||||
char *p;
|
||||
SIZE_T ac;
|
||||
SIZE_T end;
|
||||
SIZE_T i;
|
||||
SIZE_T j;
|
||||
SIZE_T len;
|
||||
size_t ac;
|
||||
size_t end;
|
||||
size_t i;
|
||||
size_t j;
|
||||
size_t len;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return NULL;
|
||||
|
||||
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
free(dir);
|
||||
free(file);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -184,21 +179,21 @@ default_rl_complete(pathname, unique)
|
||||
len = strlen(file);
|
||||
if (ac == 1) {
|
||||
/* Exactly one match -- finish it off. */
|
||||
*unique = 1;
|
||||
*match = 1;
|
||||
j = strlen(av[0]) - len + 2;
|
||||
if ((p = NEW(char, j + 1)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
if ((new = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) {
|
||||
(void)strcpy(new, dir);
|
||||
(void)strcat(new, "/");
|
||||
(void)strcat(new, av[0]);
|
||||
p = malloc(sizeof(char) * (j + 1));
|
||||
if (p) {
|
||||
memcpy(p, av[0] + len, j);
|
||||
len = strlen(dir) + strlen(av[0]) + 2;
|
||||
new = malloc(sizeof(char) * len);
|
||||
if (new) {
|
||||
snprintf(new, len, "%s/%s", dir, av[0]);
|
||||
rl_add_slash(new, p);
|
||||
DISPOSE(new);
|
||||
free(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*unique = 0;
|
||||
} else {
|
||||
*match = 0;
|
||||
if (len) {
|
||||
/* Find largest matching substring. */
|
||||
for (i = len, end = strlen(av[0]); i < end; i++)
|
||||
@@ -208,8 +203,9 @@ default_rl_complete(pathname, unique)
|
||||
breakout:
|
||||
if (i > len) {
|
||||
j = i - len + 1;
|
||||
if ((p = NEW(char, j)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
p = malloc(sizeof(char) * j);
|
||||
if (p) {
|
||||
memcpy(p, av[0] + len, j);
|
||||
p[j - 1] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -217,21 +213,39 @@ default_rl_complete(pathname, unique)
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
free(dir);
|
||||
free(file);
|
||||
for (i = 0; i < ac; i++)
|
||||
DISPOSE(av[i]);
|
||||
DISPOSE(av);
|
||||
free(av[i]);
|
||||
free(av);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
int
|
||||
default_rl_list_possib(pathname, avp)
|
||||
char *pathname;
|
||||
char ***avp;
|
||||
char *rl_complete(char *token, int *match)
|
||||
{
|
||||
if (el_complete_func)
|
||||
return el_complete_func(token, match);
|
||||
|
||||
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||
return el_filename_complete(token, match);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static rl_list_possib_func_t *el_list_possib_func = NULL;
|
||||
|
||||
/* 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 *old = el_list_possib_func;
|
||||
el_list_possib_func = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* Default possible completions. */
|
||||
int el_filename_list_possib(char *pathname, char ***av)
|
||||
{
|
||||
char *dir;
|
||||
char *file;
|
||||
@@ -239,12 +253,33 @@ default_rl_list_possib(pathname, avp)
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return 0;
|
||||
ac = FindMatches(dir, file, avp);
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
|
||||
ac = FindMatches(dir, file, av);
|
||||
free(dir);
|
||||
free(file);
|
||||
|
||||
return ac;
|
||||
}
|
||||
|
||||
/*
|
||||
* $PchId: complete.c,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||
/* Return all possible completions. */
|
||||
int rl_list_possib(char *token, char ***av)
|
||||
{
|
||||
if (el_list_possib_func)
|
||||
return el_list_possib_func(token, av);
|
||||
|
||||
#ifdef CONFIG_DEFAULT_COMPLETE
|
||||
return el_filename_list_possib(token, av);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* version-control: t
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "ellemtel"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
1192
src/editline.c
Executable file → Normal file
1192
src/editline.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
102
src/editline.h
Executable file → Normal file
102
src/editline.h
Executable file → Normal file
@@ -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__
|
||||
|
||||
@@ -24,28 +41,23 @@
|
||||
#endif
|
||||
#ifdef SYS_UNIX
|
||||
#include "unix.h"
|
||||
#endif /* defined(SYS_UNIX) */
|
||||
#if defined(SYS_OS9)
|
||||
#endif
|
||||
#ifdef SYS_OS9
|
||||
#include "os9.h"
|
||||
#endif /* defined(SYS_OS9) */
|
||||
#endif
|
||||
/* The following two are for TIOCGWINSZ */
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
# include <termios.h>
|
||||
#endif
|
||||
#ifdef GWINSZ_IN_SYS_IOCTL
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#if !defined(SIZE_T)
|
||||
#define SIZE_T unsigned int
|
||||
#endif /* !defined(SIZE_T) */
|
||||
|
||||
typedef unsigned char CHAR;
|
||||
|
||||
#define MEM_INC 64
|
||||
#define SCREEN_INC 256
|
||||
|
||||
#define DISPOSE(p) free((char *)(p))
|
||||
#define NEW(T, c) \
|
||||
((T *)malloc((unsigned int)(sizeof (T) * (c))))
|
||||
#define RENEW(p, T, c) \
|
||||
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
|
||||
#define COPYFROMTO(new, p, len) \
|
||||
(void)memcpy((char *)(new), (char *)(p), (int)(len))
|
||||
#define MEM_INC 64
|
||||
#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.
|
||||
@@ -55,33 +67,31 @@ extern int rl_erase;
|
||||
extern int rl_intr;
|
||||
extern int rl_kill;
|
||||
extern int rl_quit;
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
extern int rl_susp;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#ifdef COMPLETE
|
||||
extern char *default_rl_complete();
|
||||
extern int default_rl_list_possib(char *pathname, char ***avp);
|
||||
#endif
|
||||
extern void rl_ttyset();
|
||||
extern void rl_add_slash();
|
||||
void rl_ttyset(int Reset);
|
||||
void rl_add_slash(char *path, char *p);
|
||||
char *rl_complete(char *token, int *match);
|
||||
int rl_list_possib(char *token, char ***av);
|
||||
|
||||
#if !defined(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();
|
||||
#endif /* !defined(HAVE_STDLIB) */
|
||||
#ifndef HAVE_STDLIB_H
|
||||
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_H */
|
||||
|
||||
#if defined(NEED_STRDUP)
|
||||
extern char *strdup();
|
||||
#ifndef HAVE_STRDUP
|
||||
extern char *strdup(const char *s);
|
||||
#endif
|
||||
|
||||
#include "../include/editline.h"
|
||||
|
25
src/os9.h
Normal file
25
src/os9.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* 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
Normal file
65
src/sysos9.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* 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:
|
||||
*/
|
169
src/sysunix.c
Executable file → Normal file
169
src/sysunix.c
Executable file → Normal file
@@ -1,136 +1,185 @@
|
||||
/* $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)
|
||||
/* Prefer termios over the others since it is likely the most portable. */
|
||||
#if defined(HAVE_TCGETATTR)
|
||||
#include <termios.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
void rl_ttyset(int Reset)
|
||||
{
|
||||
static struct termios old;
|
||||
struct termios new;
|
||||
|
||||
if (Reset == 0) {
|
||||
if (tcgetattr(0, &old) < 0) perror("tcgetattr");
|
||||
if (!Reset) {
|
||||
if (-1 == tcgetattr(0, &old))
|
||||
perror("Failed tcgetattr");
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_iflag &= ~INPCK;
|
||||
if (rl_meta_chars)
|
||||
new.c_iflag |= ISTRIP;
|
||||
else
|
||||
new.c_iflag &= ~ISTRIP;
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(0, TCSADRAIN, &new) < 0) perror("tcsetattr");
|
||||
if (-1 == tcsetattr(0, TCSADRAIN, &new))
|
||||
perror("Failed tcsetattr");
|
||||
} else {
|
||||
if (-1 == tcsetattr(0, TCSADRAIN, &old))
|
||||
perror("Failed tcsetattr");
|
||||
}
|
||||
else
|
||||
(void)tcsetattr(0, TCSADRAIN, &old);
|
||||
}
|
||||
|
||||
#else
|
||||
#if defined(HAVE_TERMIO_H)
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
#include <termio.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
void rl_ttyset(int Reset)
|
||||
{
|
||||
static struct termio old;
|
||||
struct termio new;
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)ioctl(0, TCGETA, &old);
|
||||
if (!Reset) {
|
||||
if (-1 == ioctl(0, TCGETA, &old))
|
||||
perror("Failed ioctl(TCGETA)");
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_iflag &= ~INPCK;
|
||||
if (rl_meta_chars)
|
||||
new.c_iflag |= ISTRIP;
|
||||
else
|
||||
new.c_iflag &= ~ISTRIP;
|
||||
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
(void)ioctl(0, TCSETAW, &new);
|
||||
if (-1 == ioctl(0, TCSETAW, &new))
|
||||
perror("Failed ioctl(TCSETAW)");
|
||||
} else {
|
||||
if (-1 == ioctl(0, TCSETAW, &old))
|
||||
perror("Failed ioctl(TCSETAW)");
|
||||
}
|
||||
else
|
||||
(void)ioctl(0, TCSETAW, &old);
|
||||
}
|
||||
|
||||
#else
|
||||
#elif defined(HAVE_SGTTY_H)
|
||||
#include <sgtty.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
void rl_ttyset(int Reset)
|
||||
{
|
||||
static struct sgttyb old_sgttyb;
|
||||
static struct tchars old_tchars;
|
||||
struct sgttyb new_sgttyb;
|
||||
struct tchars new_tchars;
|
||||
#if defined(DO_SIGTSTP)
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
struct ltchars old_ltchars;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)ioctl(0, TIOCGETP, &old_sgttyb);
|
||||
if (!Reset) {
|
||||
if (-1 == ioctl(0, TIOCGETP, &old_sgttyb))
|
||||
perror("Failed TIOCGETP");
|
||||
rl_erase = old_sgttyb.sg_erase;
|
||||
rl_kill = old_sgttyb.sg_kill;
|
||||
|
||||
(void)ioctl(0, TIOCGETC, &old_tchars);
|
||||
if (-1 == ioctl(0, TIOCGETC, &old_tchars))
|
||||
perror("Failed TIOCGETC");
|
||||
rl_eof = old_tchars.t_eofc;
|
||||
rl_intr = old_tchars.t_intrc;
|
||||
rl_quit = old_tchars.t_quitc;
|
||||
|
||||
#if defined(DO_SIGTSTP)
|
||||
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
||||
#ifdef CONFIG_SIGSTOP
|
||||
if (-1 == ioctl(0, TIOCGLTC, &old_ltchars))
|
||||
perror("Failed TIOCGLTC");
|
||||
rl_susp = old_ltchars.t_suspc;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#endif
|
||||
|
||||
new_sgttyb = old_sgttyb;
|
||||
new_sgttyb.sg_flags &= ~ECHO;
|
||||
new_sgttyb.sg_flags |= RAW;
|
||||
#if defined(PASS8)
|
||||
new_sgttyb.sg_flags |= PASS8;
|
||||
#endif /* defined(PASS8) */
|
||||
(void)ioctl(0, TIOCSETP, &new_sgttyb);
|
||||
|
||||
if (rl_meta_chars)
|
||||
new_sgttyb.sg_flags &= ~PASS8;
|
||||
else
|
||||
new_sgttyb.sg_flags |= PASS8;
|
||||
if (-1 == ioctl(0, TIOCSETP, &new_sgttyb))
|
||||
perror("Failed TIOCSETP");
|
||||
new_tchars = old_tchars;
|
||||
new_tchars.t_intrc = -1;
|
||||
new_tchars.t_quitc = -1;
|
||||
(void)ioctl(0, TIOCSETC, &new_tchars);
|
||||
}
|
||||
else {
|
||||
(void)ioctl(0, TIOCSETP, &old_sgttyb);
|
||||
(void)ioctl(0, TIOCSETC, &old_tchars);
|
||||
if (-1 == ioctl(0, TIOCSETC, &new_tchars))
|
||||
perror("Failed TIOCSETC");
|
||||
} else {
|
||||
if (-1 == ioctl(0, TIOCSETP, &old_sgttyb))
|
||||
perror("Failed TIOCSETP");
|
||||
if (-1 == ioctl(0, TIOCSETC, &old_tchars))
|
||||
perror("Failed TIOCSETC");
|
||||
}
|
||||
}
|
||||
#endif /* defined(HAVE_TERMIO_H) */
|
||||
#endif /* defined(HAVE_TCGETATTR) */
|
||||
#else /* Neither HAVE_SGTTY_H, HAVE_TERMIO_H or HAVE_TCGETATTR */
|
||||
#error Unsupported platform, missing tcgetattr(), termio.h and sgtty.h
|
||||
#endif /* Neither HAVE_SGTTY_H, HAVE_TERMIO_H or HAVE_TCGETATTR */
|
||||
|
||||
void
|
||||
rl_add_slash(path, p)
|
||||
char *path;
|
||||
char *p;
|
||||
#ifndef HAVE_STRDUP
|
||||
/* Return an allocated copy of a string. */
|
||||
char *strdup(const char *p)
|
||||
{
|
||||
char *new = malloc(sizeof(char) * strlen(p));
|
||||
|
||||
if (new) {
|
||||
strcpy(new, p);
|
||||
return new;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void rl_add_slash(char *path, char *p)
|
||||
{
|
||||
struct stat Sb;
|
||||
|
||||
if (stat(path, &Sb) >= 0)
|
||||
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||
strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||
}
|
||||
|
||||
/*
|
||||
* $PchId: sysunix.c,v 1.4 1996/02/22 21:16:56 philip Exp $
|
||||
/**
|
||||
* Local Variables:
|
||||
* version-control: t
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "ellemtel"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
40
src/unix.h
Executable file → Normal file
40
src/unix.h
Executable file → Normal file
@@ -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,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(USE_DIRENT)
|
||||
#include <dirent.h>
|
||||
typedef struct dirent DIRENTRY;
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
typedef struct direct DIRENTRY;
|
||||
#endif /* defined(USE_DIRENT) */
|
||||
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif /* !defined(S_ISDIR) */
|
||||
|
||||
/*
|
||||
* $PchId: unix.h,v 1.3 1996/02/22 21:18:51 philip Exp $
|
||||
*/
|
||||
#endif /* __EDITLINE_UNIX_H__ */
|
||||
|
Reference in New Issue
Block a user