add docker support
This commit is contained in:
5
dep/editline-1.17.1/examples/Makefile.am
Normal file
5
dep/editline-1.17.1/examples/Makefile.am
Normal file
@@ -0,0 +1,5 @@
|
||||
noinst_PROGRAMS = testit cli excallback fileman
|
||||
LDADD = $(top_builddir)/src/libeditline.la
|
||||
AM_CPPFLAGS = -DEDITLINE_LIBRARY
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = -static
|
||||
631
dep/editline-1.17.1/examples/Makefile.in
Normal file
631
dep/editline-1.17.1/examples/Makefile.in
Normal file
@@ -0,0 +1,631 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in 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.
|
||||
|
||||
# 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.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = testit$(EXEEXT) cli$(EXEEXT) excallback$(EXEEXT) \
|
||||
fileman$(EXEEXT)
|
||||
subdir = examples
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
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)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
cli_SOURCES = cli.c
|
||||
cli_OBJECTS = cli.$(OBJEXT)
|
||||
cli_LDADD = $(LDADD)
|
||||
cli_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
excallback_SOURCES = excallback.c
|
||||
excallback_OBJECTS = excallback.$(OBJEXT)
|
||||
excallback_LDADD = $(LDADD)
|
||||
excallback_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
||||
fileman_SOURCES = fileman.c
|
||||
fileman_OBJECTS = fileman.$(OBJEXT)
|
||||
fileman_LDADD = $(LDADD)
|
||||
fileman_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
||||
testit_SOURCES = testit.c
|
||||
testit_OBJECTS = testit.$(OBJEXT)
|
||||
testit_LDADD = $(LDADD)
|
||||
testit_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/aux/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/cli.Po ./$(DEPDIR)/excallback.Po \
|
||||
./$(DEPDIR)/fileman.Po ./$(DEPDIR)/testit.Po
|
||||
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_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
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_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = cli.c excallback.c fileman.c testit.c
|
||||
DIST_SOURCES = cli.c excallback.c fileman.c testit.c
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/aux/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
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@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
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@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
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@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
LDADD = $(top_builddir)/src/libeditline.la
|
||||
AM_CPPFLAGS = -DEDITLINE_LIBRARY
|
||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = -static
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign examples/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@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) $(EXTRA_cli_DEPENDENCIES)
|
||||
@rm -f cli$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(cli_OBJECTS) $(cli_LDADD) $(LIBS)
|
||||
|
||||
excallback$(EXEEXT): $(excallback_OBJECTS) $(excallback_DEPENDENCIES) $(EXTRA_excallback_DEPENDENCIES)
|
||||
@rm -f excallback$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(excallback_OBJECTS) $(excallback_LDADD) $(LIBS)
|
||||
|
||||
fileman$(EXEEXT): $(fileman_OBJECTS) $(fileman_DEPENDENCIES) $(EXTRA_fileman_DEPENDENCIES)
|
||||
@rm -f fileman$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(fileman_OBJECTS) $(fileman_LDADD) $(LIBS)
|
||||
|
||||
testit$(EXEEXT): $(testit_OBJECTS) $(testit_DEPENDENCIES) $(EXTRA_testit_DEPENDENCIES)
|
||||
@rm -f testit$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(testit_OBJECTS) $(testit_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cli.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/excallback.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileman.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testit.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(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
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/cli.Po
|
||||
-rm -f ./$(DEPDIR)/excallback.Po
|
||||
-rm -f ./$(DEPDIR)/fileman.Po
|
||||
-rm -f ./$(DEPDIR)/testit.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/cli.Po
|
||||
-rm -f ./$(DEPDIR)/excallback.Po
|
||||
-rm -f ./$(DEPDIR)/fileman.Po
|
||||
-rm -f ./$(DEPDIR)/testit.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
|
||||
ctags ctags-am 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 tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
180
dep/editline-1.17.1/examples/cli.c
Normal file
180
dep/editline-1.17.1/examples/cli.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* 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>
|
||||
|
||||
#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. */
|
||||
static char *my_rl_complete(char *token, int *match)
|
||||
{
|
||||
int i;
|
||||
int index = -1;
|
||||
int matchlen = 0;
|
||||
int count = 0;
|
||||
|
||||
for (i = 0; list[i]; i++) {
|
||||
int partlen = strlen(token); /* Part of token */
|
||||
|
||||
if (!strncmp(list[i], token, partlen)) {
|
||||
index = i;
|
||||
matchlen = partlen;
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 1) {
|
||||
*match = 1;
|
||||
return strdup(list[index] + matchlen);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return all possible completions. */
|
||||
static int my_rl_list_possib(char *token, char ***av)
|
||||
{
|
||||
int i, num, total = 0;
|
||||
char **copy;
|
||||
|
||||
for (num = 0; list[num]; num++)
|
||||
;
|
||||
|
||||
if (!num)
|
||||
return 0;
|
||||
|
||||
copy = malloc(num * sizeof(char *));
|
||||
for (i = 0; i < num; i++) {
|
||||
if (!strncmp(list[i], token, strlen (token))) {
|
||||
copy[total] = strdup(list[i]);
|
||||
total++;
|
||||
}
|
||||
}
|
||||
*av = copy;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
el_status_t do_suspend(void)
|
||||
{
|
||||
puts("Abort!");
|
||||
return CSstay;
|
||||
}
|
||||
|
||||
static void breakit(int signo)
|
||||
{
|
||||
(void)signo;
|
||||
puts("Got SIGINT");
|
||||
}
|
||||
|
||||
/* Use el_no_echo when reading passwords and similar */
|
||||
static int unlock(const char *passwd)
|
||||
{
|
||||
char *prompt = "Enter password: ";
|
||||
char *line;
|
||||
int rc = 1;
|
||||
|
||||
el_no_echo = 1;
|
||||
|
||||
while ((line = readline(prompt))) {
|
||||
rc = strncmp(line, passwd, strlen(passwd));
|
||||
free(line);
|
||||
|
||||
if (rc) {
|
||||
printf("\nWrong password, please try again, it's secret.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("\nAchievement unlocked!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
el_no_echo = 0;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *line;
|
||||
char *prompt = "cli> ";
|
||||
|
||||
signal(SIGINT, breakit);
|
||||
|
||||
/* Setup callbacks */
|
||||
rl_set_complete_func(&my_rl_complete);
|
||||
rl_set_list_possib_func(&my_rl_list_possib);
|
||||
|
||||
el_bind_key('?', list_possible);
|
||||
el_bind_key(CTL('Z'), do_suspend);
|
||||
read_history(HISTORY);
|
||||
|
||||
while ((line = readline(prompt))) {
|
||||
if (!strncmp(line, "unlock", 6) && unlock("secret")) {
|
||||
free(line);
|
||||
fprintf(stderr, "\nSecurity breach, user logged out!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (*line != '\0')
|
||||
printf("\t\t\t|%s|\n", line);
|
||||
free(line);
|
||||
}
|
||||
|
||||
write_history(HISTORY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* c-file-style: "k&r"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
195
dep/editline-1.17.1/examples/excallback.c
Normal file
195
dep/editline-1.17.1/examples/excallback.c
Normal file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
From: Jeff Solomon <jsolomon@stanford.edu>
|
||||
Date: Fri, 9 Apr 1999 10:13:27 -0700 (PDT)
|
||||
To: chet@po.cwru.edu
|
||||
Subject: new readline example
|
||||
Message-ID: <14094.12094.527305.199695@mrclean.Stanford.EDU>
|
||||
|
||||
Chet,
|
||||
|
||||
I've been using readline 4.0. Specifically, I've been using the perl
|
||||
version Term::ReadLine::Gnu. It works great.
|
||||
|
||||
Anyway, I've been playing around the alternate interface and I wanted
|
||||
to contribute a little C program, callback.c, to you that you could
|
||||
use as an example of the alternate interface in the /examples
|
||||
directory of the readline distribution.
|
||||
|
||||
My example shows how, using the alternate interface, you can
|
||||
interactively change the prompt (which is very nice imo). Also, I
|
||||
point out that you must roll your own terminal setting when using the
|
||||
alternate interface because readline depreps (using your parlance) the
|
||||
terminal while in the user callback. I try to demostrate what I mean
|
||||
with an example. I've included the program below.
|
||||
|
||||
To compile, I just put the program in the examples directory and made
|
||||
the appropriate changes to the EXECUTABLES and OBJECTS line and added
|
||||
an additional target 'callback'.
|
||||
|
||||
I compiled on my Sun Solaris2.6 box using Sun's cc.
|
||||
|
||||
Let me know what you think.
|
||||
|
||||
Jeff
|
||||
*/
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <termios.h> /* xxx - should make this more general */
|
||||
|
||||
#ifdef EDITLINE_LIBRARY
|
||||
# include "editline.h"
|
||||
#else
|
||||
# include <readline/readline.h>
|
||||
#endif
|
||||
|
||||
/* This little examples demonstrates the alternate interface to using readline.
|
||||
* In the alternate interface, the user maintains control over program flow and
|
||||
* only calls readline when STDIN is readable. Using the alternate interface,
|
||||
* you can do anything else while still using readline (like talking to a
|
||||
* network or another program) without blocking.
|
||||
*
|
||||
* Specifically, this program highlights two importants features of the
|
||||
* alternate interface. The first is the ability to interactively change the
|
||||
* prompt, which can't be done using the regular interface since rl_prompt is
|
||||
* read-only.
|
||||
*
|
||||
* The second feature really highlights a subtle point when using the alternate
|
||||
* interface. That is, readline will not alter the terminal when inside your
|
||||
* callback handler. So let's so, your callback executes a user command that
|
||||
* takes a non-trivial amount of time to complete (seconds). While your
|
||||
* executing the command, the user continues to type keystrokes and expects them
|
||||
* to be re-echoed on the new prompt when it returns. Unfortunately, the default
|
||||
* terminal configuration doesn't do this. After the prompt returns, the user
|
||||
* must hit one additional keystroke and then will see all of his previous
|
||||
* keystrokes. To illustrate this, compile and run this program. Type "sleep" at
|
||||
* the prompt and then type "bar" before the prompt returns (you have 3
|
||||
* seconds). Notice how "bar" is re-echoed on the prompt after the prompt
|
||||
* returns? This is what you expect to happen. Now comment out the 4 lines below
|
||||
* the line that says COMMENT LINE BELOW. Recompile and rerun the program and do
|
||||
* the same thing. When the prompt returns, you should not see "bar". Now type
|
||||
* "f", see how "barf" magically appears? This behavior is un-expected and not
|
||||
* desired.
|
||||
*/
|
||||
|
||||
void process_line(char *line);
|
||||
int change_prompt(void);
|
||||
char *get_prompt(void);
|
||||
|
||||
int prompt = 1;
|
||||
char prompt_buf[40], line_buf[256];
|
||||
tcflag_t old_lflag;
|
||||
cc_t old_vtime;
|
||||
struct termios term;
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
fd_set fds;
|
||||
|
||||
/* Adjust the terminal slightly before the handler is installed. Disable
|
||||
* canonical mode processing and set the input character time flag to be
|
||||
* non-blocking.
|
||||
*/
|
||||
if( tcgetattr(STDIN_FILENO, &term) < 0 ) {
|
||||
perror("tcgetattr");
|
||||
exit(1);
|
||||
}
|
||||
old_lflag = term.c_lflag;
|
||||
old_vtime = term.c_cc[VTIME];
|
||||
term.c_lflag &= ~ICANON;
|
||||
term.c_cc[VTIME] = 1;
|
||||
/* COMMENT LINE BELOW - see above */
|
||||
if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) {
|
||||
perror("tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// rl_add_defun("change-prompt", change_prompt, CTRL('t'));
|
||||
rl_callback_handler_install(get_prompt(), process_line);
|
||||
|
||||
while(1) {
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fileno(stdin), &fds);
|
||||
|
||||
if( select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0) {
|
||||
perror("select");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( FD_ISSET(fileno(stdin), &fds) ) {
|
||||
rl_callback_read_char();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
process_line(char *line)
|
||||
{
|
||||
if( line == NULL ) {
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
/* reset the old terminal setting before exiting */
|
||||
term.c_lflag = old_lflag;
|
||||
term.c_cc[VTIME] = old_vtime;
|
||||
if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) {
|
||||
perror("tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if( strcmp(line, "sleep") == 0 ) {
|
||||
sleep(3);
|
||||
} else {
|
||||
fprintf(stderr, "|%s|\n", line);
|
||||
}
|
||||
|
||||
free (line);
|
||||
}
|
||||
|
||||
int
|
||||
change_prompt(void)
|
||||
{
|
||||
/* toggle the prompt variable */
|
||||
prompt = !prompt;
|
||||
|
||||
/* save away the current contents of the line */
|
||||
strncpy(line_buf, rl_line_buffer, sizeof(line_buf));
|
||||
line_buf[sizeof(line_buf) - 1] = 0;
|
||||
|
||||
/* install a new handler which will change the prompt and erase the current line */
|
||||
rl_callback_handler_install(get_prompt(), process_line);
|
||||
|
||||
/* insert the old text on the new line */
|
||||
rl_insert_text(line_buf);
|
||||
|
||||
/* redraw the current line - this is an undocumented function. It invokes the
|
||||
* redraw-current-line command.
|
||||
*/
|
||||
return rl_refresh_line(0, 0);
|
||||
}
|
||||
|
||||
char *
|
||||
get_prompt(void)
|
||||
{
|
||||
/* The prompts can even be different lengths! */
|
||||
sprintf(prompt_buf, "%s",
|
||||
prompt ? "Hit ctrl-t to toggle prompt> " : "Pretty cool huh?> ");
|
||||
return prompt_buf;
|
||||
}
|
||||
431
dep/editline-1.17.1/examples/fileman.c
Normal file
431
dep/editline-1.17.1/examples/fileman.c
Normal file
@@ -0,0 +1,431 @@
|
||||
/* 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 command to output the history list was added.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "editline.h"
|
||||
|
||||
void too_dangerous(char *caller);
|
||||
void initialize_readline();
|
||||
int execute_line(char *line);
|
||||
int valid_argument(char *caller, char *arg);
|
||||
|
||||
/* 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 *);
|
||||
|
||||
struct cmd {
|
||||
char *name; /* User printable name of the function. */
|
||||
int (*func)(char *); /* Function to call to do the job. */
|
||||
char *doc; /* Documentation for this function. */
|
||||
};
|
||||
|
||||
struct cmd 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"},
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
char *stripwhite();
|
||||
struct cmd *find_command();
|
||||
|
||||
/* When non-zero, this means the user is done using this program. */
|
||||
int done;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
initialize_readline(); /* Bind our completer. */
|
||||
|
||||
/* 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 0
|
||||
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);
|
||||
}
|
||||
#else
|
||||
execute_line(s);
|
||||
#endif
|
||||
free(line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Execute a command line. */
|
||||
int execute_line(char *line)
|
||||
{
|
||||
int i;
|
||||
struct cmd *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. */
|
||||
struct cmd *find_command(char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
if (strcmp(name, commands[i].name) == 0)
|
||||
return &commands[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Strip whitespace from the start and end of STRING. Return a pointer
|
||||
* into STRING.
|
||||
*/
|
||||
char *stripwhite(char *string)
|
||||
{
|
||||
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(void)
|
||||
{
|
||||
/* 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 = 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)
|
||||
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(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 strdup(name);
|
||||
}
|
||||
|
||||
/* If no names matched, then return NULL. */
|
||||
return 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)
|
||||
{
|
||||
const char *he;
|
||||
|
||||
/* rewind history */
|
||||
while (el_prev_hist()) ;
|
||||
|
||||
for (he = el_next_hist(); he != NULL; he = el_next_hist())
|
||||
printf("%s\n", he);
|
||||
|
||||
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)
|
||||
{
|
||||
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 = getcwd(dir, sizeof(dir) - 1);
|
||||
if (!s) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* c-file-style: "k&r"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
78
dep/editline-1.17.1/examples/testit.c
Normal file
78
dep/editline-1.17.1/examples/testit.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/* A "micro-shell" to test editline library.
|
||||
* If given any arguments, commands aren't executed.
|
||||
*
|
||||
* Copyright (c) 1992, 1993 Simmule Turner and Rich Salz. All rights reserved.
|
||||
*
|
||||
* This software is not subject to any license of the American Telephone
|
||||
* and Telegraph Company or of the Regents of the University of California.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose on
|
||||
* any computer system, and to alter it and redistribute it freely, subject
|
||||
* to the following restrictions:
|
||||
* 1. The authors are not responsible for the consequences of use of this
|
||||
* software, no matter how awful, even if they arise from flaws in it.
|
||||
* 2. The origin of this software must not be misrepresented, either by
|
||||
* explicit claim or by omission. Since few users ever read sources,
|
||||
* credits must appear in the documentation.
|
||||
* 3. Altered versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software. Since few users
|
||||
* ever read sources, credits must appear in the documentation.
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "editline.h"
|
||||
|
||||
#ifndef HAVE_PERROR
|
||||
extern int errno;
|
||||
void perror(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: error %d\n", s, errno);
|
||||
}
|
||||
#endif /* !HAVE_PERROR */
|
||||
|
||||
int main(int argc, char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
int doit;
|
||||
char *prompt, *p;
|
||||
|
||||
read_history(".testit_history");
|
||||
|
||||
doit = argc == 1;
|
||||
if ((prompt = getenv("TESTPROMPT")) == NULL)
|
||||
prompt = "testit> ";
|
||||
|
||||
while ((p = readline(prompt)) != NULL) {
|
||||
printf("\t\t\t|%s|\n", p);
|
||||
if (doit) {
|
||||
if (strncmp(p, "cd ", 3) == 0) {
|
||||
if (chdir(&p[3]) < 0)
|
||||
perror(&p[3]);
|
||||
} else if (system(p) != 0) {
|
||||
perror(p);
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
write_history(".testit_history");
|
||||
rl_uninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* c-file-style: "k&r"
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
Reference in New Issue
Block a user