aboutsummaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authornobody <>1998-12-21 20:06:34 +0000
committernobody <>1998-12-21 20:06:34 +0000
commit94228bd3ca403b6bad17f96e32db7b8cf2e870c6 (patch)
treec5c2deb54b366a5a36d119a4132689b3a939fd51 /readline
parentbe9485d5f52e873f1a66f55f34a70fda754fce1f (diff)
downloadgdb-94228bd3ca403b6bad17f96e32db7b8cf2e870c6.zip
gdb-94228bd3ca403b6bad17f96e32db7b8cf2e870c6.tar.gz
gdb-94228bd3ca403b6bad17f96e32db7b8cf2e870c6.tar.bz2
This commit was manufactured by cvs2svn to create branch 'FSF'.
Sprout from master 1991-11-19 05:16:47 UTC Stu Grossman <grossman@cygnus> 'Initial revision' Cherrypick from master 1998-12-21 20:06:33 UTC Elena Zannoni <ezannoni@kwikemart.cygnus.com> 'Initial revision': readline/INSTALL readline/bind.c readline/config.h.in readline/doc/Makefile.in readline/examples/histexamp.c readline/isearch.c readline/parens.c readline/search.c readline/shell.c readline/support/install.sh readline/support/mkdirs readline/tilde.c readline/tilde.h readline/xmalloc.c Cherrypick from master 1991-05-21 19:55:06 UTC K. Richard Pixley <rich@cygnus> 'Initial revision': readline/Makefile.in readline/configure readline/readline.c Cherrypick from master 1994-01-16 03:39:57 UTC Per Bothner <per@bothner.com> ' Merge in changes from bash-1.13. The most obvious one is': readline/complete.c readline/display.c readline/rldefs.h Delete: .Sanitize DOC.Sanitize DOC.configure INSTALL Makefile.in README.configure SUPPORTED bfd/.Sanitize bfd/COPYING bfd/ChangeLog bfd/Makefile bfd/Makefile.in bfd/TODO bfd/VERSION bfd/aout-encap.c bfd/aout.c bfd/aout32.c bfd/aout64.c bfd/aoutf1.h bfd/aoutx.c bfd/aoutx.h bfd/archive.c bfd/archures.c bfd/archures.h bfd/awkscan bfd/awkscan-ip bfd/awkscan-p bfd/bfd-in.h bfd/bfd.c bfd/bfd.doc bfd/bfd.doc.ps bfd/bfd.texinfo bfd/blins-p bfd/bout.c bfd/cache.c bfd/coff-a29k.c bfd/coff-code.h bfd/coff-i386.c bfd/coff-i960.c bfd/coff-m68k.c bfd/coff-m88k.c bfd/coff-mips.c bfd/coff-rs6000.c bfd/coffcode.h bfd/coffish.h bfd/coffswap.c bfd/config.sub bfd/configure bfd/configure.in bfd/core.c bfd/cplus-dem.c bfd/cpu-a29k.c bfd/cpu-h8300.c bfd/cpu-i386.c bfd/cpu-i960.c bfd/cpu-m88k.c bfd/cpu-rs6000.c bfd/cpu-vax.c bfd/ctor.c bfd/demo64.c bfd/doc/.Sanitize bfd/doc/Makefile bfd/doc/Makefile.in bfd/doc/awkscan bfd/doc/awkscan-ip bfd/doc/awkscan-p bfd/doc/bfd.info bfd/doc/bfd.texinfo bfd/doc/bfdinfo bfd/doc/blins-p bfd/doc/configure.in bfd/doc/exfil1-p bfd/doc/exfil3-p bfd/doc/exfilter bfd/doc/exfilter-p bfd/doc/exfiltst bfd/doc/exmerge bfd/doc/intobfd bfd/doc/mergecom-p bfd/doc/movecom-p bfd/doc/scanit bfd/doc/scanph bfd/doc/sedscript bfd/doc/sedscript-p bfd/doc/startcom-p bfd/doc/tolibbfd bfd/doc/tolibcoff bfd/doc/unPROTO bfd/elf.c bfd/exfilter bfd/exmerge bfd/filemode.c bfd/format.c bfd/host-aout.c bfd/hosts/.Sanitize bfd/hosts/amix.h bfd/hosts/decstation.h bfd/hosts/delta88.h bfd/hosts/dgux.h bfd/hosts/dose.h bfd/hosts/h-m68kv.h bfd/hosts/harris.h bfd/hosts/hp9000.h bfd/hosts/i386mach.h bfd/hosts/i386v.h bfd/hosts/irix3.h bfd/hosts/rs6000.h bfd/hosts/rtbsd.h bfd/hosts/sparc-ll.h bfd/hosts/sparc.h bfd/hosts/sun3.h bfd/hosts/tahoe.h bfd/hosts/ultra3.h bfd/hosts/vaxbsd.h bfd/hosts/vaxult.h bfd/howto.c bfd/i386aout.c bfd/ieee.c bfd/init.c bfd/intobfd bfd/libaout.h bfd/libbfd-in.h bfd/libbfd.c bfd/libbfd.h bfd/libcoff.h bfd/libieee.h bfd/liboasys.h bfd/mergecom-p bfd/misc.c bfd/misc.h bfd/movecom-p bfd/newsos3.c bfd/oasys.c bfd/obstack.c bfd/obstack.h bfd/opncls.c bfd/reloc.c bfd/scanit bfd/scanph bfd/section.c bfd/sedscript bfd/sedscript-p bfd/srec.c bfd/startcom-p bfd/sunos.c bfd/syms.c bfd/targets.c bfd/tolibbfd bfd/tolibcoff bfd/trad-core.c bfd/trad-core.h bfd/unPROTO binutils/.Sanitize binutils/ChangeLog binutils/Makefile.in binutils/README binutils/TODO binutils/alloca.c binutils/am29k-pinsn.c binutils/ar.1 binutils/ar.c binutils/binutils.texi binutils/binutils.texinfo binutils/bucomm.c binutils/config.sub binutils/configure binutils/configure.in binutils/copy.c binutils/cplus-dem.c binutils/filemode.c binutils/gmalloc.c binutils/i960-pinsn.c binutils/is-ranlib.c binutils/is-strip.c binutils/m68k-pinsn.c binutils/maybe-ranlib.c binutils/maybe-strip.c binutils/nm.1 binutils/nm.c binutils/not-ranlib.c binutils/not-strip.c binutils/objdump.1 binutils/objdump.c binutils/ostrip.c binutils/ranlib.1 binutils/ranlib.sh binutils/size.1 binutils/size.c binutils/sparc-pinsn.c binutils/strip.1 binutils/strip.c binutils/version.c config.sub config/.Sanitize config/mh-delta88 config/mh-dgux config/mh-sco config/mh-svr4 config/mh-sysv config/mt-a29k config/mt-ebmon29k configure configure.in gas/.Sanitize gas/.gdbinit gas/COPYING gas/ChangeLog gas/GNUmakefile-host gas/Makefile-intel gas/Makefile.generic gas/Makefile.in gas/Makefile.loic gas/Makefile.old gas/NOTES gas/NOTES.config gas/README gas/README-vms-dbg gas/README.coff gas/README.rich gas/VERSION gas/a.out.gnu.h gas/app.c gas/as.c gas/as.h gas/atof-generic.c gas/bignum-copy.c gas/bignum.h gas/cond.c gas/config.sub gas/config/.Sanitize gas/config/a.out.h gas/config/atof-ieee.c gas/config/atof-vax.c gas/config/coff.gnu.h gas/config/cplus-dem.c gas/config/ebmon29k.mt gas/config/h8300.mt gas/config/h8300hds.mt gas/config/ho-a29k.h gas/config/ho-ansi.h gas/config/ho-cygnus.h gas/config/ho-decstation.h gas/config/ho-generic.h gas/config/ho-hpux.h gas/config/ho-i386.h gas/config/ho-rs6000.h gas/config/ho-sun3.h gas/config/ho-sun386.h gas/config/ho-sun4.h gas/config/ho-sunos.h gas/config/ho-sysv.h gas/config/ho-vax.h gas/config/m68k.mt gas/config/mh-a29k gas/config/mh-cygnus gas/config/mh-i386 gas/config/mips.mt gas/config/obj-aout.c gas/config/obj-aout.h gas/config/obj-bfd-sunos.c gas/config/obj-bfd-sunos.h gas/config/obj-bout.c gas/config/obj-bout.h gas/config/obj-coff.c gas/config/obj-coff.h gas/config/obj-generic.c gas/config/obj-generic.h gas/config/obj-ieee.c gas/config/obj-ieee.h gas/config/ranlib.h gas/config/rs6000.mt gas/config/signame.h gas/config/stab.h gas/config/tc-a29k.c gas/config/tc-a29k.h gas/config/tc-generic.c gas/config/tc-generic.h gas/config/tc-h8300.c gas/config/tc-i386.c gas/config/tc-i386.h gas/config/tc-i860.c gas/config/tc-i860.h gas/config/tc-i960.c gas/config/tc-i960.h gas/config/tc-m68851.h gas/config/tc-m68k.c gas/config/tc-m68k.h gas/config/tc-ns32k.c gas/config/tc-ns32k.h gas/config/tc-rs6000.c gas/config/tc-rs6000.h gas/config/tc-sparc.c gas/config/tc-sparc.h gas/config/tc-vax.c gas/config/tc-vax.h gas/config/te-dpx2.h gas/config/te-generic.h gas/config/te-ic960.h gas/config/te-motor.h gas/config/te-sco386.h gas/config/te-sparc.h gas/config/te-sun3.h gas/config/te-sysv32.h gas/config/te-unisoft.h gas/config/tmake-sun3 gas/config/vax-inst.h gas/config/vms/.Sanitize gas/config/vms/objrecdef.h gas/config/vms/vms-dbg.c gas/config/vms/vms.c gas/configure gas/configure.in gas/configure.was gas/debug.c gas/doc/Makefile gas/doc/a29k-coff.m4 gas/doc/a29k.m4 gas/doc/all.m4 gas/doc/as.texinfo gas/doc/gen.m4 gas/doc/i80386.m4 gas/doc/i960.m4 gas/doc/m680x0.m4 gas/doc/none.m4 gas/doc/pretex.m4 gas/doc/sparc.m4 gas/doc/vax.m4 gas/doc/vintage.m4 gas/expr.c gas/expr.h gas/flonum-const.c gas/flonum-copy.c gas/flonum-mult.c gas/flonum.h gas/frags.c gas/frags.h gas/hash.c gas/hash.h gas/hex-value.c gas/input-file.c gas/input-file.h gas/input-scrub.c gas/link.cmd gas/make-gas.com gas/messages.c gas/obj.h gas/objdump.c gas/obsolete/gdb-blocks.c gas/obsolete/gdb-file.c gas/obsolete/gdb-lines.c gas/obsolete/gdb-symbols.c gas/obsolete/gdb.c gas/output-file.c gas/output-file.h gas/read.c gas/read.h gas/strstr.c gas/struc-symbol.h gas/subsegs.c gas/subsegs.h gas/symbols.c gas/symbols.h gas/tc.h gas/testscripts/doboth gas/testscripts/doobjcmp gas/testscripts/dostriptest gas/testscripts/dotest gas/testscripts/dounsortreloc gas/testscripts/dounsortsymbols gas/ver960.c gas/version.c gas/write.c gas/write.h gas/xmalloc.c gas/xrealloc.c gdb/.Sanitize gdb/.gdbinit gdb/Attic/Makefile.in gdb/COPYING gdb/ChangeLog gdb/ChangeLog-3.x gdb/Convex.notes gdb/Makefile gdb/Makefile.dist gdb/Makefile.in gdb/Makefile.sdir gdb/Makefile.srcdir gdb/Projects gdb/README gdb/TODO gdb/WHATS.NEW gdb/alldeps.mak gdb/alloca.c gdb/altos-xdep.c gdb/am29k-opcode.h gdb/am29k-pinsn.c gdb/am29k-tdep.c gdb/ansidecl.h gdb/arm-convert.s gdb/arm-opcode.h gdb/arm-pinsn.c gdb/arm-tdep.c gdb/arm-xdep.c gdb/blockframe.c gdb/breakpoint.c gdb/breakpoint.h gdb/buildsym.c gdb/buildsym.h gdb/c-exp.y gdb/coffread.c gdb/command.c gdb/command.h gdb/config.gdb gdb/config.status gdb/config.sub gdb/config/.Sanitize gdb/config/3b1.mh gdb/config/3b1.mt gdb/config/a29k-kern.mt gdb/config/a29k.mt gdb/config/altos.mh gdb/config/altos.mt gdb/config/altosgas.mh gdb/config/altosgas.mt gdb/config/am29k gdb/config/amix.mh gdb/config/amix.mt gdb/config/arm.mh gdb/config/arm.mt gdb/config/bigmips.mh gdb/config/bigmips.mt gdb/config/convex.mh gdb/config/convex.mt gdb/config/decstation.mh gdb/config/decstation.mt gdb/config/delta88.mh gdb/config/delta88.mt gdb/config/hp300bsd.mh gdb/config/hp300bsd.mt gdb/config/hp300hpux.mh gdb/config/hp300hpux.mt gdb/config/i386aout.mt gdb/config/i386mach.mh gdb/config/i386sco.mh gdb/config/i386sco.mt gdb/config/i386v-g.mh gdb/config/i386v-g.mt gdb/config/i386v.mh gdb/config/i386v.mt gdb/config/i386v32-g.mh gdb/config/i386v32-g.mt gdb/config/i386v32.mh gdb/config/i386v32.mt gdb/config/i960.mt gdb/config/irix3.mh gdb/config/irix3.mt gdb/config/isi.mh gdb/config/isi.mt gdb/config/littlemips.mh gdb/config/littlemips.mt gdb/config/m88k.mh gdb/config/m88k.mt gdb/config/merlin.mh gdb/config/merlin.mt gdb/config/mh-vax gdb/config/news.mh gdb/config/news.mt gdb/config/news1000.mh gdb/config/news1000.mt gdb/config/nindy960.mt gdb/config/none.mh gdb/config/none.mt gdb/config/np1.mh gdb/config/np1.mt gdb/config/pn.mh gdb/config/pn.mt gdb/config/pyramid.mh gdb/config/pyramid.mt gdb/config/rs6000.mh gdb/config/rs6000.mt gdb/config/rtbsd.mh gdb/config/sun2os3.mh gdb/config/sun2os3.mt gdb/config/sun2os4.mh gdb/config/sun2os4.mt gdb/config/sun3.mh gdb/config/sun3.mt gdb/config/sun386.mh gdb/config/sun386.mt gdb/config/sun3os3.mh gdb/config/sun3os3.mt gdb/config/sun3os4.mh gdb/config/sun3os4.mt gdb/config/sun4.mh gdb/config/sun4.mt gdb/config/sun4os3.mh gdb/config/sun4os3.mt gdb/config/sun4os4.mh gdb/config/sun4os4.mt gdb/config/symmetry.mh gdb/config/symmetry.mt gdb/config/tahoe.mh gdb/config/tahoe.mt gdb/config/ultra3.mh gdb/config/ultra3.mt gdb/config/umax.mh gdb/config/umax.mt gdb/config/vax.mt gdb/config/vxworks68.mt gdb/config/vxworks960.mt gdb/configure gdb/configure.in gdb/convex-opcode.h gdb/convex-pinsn.c gdb/convex-tdep.c gdb/convex-xdep.c gdb/convx-opcode.h gdb/copying.awk gdb/copying.c gdb/core.c gdb/coredep.c gdb/cplus-dem.c gdb/createtags gdb/dbxread.c gdb/defs.h gdb/depend gdb/doc/.Sanitize gdb/doc/Makefile gdb/doc/Makefile.in gdb/doc/all.m4 gdb/doc/amd29k.m4 gdb/doc/configure.in gdb/doc/gdb.alter-m4 gdb/doc/gdb.bugs-m4 gdb/doc/gdb.canned-m4 gdb/doc/gdb.cmds-m4 gdb/doc/gdb.ctl-m4 gdb/doc/gdb.data-m4 gdb/doc/gdb.emacs-m4 gdb/doc/gdb.files-m4 gdb/doc/gdb.gpl-m4 gdb/doc/gdb.install-m4 gdb/doc/gdb.invoc-m4 gdb/doc/gdb.rdln-m4 gdb/doc/gdb.rename-m4 gdb/doc/gdb.run-m4 gdb/doc/gdb.sample-m4 gdb/doc/gdb.src-m4 gdb/doc/gdb.stack-m4 gdb/doc/gdb.stop-m4 gdb/doc/gdb.symb-m4 gdb/doc/gdb.texinfo gdb/doc/gdb.tgts-m4 gdb/doc/gdb.top-m4 gdb/doc/gdbint.texinfo gdb/doc/gdbinv-m.m4 gdb/doc/gdbinv-m.m4.in gdb/doc/gdbinv-s.m4 gdb/doc/gdbinv-s.m4.in gdb/doc/gen.m4 gdb/doc/i80386.m4 gdb/doc/i960.m4 gdb/doc/interim-gdb.texinfo gdb/doc/interim-gdbinv-m.m4 gdb/doc/interim-gdbinv-s.m4 gdb/doc/m680x0.m4 gdb/doc/none.m4 gdb/doc/pretex.m4 gdb/doc/rc-cm.tex gdb/doc/rc-ps.tex gdb/doc/rc-pslong.tex gdb/doc/rdl-apps.texi gdb/doc/refcard.tex gdb/doc/sparc.m4 gdb/doc/threecol.tex gdb/doc/vax.m4 gdb/dwarfread.c gdb/elfread.c gdb/environ.c gdb/environ.h gdb/eval.c gdb/exec.c gdb/expprint.c gdb/expread.tab.c gdb/expread.y gdb/expression.h gdb/findvar.c gdb/frame.h gdb/gdb-int.texinfo gdb/gdbcmd.h gdb/gdbcore.h gdb/getpagesize.h gdb/gmalloc.c gdb/gmalloc.h gdb/gould-pinsn.c gdb/gould-xdep.c gdb/hp300hpux-xdep.c gdb/hp300ux-xdep.c gdb/i386-pinsn.c gdb/i386-tdep.c gdb/i386-xdep.c gdb/i387-tdep.c gdb/i960-pinsn.c gdb/i960-tdep.c gdb/ieee-float.c gdb/ieee-float.h gdb/infcmd.c gdb/inferior.h gdb/inflow.c gdb/infptrace.c gdb/infrun.c gdb/infrun.hacked.c gdb/inftarg.c gdb/kdb-start.c gdb/language.c gdb/language.h gdb/m2-exp.y gdb/m68k-opcode.h gdb/m68k-pinsn.c gdb/m68k-stub.c gdb/m68k-tdep.c gdb/m88k-opcode.h gdb/m88k-pinsn.c gdb/m88k-tdep.c gdb/m88k-xdep.c gdb/mach386-xdep.c gdb/main.c gdb/mcheck.c gdb/mem-break.c gdb/minimon.h gdb/mips-opcode.h gdb/mips-pinsn.c gdb/mips-tdep.c gdb/mips-xdep.c gdb/mipsread.c gdb/mtrace.awk gdb/mtrace.c gdb/munch gdb/news-xdep.c gdb/nindy-tdep.c gdb/np1-opcode.h gdb/ns32k-opcode.h gdb/ns32k-pinsn.c gdb/obstack.c gdb/obstack.h gdb/param-no-tm.h gdb/param.h gdb/parse.c gdb/parser-defs.h gdb/pn-opcode.h gdb/printcmd.c gdb/procfs.c gdb/putenv.c gdb/pyr-opcode.h gdb/pyr-pinsn.c gdb/pyr-tdep.c gdb/pyr-xdep.c gdb/regex.c gdb/regex.h gdb/rem-m68k.shar gdb/rem-multi.shar gdb/remote-adapt.c gdb/remote-eb.c gdb/remote-mm.c gdb/remote-multi.shar gdb/remote-nindy.c gdb/remote-sa.m68k.shar gdb/remote-sa.sparc.c gdb/remote-vx.68.c gdb/remote-vx.c gdb/remote.c gdb/rs6000-pinsn.c gdb/rs6000-tdep.c gdb/rs6000-xdep.c gdb/rs6k-opcode.def gdb/rs6k-opcode.h gdb/saber.suppress gdb/signals.h gdb/signame.c gdb/signame.h gdb/solib.c gdb/source.c gdb/sparc-opcode.h gdb/sparc-pinsn.c gdb/sparc-tdep.c gdb/sparc-xdep.c gdb/stab.def gdb/stack.c gdb/standalone.c gdb/stddef.h gdb/stdlib.h gdb/stuff.c gdb/sun3-xdep.c gdb/sun386-xdep.c gdb/symfile.c gdb/symfile.h gdb/symm-tdep.c gdb/symm-xdep.c gdb/symmetry-tdep.c gdb/symmetry-xdep.c gdb/symmisc.c gdb/symtab.c gdb/symtab.h gdb/tahoe-opcode.h gdb/tahoe-pinsn.c gdb/target.c gdb/target.h gdb/tdesc.c gdb/tdesc.h gdb/terminal.h gdb/tm-29k.h gdb/tm-3b1.h gdb/tm-68k.h gdb/tm-altos.h gdb/tm-altosgas.h gdb/tm-amix.h gdb/tm-arm.h gdb/tm-bigmips.h gdb/tm-convex.h gdb/tm-delta88.h gdb/tm-hp300bsd.h gdb/tm-hp300hpux.h gdb/tm-i386v-g.h gdb/tm-i386v.h gdb/tm-i960.h gdb/tm-irix3.h gdb/tm-isi.h gdb/tm-m88k.h gdb/tm-merlin.h gdb/tm-mips.h gdb/tm-news.h gdb/tm-nindy960.h gdb/tm-np1.h gdb/tm-pn.h gdb/tm-pyr.h gdb/tm-rs6000.h gdb/tm-sparc.h gdb/tm-sun2.h gdb/tm-sun2os4.h gdb/tm-sun3.h gdb/tm-sun386.h gdb/tm-sun3os4.h gdb/tm-sun4os4.h gdb/tm-sunos.h gdb/tm-svr4.h gdb/tm-symmetry.h gdb/tm-tahoe.h gdb/tm-ultra3.h gdb/tm-umax.h gdb/tm-vax.h gdb/tm-vx68.h gdb/tm-vx960.h gdb/tm-vxworks68.h gdb/tm-vxworks960.h gdb/ultra3-xdep.c gdb/umax-xdep.c gdb/utils.c gdb/valarith.c gdb/valops.c gdb/valprint.c gdb/value.h gdb/values.c gdb/vax-opcode.h gdb/vax-pinsn.c gdb/vx-share/.Sanitize gdb/vx-share/dbgRpcLib.h gdb/vx-share/ptrace.h gdb/vx-share/reg.h gdb/vx-share/vxTypes.h gdb/vx-share/vxWorks.h gdb/vx-share/wait.h gdb/vx-share/xdr_ld.c gdb/vx-share/xdr_ld.h gdb/vx-share/xdr_ptrace.c gdb/vx-share/xdr_ptrace.h gdb/vx-share/xdr_rdb.c gdb/vx-share/xdr_rdb.h gdb/vx-share/xdr_regs.c gdb/vx-share/xdr_regs.h gdb/xcoffexec.c gdb/xcoffread.c gdb/xm-3b1.h gdb/xm-altos.h gdb/xm-amix.h gdb/xm-arm.h gdb/xm-bigmips.h gdb/xm-convex.h gdb/xm-delta88.h gdb/xm-hp300bsd.h gdb/xm-hp300hpux.h gdb/xm-i386mach.h gdb/xm-i386sco.h gdb/xm-i386v.h gdb/xm-i386v32.h gdb/xm-irix3.h gdb/xm-isi.h gdb/xm-m68k.h gdb/xm-m88k.h gdb/xm-merlin.h gdb/xm-mips.h gdb/xm-news.h gdb/xm-news1000.h gdb/xm-np1.h gdb/xm-pn.h gdb/xm-pyr.h gdb/xm-rs6000.h gdb/xm-rtbsd.h gdb/xm-sparc.h gdb/xm-sun2.h gdb/xm-sun3.h gdb/xm-sun386.h gdb/xm-sun3os4.h gdb/xm-sun4os4.h gdb/xm-svr4.h gdb/xm-symmetry.h gdb/xm-tahoe.h gdb/xm-ultra3.h gdb/xm-umax.h gdb/xm-vax.h gprof/Makefile gprof/Makefile.in gprof/arcs.c gprof/config/mt-i386 gprof/config/mt-sparc gprof/config/tmake-i386 gprof/config/tmake-sparc gprof/configure gprof/configure.in gprof/dfn.c gprof/gmon.h gprof/gprof.1 gprof/gprof.c gprof/gprof.callg gprof/gprof.flat gprof/gprof.h gprof/hertz.c gprof/i386.c gprof/i386.h gprof/lookup.c gprof/pathnames.h gprof/printgprof.c gprof/printlist.c gprof/sparc.c gprof/sparc.h gprof/t.c gprof/tahoe.c gprof/tahoe.h gprof/vax.c gprof/vax.h include/.Sanitize include/COPYING include/ChangeLog include/a.out.encap.h include/a.out.host.h include/a.out.hp.h include/a.out.sun4.h include/a.out.vax.h include/a29k-opcode.h include/aout64.h include/ar.h include/arm-opcode.h include/bcs88kcoff.h include/bfd.h include/bout.h include/coff-a29k.h include/coff-i386.h include/coff-i960.h include/coff-m68k.h include/coff-m88k.h include/coff-mips.h include/coff-rs6000.h include/convx-opcode.h include/dwarf.h include/elf-common.h include/elf-external.h include/elf-internal.h include/gdbm.h include/getopt.h include/h8300-opcode.h include/i386-opcode.h include/i860-opcode.h include/i960-opcode.h include/ieee.h include/internalcoff.h include/m68k-opcode.h include/m88k-opcode.h include/mips-opcode.h include/np1-opcode.h include/ns32k-opcode.h include/oasys.h include/obstack.h include/pn-opcode.h include/pyr-opcode.h include/ranlib.h include/reloc.h include/sparc-opcode.h include/stab.def include/stab.gnu.h include/sysdep.h include/tahoe-opcode.h include/vax-opcode.h include/wait.h install.texinfo ld/.Sanitize ld/ChangeLog ld/Makefile ld/Makefile.in ld/README ld/config.h ld/config.sub ld/config/.Sanitize ld/config/coff-a29k.mt ld/config/decstation.mh ld/config/delta88.mh ld/config/dgux.mh ld/config/ebmon29k.mt ld/config/h-i386v ld/config/h-m68kv ld/config/hmake-dec3100 ld/config/hmake-dgux ld/config/hmake-rtbsd ld/config/hmake-sun3 ld/config/hmake-sun4 ld/config/hmake-sun4-64 ld/config/i386-aout.mt ld/config/i386v.mt ld/config/m68k.mt ld/config/m68kv.mt ld/config/m88k-bcs.mt ld/config/news.mh ld/config/news.mt ld/config/rtbsd.mh ld/config/sparc-ll.mh ld/config/sparc.mh ld/config/sun3.mh ld/config/sun4.mt ld/config/tmake-coff-a29k ld/config/tmake-m88k-bcs ld/config/tmake-sun4 ld/configure ld/configure.in ld/ebmon29k.sc ld/gld.1 ld/h8300hds.c ld/h8300hds.sc ld/i386aout.c ld/i386aout.sc ld/ld-emul.c ld/ld-gld-Ur.script ld/ld-gld-r.script ld/ld-gld.c ld/ld-gld.script ld/ld-gld68k-Ur.script ld/ld-gld68k-r.script ld/ld-gld68k.c ld/ld-gld68k.script ld/ld-gld960.c ld/ld-gld960.script ld/ld-gldm88kbcs-Ur.script ld/ld-gldm88kbcs-r.script ld/ld-gldm88kbcs.c ld/ld-gldm88kbcs.script ld/ld-lnk960-r.script ld/ld-lnk960.c ld/ld-lnk960.script ld/ld-vanilla.c ld/ld.h ld/ld.tex ld/ld.texinfo ld/ldemul.c ld/ldexp.c ld/ldexp.h ld/ldfile.c ld/ldfile.h ld/ldgld.c ld/ldgld.sc ld/ldgld.script ld/ldgld68k.c ld/ldgld68k.sc ld/ldgld68k.script ld/ldgld68kUr.sc ld/ldgld68kUr.script ld/ldgld68kr.sc ld/ldgld68kr.script ld/ldgld960.c ld/ldgld960.sc ld/ldgld960.script ld/ldgldUr.sc ld/ldgldUr.script ld/ldglda29k.c ld/ldglda29k.sc ld/ldglda29k.script ld/ldglda29kUr.sc ld/ldglda29kUr.script ld/ldglda29kr.sc ld/ldglda29kr.script ld/ldgldi386v.c ld/ldgldi386v.sc ld/ldgldi386vUr.sc ld/ldgldi386vr.sc ld/ldgldm68kv.c ld/ldgldm68kv.sc ld/ldgldm68kvUr.sc ld/ldgldm68kvr.sc ld/ldgldm88kbcs.c ld/ldgldm88kbcs.sc ld/ldgldm88kbcs.script ld/ldgldm88kbcsUr.sc ld/ldgldm88kbcsUr.script ld/ldgldm88kbcsr.sc ld/ldgldm88kbcsr.script ld/ldgldr.sc ld/ldgldr.script ld/ldgram.y ld/ldindr.c ld/ldindr.h ld/ldlang.c ld/ldlang.h ld/ldlex.h ld/ldlex.l ld/ldlnk960.c ld/ldlnk960.sc ld/ldlnk960.script ld/ldlnk960r.sc ld/ldlnk960r.script ld/ldm88k.c ld/ldm88k.sc ld/ldm88kUr.sc ld/ldm88kr.sc ld/ldmain.c ld/ldmain.h ld/ldmisc.c ld/ldmisc.h ld/ldsym.c ld/ldsym.h ld/ldtemplate ld/ldvanilla.c ld/ldver.c ld/ldver.h ld/ldwarn.c ld/ldwarn.h ld/ldwrite.c ld/ldwrite.h ld/mkscript.c ld/news.sc readline/.Sanitize readline/ChangeLog readline/config.sub readline/configure.in readline/doc/Makefile readline/doc/texindex.c readline/examples/Makefile readline/history.texi readline/history.texinfo readline/inc-hist.texi readline/inc-history.texinfo readline/inc-read.texi readline/inc-readline.texinfo readline/readline.texi readline/readline.texinfo readline/sysdep-aix.h readline/sysdep-norm.h
Diffstat (limited to 'readline')
-rw-r--r--readline/.Sanitize53
-rw-r--r--readline/ChangeLog120
-rw-r--r--readline/INSTALL176
-rw-r--r--readline/Makefile.in103
-rw-r--r--readline/bind.c1396
-rw-r--r--readline/complete.c1205
-rw-r--r--readline/config.h.in145
-rwxr-xr-xreadline/config.sub446
-rwxr-xr-xreadline/configure477
-rw-r--r--readline/configure.in29
-rw-r--r--readline/display.c801
-rw-r--r--readline/doc/Makefile36
-rw-r--r--readline/doc/Makefile.in94
-rw-r--r--readline/doc/texindex.c1606
-rw-r--r--readline/examples/Makefile12
-rw-r--r--readline/examples/histexamp.c82
-rwxr-xr-xreadline/history.texi202
-rwxr-xr-xreadline/history.texinfo194
-rwxr-xr-xreadline/inc-hist.texi188
-rwxr-xr-xreadline/inc-history.texinfo188
-rwxr-xr-xreadline/inc-read.texi490
-rwxr-xr-xreadline/inc-readline.texinfo494
-rw-r--r--readline/isearch.c378
-rw-r--r--readline/parens.c115
-rw-r--r--readline/readline.c27
-rwxr-xr-xreadline/readline.texi442
-rwxr-xr-xreadline/readline.texinfo434
-rw-r--r--readline/rldefs.h250
-rw-r--r--readline/search.c271
-rw-r--r--readline/shell.c138
-rwxr-xr-xreadline/support/install.sh235
-rwxr-xr-xreadline/support/mkdirs32
-rw-r--r--readline/sysdep-aix.h3
-rw-r--r--readline/sysdep-norm.h11
-rw-r--r--readline/tilde.c396
-rw-r--r--readline/tilde.h33
-rw-r--r--readline/xmalloc.c76
37 files changed, 6111 insertions, 5267 deletions
diff --git a/readline/.Sanitize b/readline/.Sanitize
deleted file mode 100644
index 50625e1..0000000
--- a/readline/.Sanitize
+++ /dev/null
@@ -1,53 +0,0 @@
-# Sanitize.in for devo.
-# $Id$
-#
-
-# Each directory to survive it's way into a release will need a file
-# like this one called "./.Sanitize". All keyword lines must exist,
-# and must exist in the order specified by this file. Each directory
-# in the tree will be processed, top down, in the following order.
-
-# Hash started lines like this one are comments and will be deleted
-# before anything else is done. Blank lines will also be squashed
-# out.
-
-# The lines between the "Do-first:" line and the "Things-to-keep:"
-# line are executed as a /bin/sh shell script before anything else is
-# done in this
-
-Do-first:
-
-# All files listed between the "Things-to-keep:" line and the
-# "Files-to-sed:" line will be kept. All other files will be removed.
-# Directories listed in this section will have their own Sanitize
-# called. Directories not listed will be removed in their entirety
-# with rm -rf.
-
-Things-to-keep:
-
-COPYING
-ChangeLog
-Makefile.in
-chardefs.h
-config
-configure.in
-emacs_keymap.c
-funmap.c
-history.c
-history.h
-history.texi
-inc-history.texi
-inc-readline.texi
-keymaps.c
-keymaps.h
-readline.c
-readline.h
-readline.texi
-sysdep-norm.h
-sysdep-aix.h
-vi_keymap.c
-vi_mode.c
-
-Do-last:
-
-# End of file.
diff --git a/readline/ChangeLog b/readline/ChangeLog
deleted file mode 100644
index 7596307..0000000
--- a/readline/ChangeLog
+++ /dev/null
@@ -1,120 +0,0 @@
-Mon Nov 11 20:50:29 1991 Steve Chamberlain (sac at cygnus.com)
-
- * Makefile.in: Use the MINUS_G no-debug convention
- * readline.c: (many_places) move all the declarations of rindex to
- only one place, to reduce the number of warnings it makes.
-
-Sat Nov 9 03:19:40 1991 John Gilmore (gnu at cygnus.com)
-
- * configure.in: Make a link for sysdep.h. Specify commontargets.
- * sysdep-norm.h: The usual alloca declarations.
- * sysdep-aix.h: What AIX 3.1 on RS/6000 needs for alloca.
- * history.c, readline.c: Use sysdep.h.
-
-Thu Oct 24 21:58:46 1991 John Gilmore (gnu at cygnus.com)
-
- * configure.in: aix is a Sys V as far as we're concerned.
- Switch to new config/hm-* scheme.
-
-Thu Oct 24 02:08:50 1991 Fred Fish (fnf at cygnus.com)
-
- * config/hmake-sysv: Send RANLIB (echo) output to /dev/null.
-
-Tue Sep 17 17:44:22 1991 Stu Grossman (grossman at cygnus.com)
-
- * config/hmake-sysv: sgi/irix support.
-
-Sun May 19 07:49:34 1991 John Gilmore and Rich Pixley (at cygnus.com)
-
- Make readline independent of the applications that use it.
-
- * readline.h, keymaps.h: include other include files with "foo.h"
- rather than <readline/foo.h>. This works here, and works when
- included from other applications.
-
- * Makefile.in: Create template for configurable Makefile.
- This version is not ready for prime time, so we have left
- Makefile itself (the original version) too.
-
-Sun Mar 11 04:32:03 1990 Brian Fox (bfox at gnuwest.fsf.org)
-
- * Signals are now supposedly handled inside of SYSV compilation.
-
-Wed Jan 17 19:24:09 1990 Brian Fox (bfox at sbphy.ucsb.edu)
-
- * history.c: history_expand (); fixed overwriting memory error,
- added needed argument to call to get_history_event ().
-
-Thu Jan 11 10:54:04 1990 Brian Fox (bfox at sbphy.ucsb.edu)
-
- * readline.c, readline.h: added rl_show_star to control the
- display of an asterisk on modified history lines.
-
-Thu Jan 4 10:38:05 1990 Brian Fox (bfox at sbphy.ucsb.edu)
-
- * readline.c: start_insert (). Only use IC if we don't have an im
- capability.
-
-Fri Sep 8 09:00:45 1989 Brian Fox (bfox at aurel)
-
- * readline.c: rl_prep_terminal (). Only turn on 8th bit
- as meta-bit iff the terminal is not using parity.
-
-Sun Sep 3 08:57:40 1989 Brian Fox (bfox at aurel)
-
- * readline.c: start_insert (). Uses multiple
- insertion call in cases where that makes sense.
-
- rl_insert (). Read type-ahead buffer for additional
- keys that are bound to rl_insert, and insert them
- all at once. Make insertion of single keys given
- with an argument much more efficient.
-
-Tue Aug 8 18:13:57 1989 Brian Fox (bfox at aurel)
-
- * readline.c: Changed handling of EOF. readline () returns
- (char *)EOF or consed string. The EOF character is read from the
- tty, or if the tty doesn't have one, defaults to C-d.
-
- * readline.c: Added support for event driven programs.
- rl_event_hook is the address of a function you want called
- while Readline is waiting for input.
-
- * readline.c: Cleanup time. Functions without type declarations
- do not use return with a value.
-
- * history.c: history_expand () has new variable which is the
- characters to ignore immediately following history_expansion_char.
-
-Sun Jul 16 08:14:00 1989 Brian Fox (bfox at aurel)
-
- * rl_prep_terminal ()
- BSD version turns off C-s, C-q, C-y, C-v.
-
- * readline.c -- rl_prep_terminal ()
- SYSV version hacks readline_echoing_p.
- BSD version turns on passing of the 8th bit for the duration
- of reading the line.
-
-Tue Jul 11 06:25:01 1989 Brian Fox (bfox at aurel)
-
- * readline.c: new variable rl_tilde_expander.
- If non-null, this contains the address of a function to call if
- the standard meaning for expanding a tilde fails. The function is
- called with the text sans tilde (as in "foo"), and returns a
- malloc()'ed string which is the expansion, or a NULL pointer if
- there is no expansion.
-
- * readline.h - new file chardefs.h
- Separates things that only readline.c needs from the standard
- header file publishing interesting things about readline.
-
- * readline.c:
- readline_default_bindings () now looks at terminal chararacters
- and binds those as well.
-
-Wed Jun 28 20:20:51 1989 Brian Fox (bfox at aurel)
-
- * Made readline and history into independent libraries.
-
-
diff --git a/readline/INSTALL b/readline/INSTALL
new file mode 100644
index 0000000..95d84c8
--- /dev/null
+++ b/readline/INSTALL
@@ -0,0 +1,176 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/readline/Makefile.in b/readline/Makefile.in
index 4cf7433..4fb6ceb 100644
--- a/readline/Makefile.in
+++ b/readline/Makefile.in
@@ -1,16 +1,8 @@
+## -*- text -*- ####################################################
# #
# Makefile for readline and history libraries. #
# #
-
-
-srcdir = .
-ddestdir = /usr/local
-idestdir = /usr/local
-INSTALL_PROG = install -c
-INSTALL_FILE = $(INSTALL_PROG)
-
-#### host and target dependent Makefile fragments come in here.
-##
+####################################################################
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
@@ -19,13 +11,16 @@ INSTALL_FILE = $(INSTALL_PROG)
# Destination installation directory. The libraries are copied to DESTDIR
# when you do a `make install', and the header files to INCDIR/readline/*.h.
-DESTDIR = $(ddestdir)/lib
-INCDIR = $(ddestdir)/include
+DESTDIR = /usr/local/lib
+INCDIR = /usr/local/include
# Define TYPES as -DVOID_SIGHANDLER if your operating system uses
# a return type of "void" for signal handlers.
TYPES = -DVOID_SIGHANDLER
+# Define SYSV as -DSYSV if you are using a System V operating system.
+#SYSV = -DSYSV
+
# HP-UX compilation requires the BSD library.
#LOCAL_LIBS = -lBSD
@@ -36,21 +31,19 @@ TYPES = -DVOID_SIGHANDLER
# the vi line editing mode and features.
READLINE_DEFINES = $(TYPES) -DVI_MODE
-MINUS_G=-g
-DEBUG_FLAGS = $(MINUS_G)
+DEBUG_FLAGS = -g
LDFLAGS = $(DEBUG_FLAGS)
CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I.
# A good alternative is gcc -traditional.
#CC = gcc -traditional
CC = cc
-RANLIB = /bin/ranlib
+RANLIB = /usr/bin/ranlib
AR = ar
-AR_FLAGS = clq
RM = rm
CP = cp
-LOCAL_INCLUDES = -I$(srcdir)/../
+LOCAL_INCLUDES = -I../
CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
emacs_keymap.c vi_keymap.c
@@ -58,8 +51,8 @@ CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
HSOURCES = readline.h chardefs.h history.h keymaps.h
SOURCES = $(CSOURCES) $(HSOURCES)
-DOCUMENTATION = readline.texi inc-read.texi \
- history.texi inc-hist.texi
+DOCUMENTATION = readline.texinfo inc-readline.texinfo \
+ history.texinfo inc-history.texinfo
SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog
@@ -67,22 +60,12 @@ THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
##########################################################################
-STAGESTUFF = *.o
-
all: libreadline.a
-all-info: history.info readline.info
-
-history.info: history.texi
- - $(MAKEINFO) -o history.info $(srcdir)/history.texi
-
-readline.info: readline.texi
- - $(MAKEINFO) -o readline.info $(srcdir)/readline.texi
-
libreadline.a: readline.o history.o funmap.o keymaps.o
$(RM) -f libreadline.a
- $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o
- $(RANLIB) libreadline.a
+ $(AR) clq libreadline.a readline.o history.o funmap.o keymaps.o
+ -if [ -f $(RANLIB) ]; then $(RANLIB) libreadline.a; fi
readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c
history.o: history.c history.h
@@ -103,64 +86,18 @@ readline.tar: $(THINGS_TO_TAR)
readline.tar.Z: readline.tar
compress -f readline.tar
-install: includes
- $(INSTALL_PROG) libreadline.a $(DESTDIR)/libreadline.an
- -mv $(DESTDIR)/libreadline.an $(DESTDIR)/libreadline.a
- $(RANLIB) $(DESTDIR)/libreadline.a
-
-install-info: all-info
- for i in *.info* ; do \
- echo Installing $$i... ; \
- cp $$i $(idestdir)/info/$$i ; \
- done
+install: $(DESTDIR)/libreadline.a includes
includes:
if [ ! -r $(INCDIR)/readline ]; then\
mkdir $(INCDIR)/readline;\
chmod a+r $(INCDIR)/readline;\
fi
- $(INSTALL_FILE) $(srcdir)/readline.h $(INCDIR)/readline/
- $(INSTALL_FILE) $(srcdir)/keymaps.h $(INCDIR)/readline/
- $(INSTALL_FILE) $(srcdir)/chardefs.h $(INCDIR)/readline/
+ $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
clean:
- rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn
- rm -f *.aux *.pg *.toc *.info*
+ rm -f *.o *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
$(DESTDIR)/libreadline.a: libreadline.a
-
-# Copy the object files from a particular stage into a subdirectory.
-stage1: force
- -mkdir stage1
- -mv $(STAGESTUFF) stage1
-
-stage2: force
- -mkdir stage2
- -mv $(STAGESTUFF) stage2
-
-stage3: force
- -mkdir stage3
- -mv $(STAGESTUFF) stage3
-
-against=stage2
-
-comparison: force
- for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
-
-de-stage1: force
- - (cd stage1 ; mv -f * ..)
- - rmdir stage1
-
-de-stage2: force
- - (cd stage2 ; mv -f * ..)
- - rmdir stage2
-
-de-stage3: force
- - (cd stage3 ; mv -f * ..)
- - rmdir stage3
-
-force:
-
-# with the gnu make, this is done automatically.
-
-Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
- $(SHELL) ./config.status
+ -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
+ cp libreadline.a $(DESTDIR)/libreadline.a
+ $(RANLIB) -t $(DESTDIR)/libreadline.a
diff --git a/readline/bind.c b/readline/bind.c
new file mode 100644
index 0000000..a7ffe25
--- /dev/null
+++ b/readline/bind.c
@@ -0,0 +1,1396 @@
+/* bind.c -- key binding and startup file support for the readline library. */
+
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "sysdep.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#ifndef NO_SYS_FILE
+#include <sys/file.h>
+#endif
+
+#include <errno.h>
+/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
+#if !defined (errno)
+extern int errno;
+#endif /* !errno */
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+
+/* Some standard library routines. */
+#include "readline.h"
+#include "history.h"
+
+#if !defined (strchr) && !defined (__STDC__)
+extern char *strchr (), *strrchr ();
+#endif /* !strchr && !__STDC__ */
+
+extern char *tilde_expand ();
+
+extern int _rl_horizontal_scroll_mode;
+extern int _rl_mark_modified_lines;
+extern int _rl_prefer_visible_bell;
+extern int _rl_meta_flag;
+extern int rl_blink_matching_paren;
+extern int _rl_convert_meta_chars_to_ascii;
+#if defined (VISIBLE_STATS)
+extern int rl_visible_stats;
+#endif /* VISIBLE_STATS */
+extern int rl_complete_with_tilde_expansion;
+extern int rl_completion_query_items;
+
+extern int rl_explicit_arg;
+extern int rl_editing_mode;
+extern unsigned short _rl_parsing_conditionalized_out;
+extern Keymap _rl_keymap;
+
+extern char *possible_control_prefixes[], *possible_meta_prefixes[];
+
+extern char **rl_funmap_names ();
+
+static void rl_generic_bind ();
+static int glean_key_from_name ();
+static int stricmp (), strnicmp ();
+
+#if defined (STATIC_MALLOC)
+static char *xmalloc (), *xrealloc ();
+#else
+extern char *xmalloc (), *xrealloc ();
+#endif /* STATIC_MALLOC */
+
+/* **************************************************************** */
+/* */
+/* Binding keys */
+/* */
+/* **************************************************************** */
+
+/* rl_add_defun (char *name, Function *function, int key)
+ Add NAME to the list of named functions. Make FUNCTION be the function
+ that gets called. If KEY is not -1, then bind it. */
+rl_add_defun (name, function, key)
+ char *name;
+ Function *function;
+ int key;
+{
+ if (key != -1)
+ rl_bind_key (key, function);
+ rl_add_funmap_entry (name, function);
+}
+
+/* Bind KEY to FUNCTION. Returns non-zero if KEY is out of range. */
+int
+rl_bind_key (key, function)
+ int key;
+ Function *function;
+{
+ if (key < 0)
+ return (key);
+
+ if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
+ {
+ if (_rl_keymap[ESC].type == ISKMAP)
+ {
+ Keymap escmap = (Keymap)_rl_keymap[ESC].function;
+
+ key = UNMETA (key);
+ escmap[key].type = ISFUNC;
+ escmap[key].function = function;
+ return (0);
+ }
+ return (key);
+ }
+
+ _rl_keymap[key].type = ISFUNC;
+ _rl_keymap[key].function = function;
+ return (0);
+}
+
+/* Bind KEY to FUNCTION in MAP. Returns non-zero in case of invalid
+ KEY. */
+int
+rl_bind_key_in_map (key, function, map)
+ int key;
+ Function *function;
+ Keymap map;
+{
+ int result;
+ Keymap oldmap = _rl_keymap;
+
+ _rl_keymap = map;
+ result = rl_bind_key (key, function);
+ _rl_keymap = oldmap;
+ return (result);
+}
+
+/* Make KEY do nothing in the currently selected keymap.
+ Returns non-zero in case of error. */
+int
+rl_unbind_key (key)
+ int key;
+{
+ return (rl_bind_key (key, (Function *)NULL));
+}
+
+/* Make KEY do nothing in MAP.
+ Returns non-zero in case of error. */
+int
+rl_unbind_key_in_map (key, map)
+ int key;
+ Keymap map;
+{
+ return (rl_bind_key_in_map (key, (Function *)NULL, map));
+}
+
+/* Bind the key sequence represented by the string KEYSEQ to
+ FUNCTION. This makes new keymaps as necessary. The initial
+ place to do bindings is in MAP. */
+rl_set_key (keyseq, function, map)
+ char *keyseq;
+ Function *function;
+ Keymap map;
+{
+ rl_generic_bind (ISFUNC, keyseq, function, map);
+}
+
+/* Bind the key sequence represented by the string KEYSEQ to
+ the string of characters MACRO. This makes new keymaps as
+ necessary. The initial place to do bindings is in MAP. */
+rl_macro_bind (keyseq, macro, map)
+ char *keyseq, *macro;
+ Keymap map;
+{
+ char *macro_keys;
+ int macro_keys_len;
+
+ macro_keys = (char *)xmalloc ((2 * strlen (macro)) + 1);
+
+ if (rl_translate_keyseq (macro, macro_keys, &macro_keys_len))
+ {
+ free (macro_keys);
+ return;
+ }
+ rl_generic_bind (ISMACR, keyseq, macro_keys, map);
+}
+
+/* Bind the key sequence represented by the string KEYSEQ to
+ the arbitrary pointer DATA. TYPE says what kind of data is
+ pointed to by DATA, right now this can be a function (ISFUNC),
+ a macro (ISMACR), or a keymap (ISKMAP). This makes new keymaps
+ as necessary. The initial place to do bindings is in MAP. */
+
+static void
+rl_generic_bind (type, keyseq, data, map)
+ int type;
+ char *keyseq, *data;
+ Keymap map;
+{
+ char *keys;
+ int keys_len;
+ register int i;
+
+ /* If no keys to bind to, exit right away. */
+ if (!keyseq || !*keyseq)
+ {
+ if (type == ISMACR)
+ free (data);
+ return;
+ }
+
+ keys = (char *)alloca (1 + (2 * strlen (keyseq)));
+
+ /* Translate the ASCII representation of KEYSEQ into an array of
+ characters. Stuff the characters into KEYS, and the length of
+ KEYS into KEYS_LEN. */
+ if (rl_translate_keyseq (keyseq, keys, &keys_len))
+ return;
+
+ /* Bind keys, making new keymaps as necessary. */
+ for (i = 0; i < keys_len; i++)
+ {
+ int ic = (int) ((unsigned char)keys[i]);
+
+ if (_rl_convert_meta_chars_to_ascii && META_CHAR (ic))
+ {
+ ic = UNMETA (ic);
+ if (map[ESC].type == ISKMAP)
+ map = (Keymap) map[ESC].function;
+ }
+
+ if ((i + 1) < keys_len)
+ {
+ if (map[ic].type != ISKMAP)
+ {
+ if (map[ic].type == ISMACR)
+ free ((char *)map[ic].function);
+
+ map[ic].type = ISKMAP;
+ map[ic].function = (Function *)rl_make_bare_keymap ();
+ }
+ map = (Keymap)map[ic].function;
+ }
+ else
+ {
+ if (map[ic].type == ISMACR)
+ free ((char *)map[ic].function);
+
+ map[ic].function = (Function *)data;
+ map[ic].type = type;
+ }
+ }
+}
+
+/* Translate the ASCII representation of SEQ, stuffing the values into ARRAY,
+ an array of characters. LEN gets the final length of ARRAY. Return
+ non-zero if there was an error parsing SEQ. */
+rl_translate_keyseq (seq, array, len)
+ char *seq, *array;
+ int *len;
+{
+ register int i, c, l = 0;
+
+ for (i = 0; c = seq[i]; i++)
+ {
+ if (c == '\\')
+ {
+ c = seq[++i];
+
+ if (!c)
+ break;
+
+ if (((c == 'C' || c == 'M') && seq[i + 1] == '-') ||
+ (c == 'e'))
+ {
+ /* Handle special case of backwards define. */
+ if (strncmp (&seq[i], "C-\\M-", 5) == 0)
+ {
+ array[l++] = ESC;
+ i += 5;
+ array[l++] = CTRL (to_upper (seq[i]));
+ if (!seq[i])
+ i--;
+ continue;
+ }
+
+ switch (c)
+ {
+ case 'M':
+ i++;
+ array[l++] = ESC;
+ break;
+
+ case 'C':
+ i += 2;
+ /* Special hack for C-?... */
+ if (seq[i] == '?')
+ array[l++] = RUBOUT;
+ else
+ array[l++] = CTRL (to_upper (seq[i]));
+ break;
+
+ case 'e':
+ array[l++] = ESC;
+ }
+
+ continue;
+ }
+ }
+ array[l++] = c;
+ }
+
+ *len = l;
+ array[l] = '\0';
+ return (0);
+}
+
+/* Return a pointer to the function that STRING represents.
+ If STRING doesn't have a matching function, then a NULL pointer
+ is returned. */
+Function *
+rl_named_function (string)
+ char *string;
+{
+ register int i;
+
+ rl_initialize_funmap ();
+
+ for (i = 0; funmap[i]; i++)
+ if (stricmp (funmap[i]->name, string) == 0)
+ return (funmap[i]->function);
+ return ((Function *)NULL);
+}
+
+/* Return the function (or macro) definition which would be invoked via
+ KEYSEQ if executed in MAP. If MAP is NULL, then the current keymap is
+ used. TYPE, if non-NULL, is a pointer to an int which will receive the
+ type of the object pointed to. One of ISFUNC (function), ISKMAP (keymap),
+ or ISMACR (macro). */
+Function *
+rl_function_of_keyseq (keyseq, map, type)
+ char *keyseq;
+ Keymap map;
+ int *type;
+{
+ register int i;
+
+ if (!map)
+ map = _rl_keymap;
+
+ for (i = 0; keyseq && keyseq[i]; i++)
+ {
+ int ic = keyseq[i];
+
+ if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
+ {
+ if (map[ESC].type != ISKMAP)
+ {
+ if (type)
+ *type = map[ESC].type;
+
+ return (map[ESC].function);
+ }
+ else
+ {
+ map = (Keymap)map[ESC].function;
+ ic = UNMETA (ic);
+ }
+ }
+
+ if (map[ic].type == ISKMAP)
+ {
+ /* If this is the last key in the key sequence, return the
+ map. */
+ if (!keyseq[i + 1])
+ {
+ if (type)
+ *type = ISKMAP;
+
+ return (map[ic].function);
+ }
+ else
+ map = (Keymap)map[ic].function;
+ }
+ else
+ {
+ if (type)
+ *type = map[ic].type;
+
+ return (map[ic].function);
+ }
+ }
+}
+
+/* The last key bindings file read. */
+static char *last_readline_init_file = (char *)NULL;
+
+/* Re-read the current keybindings file. */
+rl_re_read_init_file (count, ignore)
+ int count, ignore;
+{
+ rl_read_init_file ((char *)NULL);
+}
+
+/* The final, last-ditch effort file name for an init file. */
+#ifdef __MSDOS__
+/* Don't know what to do, but this is a guess */
+#define DEFAULT_INPUTRC "/INPUTRC";
+#else
+#define DEFAULT_INPUTRC "~/.inputrc"
+#endif
+
+/* Do key bindings from a file. If FILENAME is NULL it defaults
+ to `~/.inputrc'. If the file existed and could be opened and
+ read, 0 is returned, otherwise errno is returned. */
+int
+rl_read_init_file (filename)
+ char *filename;
+{
+ register int i;
+ char *buffer, *openname, *line, *end;
+ struct stat finfo;
+ int file;
+
+ /* Default the filename. */
+ if (!filename)
+ {
+ if (last_readline_init_file)
+ filename = last_readline_init_file;
+ else
+ filename = DEFAULT_INPUTRC;
+ }
+
+ openname = tilde_expand (filename);
+
+ if (!openname || *openname == '\000')
+ return ENOENT;
+
+ if ((stat (openname, &finfo) < 0) ||
+ (file = open (openname, O_RDONLY, 0666)) < 0)
+ {
+ free (openname);
+ return (errno);
+ }
+ else
+ free (openname);
+
+ if (last_readline_init_file)
+ free (last_readline_init_file);
+
+ last_readline_init_file = savestring (filename);
+
+ /* Read the file into BUFFER. */
+ buffer = (char *)xmalloc ((int)finfo.st_size + 1);
+ i = read (file, buffer, finfo.st_size);
+ close (file);
+
+ if (i != finfo.st_size)
+ return (errno);
+
+ /* Loop over the lines in the file. Lines that start with `#' are
+ comments; all other lines are commands for readline initialization. */
+ line = buffer;
+ end = buffer + finfo.st_size;
+ while (line < end)
+ {
+ /* Find the end of this line. */
+ for (i = 0; line + i != end && line[i] != '\n'; i++);
+
+ /* Mark end of line. */
+ line[i] = '\0';
+
+ /* If the line is not a comment, then parse it. */
+ if (*line && *line != '#')
+ rl_parse_and_bind (line);
+
+ /* Move to the next line. */
+ line += i + 1;
+ }
+ free (buffer);
+ return (0);
+}
+
+/* **************************************************************** */
+/* */
+/* Parser Directives */
+/* */
+/* **************************************************************** */
+
+/* Conditionals. */
+
+/* Calling programs set this to have their argv[0]. */
+char *rl_readline_name = "other";
+
+/* Stack of previous values of parsing_conditionalized_out. */
+static unsigned char *if_stack = (unsigned char *)NULL;
+static int if_stack_depth = 0;
+static int if_stack_size = 0;
+
+/* Push _rl_parsing_conditionalized_out, and set parser state based
+ on ARGS. */
+static int
+parser_if (args)
+ char *args;
+{
+ register int i;
+
+ /* Push parser state. */
+ if (if_stack_depth + 1 >= if_stack_size)
+ {
+ if (!if_stack)
+ if_stack = (unsigned char *)xmalloc (if_stack_size = 20);
+ else
+ if_stack = (unsigned char *)xrealloc (if_stack, if_stack_size += 20);
+ }
+ if_stack[if_stack_depth++] = _rl_parsing_conditionalized_out;
+
+ /* If parsing is turned off, then nothing can turn it back on except
+ for finding the matching endif. In that case, return right now. */
+ if (_rl_parsing_conditionalized_out)
+ return 0;
+
+ /* Isolate first argument. */
+ for (i = 0; args[i] && !whitespace (args[i]); i++);
+
+ if (args[i])
+ args[i++] = '\0';
+
+ /* Handle "if term=foo" and "if mode=emacs" constructs. If this
+ isn't term=foo, or mode=emacs, then check to see if the first
+ word in ARGS is the same as the value stored in rl_readline_name. */
+ if (rl_terminal_name && strnicmp (args, "term=", 5) == 0)
+ {
+ char *tem, *tname;
+
+ /* Terminals like "aaa-60" are equivalent to "aaa". */
+ tname = savestring (rl_terminal_name);
+ tem = (char*) strrchr (tname, '-');
+ if (tem)
+ *tem = '\0';
+
+ /* Test the `long' and `short' forms of the terminal name so that
+ if someone has a `sun-cmd' and does not want to have bindings
+ that will be executed if the terminal is a `sun', they can put
+ `$if term=sun-cmd' into their .inputrc. */
+ if ((stricmp (args + 5, tname) == 0) ||
+ (stricmp (args + 5, rl_terminal_name) == 0))
+ _rl_parsing_conditionalized_out = 0;
+ else
+ _rl_parsing_conditionalized_out = 1;
+
+ free (tname);
+ }
+#if defined (VI_MODE)
+ else if (strnicmp (args, "mode=", 5) == 0)
+ {
+ int mode;
+
+ if (stricmp (args + 5, "emacs") == 0)
+ mode = emacs_mode;
+ else if (stricmp (args + 5, "vi") == 0)
+ mode = vi_mode;
+ else
+ mode = no_mode;
+
+ if (mode == rl_editing_mode)
+ _rl_parsing_conditionalized_out = 0;
+ else
+ _rl_parsing_conditionalized_out = 1;
+ }
+#endif /* VI_MODE */
+ /* Check to see if the first word in ARGS is the same as the
+ value stored in rl_readline_name. */
+ else if (stricmp (args, rl_readline_name) == 0)
+ _rl_parsing_conditionalized_out = 0;
+ else
+ _rl_parsing_conditionalized_out = 1;
+ return 0;
+}
+
+/* Invert the current parser state if there is anything on the stack. */
+static int
+parser_else (args)
+ char *args;
+{
+ register int i;
+
+ if (!if_stack_depth)
+ {
+ /* Error message? */
+ return 0;
+ }
+
+ /* Check the previous (n - 1) levels of the stack to make sure that
+ we haven't previously turned off parsing. */
+ for (i = 0; i < if_stack_depth - 1; i++)
+ if (if_stack[i] == 1)
+ return 0;
+
+ /* Invert the state of parsing if at top level. */
+ _rl_parsing_conditionalized_out = !_rl_parsing_conditionalized_out;
+ return 0;
+}
+
+/* Terminate a conditional, popping the value of
+ _rl_parsing_conditionalized_out from the stack. */
+static int
+parser_endif (args)
+ char *args;
+{
+ if (if_stack_depth)
+ _rl_parsing_conditionalized_out = if_stack[--if_stack_depth];
+ else
+ {
+ /* *** What, no error message? *** */
+ }
+ return 0;
+}
+
+/* Associate textual names with actual functions. */
+static struct {
+ char *name;
+ Function *function;
+} parser_directives [] = {
+ { "if", parser_if },
+ { "endif", parser_endif },
+ { "else", parser_else },
+ { (char *)0x0, (Function *)0x0 }
+};
+
+/* Handle a parser directive. STATEMENT is the line of the directive
+ without any leading `$'. */
+static int
+handle_parser_directive (statement)
+ char *statement;
+{
+ register int i;
+ char *directive, *args;
+
+ /* Isolate the actual directive. */
+
+ /* Skip whitespace. */
+ for (i = 0; whitespace (statement[i]); i++);
+
+ directive = &statement[i];
+
+ for (; statement[i] && !whitespace (statement[i]); i++);
+
+ if (statement[i])
+ statement[i++] = '\0';
+
+ for (; statement[i] && whitespace (statement[i]); i++);
+
+ args = &statement[i];
+
+ /* Lookup the command, and act on it. */
+ for (i = 0; parser_directives[i].name; i++)
+ if (stricmp (directive, parser_directives[i].name) == 0)
+ {
+ (*parser_directives[i].function) (args);
+ return (0);
+ }
+
+ /* *** Should an error message be output? */
+ return (1);
+}
+
+/* Ugly but working hack for binding prefix meta. */
+#define PREFIX_META_HACK
+
+static int substring_member_of_array ();
+
+/* Read the binding command from STRING and perform it.
+ A key binding command looks like: Keyname: function-name\0,
+ a variable binding command looks like: set variable value.
+ A new-style keybinding looks like "\C-x\C-x": exchange-point-and-mark. */
+rl_parse_and_bind (string)
+ char *string;
+{
+ char *funname, *kname;
+ register int c, i;
+ int key, equivalency;
+
+ while (string && whitespace (*string))
+ string++;
+
+ if (!string || !*string || *string == '#')
+ return;
+
+ /* If this is a parser directive, act on it. */
+ if (*string == '$')
+ {
+ handle_parser_directive (&string[1]);
+ return;
+ }
+
+ /* If we aren't supposed to be parsing right now, then we're done. */
+ if (_rl_parsing_conditionalized_out)
+ return;
+
+ i = 0;
+ /* If this keyname is a complex key expression surrounded by quotes,
+ advance to after the matching close quote. This code allows the
+ backslash to quote characters in the key expression. */
+ if (*string == '"')
+ {
+ int passc = 0;
+
+ for (i = 1; c = string[i]; i++)
+ {
+ if (passc)
+ {
+ passc = 0;
+ continue;
+ }
+
+ if (c == '\\')
+ {
+ passc++;
+ continue;
+ }
+
+ if (c == '"')
+ break;
+ }
+ }
+
+ /* Advance to the colon (:) or whitespace which separates the two objects. */
+ for (; (c = string[i]) && c != ':' && c != ' ' && c != '\t'; i++ );
+
+ equivalency = (c == ':' && string[i + 1] == '=');
+
+ /* Mark the end of the command (or keyname). */
+ if (string[i])
+ string[i++] = '\0';
+
+ /* If doing assignment, skip the '=' sign as well. */
+ if (equivalency)
+ string[i++] = '\0';
+
+ /* If this is a command to set a variable, then do that. */
+ if (stricmp (string, "set") == 0)
+ {
+ char *var = string + i;
+ char *value;
+
+ /* Make VAR point to start of variable name. */
+ while (*var && whitespace (*var)) var++;
+
+ /* Make value point to start of value string. */
+ value = var;
+ while (*value && !whitespace (*value)) value++;
+ if (*value)
+ *value++ = '\0';
+ while (*value && whitespace (*value)) value++;
+
+ rl_variable_bind (var, value);
+ return;
+ }
+
+ /* Skip any whitespace between keyname and funname. */
+ for (; string[i] && whitespace (string[i]); i++);
+ funname = &string[i];
+
+ /* Now isolate funname.
+ For straight function names just look for whitespace, since
+ that will signify the end of the string. But this could be a
+ macro definition. In that case, the string is quoted, so skip
+ to the matching delimiter. We allow the backslash to quote the
+ delimiter characters in the macro body. */
+ /* This code exists to allow whitespace in macro expansions, which
+ would otherwise be gobbled up by the next `for' loop.*/
+ /* XXX - it may be desirable to allow backslash quoting only if " is
+ the quoted string delimiter, like the shell. */
+ if (*funname == '\'' || *funname == '"')
+ {
+ int delimiter = string[i++];
+ int passc = 0;
+
+ for (; c = string[i]; i++)
+ {
+ if (passc)
+ {
+ passc = 0;
+ continue;
+ }
+
+ if (c == '\\')
+ {
+ passc = 1;
+ continue;
+ }
+
+ if (c == delimiter)
+ break;
+ }
+ if (c)
+ i++;
+ }
+
+ /* Advance to the end of the string. */
+ for (; string[i] && !whitespace (string[i]); i++);
+
+ /* No extra whitespace at the end of the string. */
+ string[i] = '\0';
+
+ /* Handle equivalency bindings here. Make the left-hand side be exactly
+ whatever the right-hand evaluates to, including keymaps. */
+ if (equivalency)
+ {
+ return;
+ }
+
+ /* If this is a new-style key-binding, then do the binding with
+ rl_set_key (). Otherwise, let the older code deal with it. */
+ if (*string == '"')
+ {
+ char *seq = (char *)alloca (1 + strlen (string));
+ register int j, k = 0;
+ int passc = 0;
+
+ for (j = 1; string[j]; j++)
+ {
+ /* Allow backslash to quote characters, but leave them in place.
+ This allows a string to end with a backslash quoting another
+ backslash, or with a backslash quoting a double quote. The
+ backslashes are left in place for rl_translate_keyseq (). */
+ if (passc || (string[j] == '\\'))
+ {
+ seq[k++] = string[j];
+ passc = !passc;
+ continue;
+ }
+
+ if (string[j] == '"')
+ break;
+
+ seq[k++] = string[j];
+ }
+ seq[k] = '\0';
+
+ /* Binding macro? */
+ if (*funname == '\'' || *funname == '"')
+ {
+ j = strlen (funname);
+
+ /* Remove the delimiting quotes from each end of FUNNAME. */
+ if (j && funname[j - 1] == *funname)
+ funname[j - 1] = '\0';
+
+ rl_macro_bind (seq, &funname[1], _rl_keymap);
+ }
+ else
+ rl_set_key (seq, rl_named_function (funname), _rl_keymap);
+
+ return;
+ }
+
+ /* Get the actual character we want to deal with. */
+ kname = (char*) strrchr (string, '-');
+ if (!kname)
+ kname = string;
+ else
+ kname++;
+
+ key = glean_key_from_name (kname);
+
+ /* Add in control and meta bits. */
+ if (substring_member_of_array (string, possible_control_prefixes))
+ key = CTRL (to_upper (key));
+
+ if (substring_member_of_array (string, possible_meta_prefixes))
+ key = META (key);
+
+ /* Temporary. Handle old-style keyname with macro-binding. */
+ if (*funname == '\'' || *funname == '"')
+ {
+ char seq[2];
+ int fl = strlen (funname);
+
+ seq[0] = key; seq[1] = '\0';
+ if (fl && funname[fl - 1] == *funname)
+ funname[fl - 1] = '\0';
+
+ rl_macro_bind (seq, &funname[1], _rl_keymap);
+ }
+#if defined (PREFIX_META_HACK)
+ /* Ugly, but working hack to keep prefix-meta around. */
+ else if (stricmp (funname, "prefix-meta") == 0)
+ {
+ char seq[2];
+
+ seq[0] = key;
+ seq[1] = '\0';
+ rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
+ }
+#endif /* PREFIX_META_HACK */
+ else
+ rl_bind_key (key, rl_named_function (funname));
+}
+
+/* Simple structure for boolean readline variables (i.e., those that can
+ have one of two values; either "On" or 1 for truth, or "Off" or 0 for
+ false. */
+
+static struct {
+ char *name;
+ int *value;
+} boolean_varlist [] = {
+ { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode },
+ { "mark-modified-lines", &_rl_mark_modified_lines },
+ { "prefer-visible-bell", &_rl_prefer_visible_bell },
+ { "meta-flag", &_rl_meta_flag },
+ { "blink-matching-paren", &rl_blink_matching_paren },
+ { "convert-meta", &_rl_convert_meta_chars_to_ascii },
+#if defined (VISIBLE_STATS)
+ { "visible-stats", &rl_visible_stats },
+#endif /* VISIBLE_STATS */
+ { "expand-tilde", &rl_complete_with_tilde_expansion },
+ { (char *)NULL, (int *)NULL }
+};
+
+rl_variable_bind (name, value)
+ char *name, *value;
+{
+ register int i;
+
+ /* Check for simple variables first. */
+ for (i = 0; boolean_varlist[i].name; i++)
+ {
+ if (stricmp (name, boolean_varlist[i].name) == 0)
+ {
+ /* A variable is TRUE if the "value" is "on", "1" or "". */
+ if ((!*value) ||
+ (stricmp (value, "On") == 0) ||
+ (value[0] == '1' && value[1] == '\0'))
+ *boolean_varlist[i].value = 1;
+ else
+ *boolean_varlist[i].value = 0;
+ return;
+ }
+ }
+
+ /* Not a boolean variable, so check for specials. */
+
+ /* Editing mode change? */
+ if (stricmp (name, "editing-mode") == 0)
+ {
+ if (strnicmp (value, "vi", 2) == 0)
+ {
+#if defined (VI_MODE)
+ _rl_keymap = vi_insertion_keymap;
+ rl_editing_mode = vi_mode;
+#else
+#if defined (NOTDEF)
+ /* What state is the terminal in? I'll tell you:
+ non-determinate! That means we cannot do any output. */
+ ding ();
+#endif /* NOTDEF */
+#endif /* VI_MODE */
+ }
+ else if (strnicmp (value, "emacs", 5) == 0)
+ {
+ _rl_keymap = emacs_standard_keymap;
+ rl_editing_mode = emacs_mode;
+ }
+ }
+
+ /* Comment string change? */
+ else if (stricmp (name, "comment-begin") == 0)
+ {
+#if defined (VI_MODE)
+ extern char *rl_vi_comment_begin;
+
+ if (*value)
+ {
+ if (rl_vi_comment_begin)
+ free (rl_vi_comment_begin);
+
+ rl_vi_comment_begin = savestring (value);
+ }
+#endif /* VI_MODE */
+ }
+ else if (stricmp (name, "completion-query-items") == 0)
+ {
+ int nval = 100;
+ if (*value)
+ {
+ nval = atoi (value);
+ if (nval < 0)
+ nval = 0;
+ }
+ rl_completion_query_items = nval;
+ }
+}
+
+/* Return the character which matches NAME.
+ For example, `Space' returns ' '. */
+
+typedef struct {
+ char *name;
+ int value;
+} assoc_list;
+
+static assoc_list name_key_alist[] = {
+ { "DEL", 0x7f },
+ { "ESC", '\033' },
+ { "Escape", '\033' },
+ { "LFD", '\n' },
+ { "Newline", '\n' },
+ { "RET", '\r' },
+ { "Return", '\r' },
+ { "Rubout", 0x7f },
+ { "SPC", ' ' },
+ { "Space", ' ' },
+ { "Tab", 0x09 },
+ { (char *)0x0, 0 }
+};
+
+static int
+glean_key_from_name (name)
+ char *name;
+{
+ register int i;
+
+ for (i = 0; name_key_alist[i].name; i++)
+ if (stricmp (name, name_key_alist[i].name) == 0)
+ return (name_key_alist[i].value);
+
+ return (*(unsigned char *)name); /* XXX was return (*name) */
+}
+
+/* Auxiliary functions to manage keymaps. */
+static struct {
+ char *name;
+ Keymap map;
+} keymap_names[] = {
+ { "emacs", emacs_standard_keymap },
+ { "emacs-standard", emacs_standard_keymap },
+ { "emacs-meta", emacs_meta_keymap },
+ { "emacs-ctlx", emacs_ctlx_keymap },
+#if defined (VI_MODE)
+ { "vi", vi_movement_keymap },
+ { "vi-move", vi_movement_keymap },
+ { "vi-command", vi_movement_keymap },
+ { "vi-insert", vi_insertion_keymap },
+#endif /* VI_MODE */
+ { (char *)0x0, (Keymap)0x0 }
+};
+
+Keymap
+rl_get_keymap_by_name (name)
+ char *name;
+{
+ register int i;
+
+ for (i = 0; keymap_names[i].name; i++)
+ if (strcmp (name, keymap_names[i].name) == 0)
+ return (keymap_names[i].map);
+ return ((Keymap) NULL);
+}
+
+void
+rl_set_keymap (map)
+ Keymap map;
+{
+ if (map)
+ _rl_keymap = map;
+}
+
+Keymap
+rl_get_keymap ()
+{
+ return (_rl_keymap);
+}
+
+void
+rl_set_keymap_from_edit_mode ()
+{
+ if (rl_editing_mode == emacs_mode)
+ _rl_keymap = emacs_standard_keymap;
+ else if (rl_editing_mode == vi_mode)
+ _rl_keymap = vi_insertion_keymap;
+}
+
+/* **************************************************************** */
+/* */
+/* Key Binding and Function Information */
+/* */
+/* **************************************************************** */
+
+/* Each of the following functions produces information about the
+ state of keybindings and functions known to Readline. The info
+ is always printed to rl_outstream, and in such a way that it can
+ be read back in (i.e., passed to rl_parse_and_bind (). */
+
+/* Print the names of functions known to Readline. */
+void
+rl_list_funmap_names (ignore)
+ int ignore;
+{
+ register int i;
+ char **funmap_names;
+
+ funmap_names = rl_funmap_names ();
+
+ if (!funmap_names)
+ return;
+
+ for (i = 0; funmap_names[i]; i++)
+ fprintf (rl_outstream, "%s\n", funmap_names[i]);
+
+ free (funmap_names);
+}
+
+/* Return a NULL terminated array of strings which represent the key
+ sequences that are used to invoke FUNCTION in MAP. */
+static char **
+invoking_keyseqs_in_map (function, map)
+ Function *function;
+ Keymap map;
+{
+ register int key;
+ char **result;
+ int result_index, result_size;
+
+ result = (char **)NULL;
+ result_index = result_size = 0;
+
+ for (key = 0; key < 128; key++)
+ {
+ switch (map[key].type)
+ {
+ case ISMACR:
+ /* Macros match, if, and only if, the pointers are identical.
+ Thus, they are treated exactly like functions in here. */
+ case ISFUNC:
+ /* If the function in the keymap is the one we are looking for,
+ then add the current KEY to the list of invoking keys. */
+ if (map[key].function == function)
+ {
+ char *keyname = (char *)xmalloc (5);
+
+ if (CTRL_P (key))
+ sprintf (keyname, "\\C-%c", to_lower (UNCTRL (key)));
+ else if (key == RUBOUT)
+ sprintf (keyname, "\\C-?");
+ else if (key == '\\' || key == '"')
+ {
+ keyname[0] = '\\';
+ keyname[1] = (char) key;
+ keyname[2] = '\0';
+ }
+ else
+ {
+ keyname[0] = (char) key;
+ keyname[1] = '\0';
+ }
+
+ if (result_index + 2 > result_size)
+ result = (char **) xrealloc
+ (result, (result_size += 10) * sizeof (char *));
+
+ result[result_index++] = keyname;
+ result[result_index] = (char *)NULL;
+ }
+ break;
+
+ case ISKMAP:
+ {
+ char **seqs = (char **)NULL;
+
+ /* Find the list of keyseqs in this map which have FUNCTION as
+ their target. Add the key sequences found to RESULT. */
+ if (map[key].function)
+ seqs =
+ invoking_keyseqs_in_map (function, (Keymap)map[key].function);
+
+ if (seqs)
+ {
+ register int i;
+
+ for (i = 0; seqs[i]; i++)
+ {
+ char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
+
+ if (key == ESC)
+ sprintf (keyname, "\\e");
+ else if (CTRL_P (key))
+ sprintf (keyname, "\\C-%c", to_lower (UNCTRL (key)));
+ else if (key == RUBOUT)
+ sprintf (keyname, "\\C-?");
+ else if (key == '\\' || key == '"')
+ {
+ keyname[0] = '\\';
+ keyname[1] = (char) key;
+ keyname[2] = '\0';
+ }
+ else
+ {
+ keyname[0] = (char) key;
+ keyname[1] = '\0';
+ }
+
+ strcat (keyname, seqs[i]);
+
+ if (result_index + 2 > result_size)
+ result = (char **) xrealloc
+ (result, (result_size += 10) * sizeof (char *));
+
+ result[result_index++] = keyname;
+ result[result_index] = (char *)NULL;
+ }
+ }
+ }
+ break;
+ }
+ }
+ return (result);
+}
+
+/* Return a NULL terminated array of strings which represent the key
+ sequences that can be used to invoke FUNCTION using the current keymap. */
+char **
+rl_invoking_keyseqs (function)
+ Function *function;
+{
+ return (invoking_keyseqs_in_map (function, _rl_keymap));
+}
+
+/* Print all of the current functions and their bindings to
+ rl_outstream. If an explicit argument is given, then print
+ the output in such a way that it can be read back in. */
+int
+rl_dump_functions (count)
+ int count;
+{
+ void rl_function_dumper ();
+
+ rl_function_dumper (rl_explicit_arg);
+ rl_on_new_line ();
+ return (0);
+}
+
+/* Print all of the functions and their bindings to rl_outstream. If
+ PRINT_READABLY is non-zero, then print the output in such a way
+ that it can be read back in. */
+void
+rl_function_dumper (print_readably)
+ int print_readably;
+{
+ register int i;
+ char **names;
+ char *name;
+
+ names = rl_funmap_names ();
+
+ fprintf (rl_outstream, "\n");
+
+ for (i = 0; name = names[i]; i++)
+ {
+ Function *function;
+ char **invokers;
+
+ function = rl_named_function (name);
+ invokers = invoking_keyseqs_in_map (function, _rl_keymap);
+
+ if (print_readably)
+ {
+ if (!invokers)
+ fprintf (rl_outstream, "# %s (not bound)\n", name);
+ else
+ {
+ register int j;
+
+ for (j = 0; invokers[j]; j++)
+ {
+ fprintf (rl_outstream, "\"%s\": %s\n",
+ invokers[j], name);
+ free (invokers[j]);
+ }
+
+ free (invokers);
+ }
+ }
+ else
+ {
+ if (!invokers)
+ fprintf (rl_outstream, "%s is not bound to any keys\n",
+ name);
+ else
+ {
+ register int j;
+
+ fprintf (rl_outstream, "%s can be found on ", name);
+
+ for (j = 0; invokers[j] && j < 5; j++)
+ {
+ fprintf (rl_outstream, "\"%s\"%s", invokers[j],
+ invokers[j + 1] ? ", " : ".\n");
+ }
+
+ if (j == 5 && invokers[j])
+ fprintf (rl_outstream, "...\n");
+
+ for (j = 0; invokers[j]; j++)
+ free (invokers[j]);
+
+ free (invokers);
+ }
+ }
+ }
+}
+
+
+/* **************************************************************** */
+/* */
+/* String Utility Functions */
+/* */
+/* **************************************************************** */
+
+static char *strindex ();
+
+/* Return non-zero if any members of ARRAY are a substring in STRING. */
+static int
+substring_member_of_array (string, array)
+ char *string, **array;
+{
+ while (*array)
+ {
+ if (strindex (string, *array))
+ return (1);
+ array++;
+ }
+ return (0);
+}
+
+/* Whoops, Unix doesn't have strnicmp. */
+
+/* Compare at most COUNT characters from string1 to string2. Case
+ doesn't matter. */
+static int
+strnicmp (string1, string2, count)
+ char *string1, *string2;
+{
+ register char ch1, ch2;
+
+ while (count)
+ {
+ ch1 = *string1++;
+ ch2 = *string2++;
+ if (to_upper(ch1) == to_upper(ch2))
+ count--;
+ else break;
+ }
+ return (count);
+}
+
+/* strcmp (), but caseless. */
+static int
+stricmp (string1, string2)
+ char *string1, *string2;
+{
+ register char ch1, ch2;
+
+ while (*string1 && *string2)
+ {
+ ch1 = *string1++;
+ ch2 = *string2++;
+ if (to_upper(ch1) != to_upper(ch2))
+ return (1);
+ }
+ return (*string1 | *string2);
+}
+
+/* Determine if s2 occurs in s1. If so, return a pointer to the
+ match in s1. The compare is case insensitive. */
+static char *
+strindex (s1, s2)
+ register char *s1, *s2;
+{
+ register int i, l = strlen (s2);
+ register int len = strlen (s1);
+
+ for (i = 0; (len - i) >= l; i++)
+ if (strnicmp (&s1[i], s2, l) == 0)
+ return (s1 + i);
+ return ((char *)NULL);
+}
diff --git a/readline/complete.c b/readline/complete.c
new file mode 100644
index 0000000..7b733a3
--- /dev/null
+++ b/readline/complete.c
@@ -0,0 +1,1205 @@
+/* complete.c -- filename completion for readline. */
+
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "sysdep.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#if !defined (NO_SYS_FILE)
+# include <sys/file.h>
+#endif /* !NO_SYS_FILE */
+
+#include <errno.h>
+/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
+#if !defined (errno)
+extern int errno;
+#endif /* !errno */
+
+/* These next are for filename completion. Perhaps this belongs
+ in a different place. */
+#ifndef __MSDOS__
+#include <pwd.h>
+#endif /* __MSDOS__ */
+#if defined (USG) && !defined (isc386) && !defined (sgi)
+extern struct passwd *getpwuid (), *getpwent ();
+#endif
+#if defined (isc386) && !defined (__STDC__) && defined (_POSIX_SOURCE)
+extern struct passwd *getpwent ();
+#endif
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+
+/* Some standard library routines. */
+#include "readline.h"
+
+#if !defined (strchr)
+extern char *strchr ();
+#endif /* !strchr */
+#if !defined (strrchr)
+extern char *strrchr ();
+#endif /* !strrchr*/
+
+extern char *tilde_expand ();
+extern char *rl_copy_text ();
+
+extern Function *rl_last_func;
+extern int rl_editing_mode;
+extern int screenwidth;
+
+static int compare_strings ();
+static char *rl_strpbrk ();
+
+#if defined (STATIC_MALLOC)
+static char *xmalloc (), *xrealloc ();
+#else
+extern char *xmalloc (), *xrealloc ();
+#endif /* STATIC_MALLOC */
+
+/* If non-zero, then this is the address of a function to call when
+ completing on a directory name. The function is called with
+ the address of a string (the current directory name) as an arg. */
+Function *rl_symbolic_link_hook = (Function *)NULL;
+
+/* Non-zero means readline completion functions perform tilde expansion. */
+int rl_complete_with_tilde_expansion = 0;
+
+#define VISIBLE_STATS
+
+#if defined (VISIBLE_STATS)
+static int stat_char ();
+
+/* Non-zero means add an additional character to each filename displayed
+ during listing completion iff rl_filename_completion_desired which helps
+ to indicate the type of file being listed. */
+int rl_visible_stats = 0;
+#endif /* VISIBLE_STATS */
+
+/* **************************************************************** */
+/* */
+/* Completion matching, from readline's point of view. */
+/* */
+/* **************************************************************** */
+
+/* Pointer to the generator function for completion_matches ().
+ NULL means to use filename_entry_function (), the default filename
+ completer. */
+Function *rl_completion_entry_function = (Function *)NULL;
+
+/* Pointer to alternative function to create matches.
+ Function is called with TEXT, START, and END.
+ START and END are indices in RL_LINE_BUFFER saying what the boundaries
+ of TEXT are.
+ If this function exists and returns NULL then call the value of
+ rl_completion_entry_function to try to match, otherwise use the
+ array of strings returned. */
+Function *rl_attempted_completion_function = (Function *)NULL;
+
+/* Local variable states what happened during the last completion attempt. */
+static int completion_changed_buffer = 0;
+
+/* Complete the word at or before point. You have supplied the function
+ that does the initial simple matching selection algorithm (see
+ completion_matches ()). The default is to do filename completion. */
+
+rl_complete (ignore, invoking_key)
+ int ignore, invoking_key;
+{
+ if (rl_last_func == rl_complete && !completion_changed_buffer)
+ rl_complete_internal ('?');
+ else
+ rl_complete_internal (TAB);
+}
+
+/* List the possible completions. See description of rl_complete (). */
+rl_possible_completions (ignore, invoking_key)
+{
+ rl_complete_internal ('?');
+}
+
+rl_insert_completions (ignore, invoking_key)
+ int ignore, invoking_key;
+{
+ rl_complete_internal ('*');
+}
+
+/* The user must press "y" or "n". Non-zero return means "y" pressed. */
+get_y_or_n ()
+{
+ int c;
+
+ for (;;)
+ {
+ c = rl_read_key ();
+ if (c == 'y' || c == 'Y')
+ return (1);
+ if (c == 'n' || c == 'N')
+ return (0);
+ if (c == ABORT_CHAR)
+ rl_abort ();
+ ding ();
+ }
+}
+
+/* Up to this many items will be displayed in response to a
+ possible-completions call. After that, we ask the user if
+ she is sure she wants to see them all. */
+int rl_completion_query_items = 100;
+
+/* The basic list of characters that signal a break between words for the
+ completer routine. The contents of this variable is what breaks words
+ in the shell, i.e. " \t\n\"\\'`@$><=" */
+char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(";
+
+/* The list of characters that signal a break between words for
+ rl_complete_internal. The default list is the contents of
+ rl_basic_word_break_characters. */
+char *rl_completer_word_break_characters = (char *)NULL;
+
+/* List of characters which can be used to quote a substring of the line.
+ Completion occurs on the entire substring, and within the substring
+ rl_completer_word_break_characters are treated as any other character,
+ unless they also appear within this list. */
+char *rl_completer_quote_characters = (char *)NULL;
+
+/* List of characters that are word break characters, but should be left
+ in TEXT when it is passed to the completion function. The shell uses
+ this to help determine what kind of completing to do. */
+char *rl_special_prefixes = (char *)NULL;
+
+/* If non-zero, then disallow duplicates in the matches. */
+int rl_ignore_completion_duplicates = 1;
+
+/* Non-zero means that the results of the matches are to be treated
+ as filenames. This is ALWAYS zero on entry, and can only be changed
+ within a completion entry finder function. */
+int rl_filename_completion_desired = 0;
+
+/* This function, if defined, is called by the completer when real
+ filename completion is done, after all the matching names have been
+ generated. It is passed a (char**) known as matches in the code below.
+ It consists of a NULL-terminated array of pointers to potential
+ matching strings. The 1st element (matches[0]) is the maximal
+ substring that is common to all matches. This function can re-arrange
+ the list of matches as required, but all elements of the array must be
+ free()'d if they are deleted. The main intent of this function is
+ to implement FIGNORE a la SunOS csh. */
+Function *rl_ignore_some_completions_function = (Function *)NULL;
+
+/* Complete the word at or before point.
+ WHAT_TO_DO says what to do with the completion.
+ `?' means list the possible completions.
+ TAB means do standard completion.
+ `*' means insert all of the possible completions. */
+rl_complete_internal (what_to_do)
+ int what_to_do;
+{
+ char *filename_completion_function ();
+ char **completion_matches (), **matches;
+ Function *our_func;
+ int start, scan, end, delimiter = 0;
+ char *text, *saved_line_buffer;
+ char quote_char = '\0';
+ char *replacement;
+
+ if (rl_line_buffer)
+ saved_line_buffer = savestring (rl_line_buffer);
+ else
+ saved_line_buffer = (char *)NULL;
+
+ if (rl_completion_entry_function)
+ our_func = rl_completion_entry_function;
+ else
+ our_func = (int (*)())filename_completion_function;
+
+ /* Only the completion entry function can change this. */
+ rl_filename_completion_desired = 0;
+
+ /* We now look backwards for the start of a filename/variable word. */
+ end = rl_point;
+
+ if (rl_point)
+ {
+ if (rl_completer_quote_characters)
+ {
+ /* We have a list of characters which can be used in pairs to
+ quote substrings for the completer. Try to find the start
+ of an unclosed quoted substring.
+ [FIXME: Doesn't yet handle '\' escapes to quote quotes. */
+ for (scan = 0; scan < end; scan++)
+ {
+ if (quote_char != '\0')
+ {
+ /* Ignore everything until the matching close quote char. */
+ if (rl_line_buffer[scan] == quote_char)
+ {
+ /* Found matching close quote. Abandon this substring. */
+ quote_char = '\0';
+ rl_point = end;
+ }
+ }
+ else if (strchr (rl_completer_quote_characters, rl_line_buffer[scan]))
+ {
+ /* Found start of a quoted substring. */
+ quote_char = rl_line_buffer[scan];
+ rl_point = scan + 1;
+ }
+ }
+ }
+ if (rl_point == end)
+ {
+ /* We didn't find an unclosed quoted substring upon which to do
+ completion, so use the word break characters to find the
+ substring on which to do completion. */
+ while (--rl_point &&
+ !strchr (rl_completer_word_break_characters,
+ rl_line_buffer[rl_point])) {;}
+ }
+
+ /* If we are at a word break, then advance past it. */
+ if (strchr (rl_completer_word_break_characters, rl_line_buffer[rl_point]))
+ {
+ /* If the character that caused the word break was a quoting
+ character, then remember it as the delimiter. */
+ if (strchr ("\"'", rl_line_buffer[rl_point]) && (end - rl_point) > 1)
+ delimiter = rl_line_buffer[rl_point];
+
+ /* If the character isn't needed to determine something special
+ about what kind of completion to perform, then advance past it. */
+
+ if (!rl_special_prefixes ||
+ !strchr (rl_special_prefixes, rl_line_buffer[rl_point]))
+ rl_point++;
+ }
+ }
+
+ start = rl_point;
+ rl_point = end;
+ text = rl_copy_text (start, end);
+
+ /* If the user wants to TRY to complete, but then wants to give
+ up and use the default completion function, they set the
+ variable rl_attempted_completion_function. */
+ if (rl_attempted_completion_function)
+ {
+ matches =
+ (char **)(*rl_attempted_completion_function) (text, start, end);
+
+ if (matches)
+ {
+ if (matches == (char **)-1)
+ matches = (char **)NULL;
+ our_func = (Function *)NULL;
+ goto after_usual_completion;
+ }
+ }
+
+ matches = completion_matches (text, our_func);
+
+ after_usual_completion:
+ free (text);
+
+ if (!matches)
+ ding ();
+ else
+ {
+ register int i;
+
+ some_matches:
+
+ /* It seems to me that in all the cases we handle we would like
+ to ignore duplicate possibilities. Scan for the text to
+ insert being identical to the other completions. */
+ if (rl_ignore_completion_duplicates)
+ {
+ char *lowest_common;
+ int j, newlen = 0;
+
+ /* Sort the items. */
+ /* It is safe to sort this array, because the lowest common
+ denominator found in matches[0] will remain in place. */
+ for (i = 0; matches[i]; i++);
+ qsort (matches, i, sizeof (char *), compare_strings);
+
+ /* Remember the lowest common denominator for it may be unique. */
+ lowest_common = savestring (matches[0]);
+
+ for (i = 0; matches[i + 1]; i++)
+ {
+ if (strcmp (matches[i], matches[i + 1]) == 0)
+ {
+ free (matches[i]);
+ matches[i] = (char *)-1;
+ }
+ else
+ newlen++;
+ }
+
+ /* We have marked all the dead slots with (char *)-1.
+ Copy all the non-dead entries into a new array. */
+ {
+ char **temp_array =
+ (char **)xmalloc ((3 + newlen) * sizeof (char *));
+
+ for (i = 1, j = 1; matches[i]; i++)
+ {
+ if (matches[i] != (char *)-1)
+ temp_array[j++] = matches[i];
+ }
+
+ temp_array[j] = (char *)NULL;
+
+ if (matches[0] != (char *)-1)
+ free (matches[0]);
+
+ free (matches);
+
+ matches = temp_array;
+ }
+
+ /* Place the lowest common denominator back in [0]. */
+ matches[0] = lowest_common;
+
+ /* If there is one string left, and it is identical to the
+ lowest common denominator, then the LCD is the string to
+ insert. */
+ if (j == 2 && strcmp (matches[0], matches[1]) == 0)
+ {
+ free (matches[1]);
+ matches[1] = (char *)NULL;
+ }
+ }
+
+ switch (what_to_do)
+ {
+ case TAB:
+ /* If we are matching filenames, then here is our chance to
+ do clever processing by re-examining the list. Call the
+ ignore function with the array as a parameter. It can
+ munge the array, deleting matches as it desires. */
+ if (rl_ignore_some_completions_function &&
+ our_func == (int (*)())filename_completion_function)
+ (void)(*rl_ignore_some_completions_function)(matches);
+
+ /* If we are doing completion on quoted substrings, and any matches
+ contain any of the completer_word_break_characters, then auto-
+ matically prepend the substring with a quote character (just pick
+ the first one from the list of such) if it does not already begin
+ with a quote string. FIXME: Need to remove any such automatically
+ inserted quote character when it no longer is necessary, such as
+ if we change the string we are completing on and the new set of
+ matches don't require a quoted substring. */
+ replacement = matches[0];
+
+ if (matches[0] && rl_completer_quote_characters && !quote_char &&
+ rl_filename_completion_desired)
+ {
+ int do_replace;
+
+ do_replace = 0;
+
+ /* If there is only a single match, see if we need to
+ quote it. */
+ if (!matches[1] &&
+ rl_strpbrk (matches[0], rl_completer_word_break_characters))
+ do_replace = 1;
+
+ /* If there are multiple matches, check to see if any of them
+ require that the substring be quoted. */
+ for (i = 1; matches[i] != NULL; i++)
+ if (rl_strpbrk (matches[i], rl_completer_word_break_characters))
+ {
+ do_replace = 1;
+ break;
+ }
+ if (do_replace)
+ {
+#if defined (SHELL)
+ /* XXX - experimental */
+ /* Single-quote the replacement, since we found an
+ embedded word break character in a potential match. */
+ char *rtext;
+ extern char *single_quote (); /* in builtins/common.c */
+
+ rtext = single_quote (matches[0]);
+ replacement = (char *)alloca (strlen (rtext) + 1);
+ strcpy (replacement, rtext);
+ free (rtext);
+#else /* !SHELL */
+ /* Found an embedded word break character in a potential
+ match, so we need to prepend a quote character if we
+ are replacing the completion string. */
+ replacement = (char *)alloca (strlen (matches[0]) + 2);
+ quote_char = *rl_completer_quote_characters;
+ *replacement = quote_char;
+ strcpy (replacement + 1, matches[0]);
+#endif /* SHELL */
+ }
+ }
+ if (replacement)
+ {
+ rl_delete_text (start, rl_point);
+ rl_point = start;
+ rl_insert_text (replacement);
+ }
+
+ /* If there are more matches, ring the bell to indicate.
+ If this was the only match, and we are hacking files,
+ check the file to see if it was a directory. If so,
+ add a '/' to the name. If not, and we are at the end
+ of the line, then add a space. */
+ if (matches[1])
+ {
+ if (rl_editing_mode != vi_mode)
+ ding (); /* There are other matches remaining. */
+ }
+ else
+ {
+ char temp_string[4];
+ int temp_string_index = 0;
+
+ if (quote_char)
+ temp_string[temp_string_index++] = quote_char;
+
+ temp_string[temp_string_index++] = delimiter ? delimiter : ' ';
+ temp_string[temp_string_index++] = '\0';
+
+ if (rl_filename_completion_desired)
+ {
+ struct stat finfo;
+ char *filename = tilde_expand (matches[0]);
+
+ if ((stat (filename, &finfo) == 0) &&
+ S_ISDIR (finfo.st_mode))
+ {
+ if (rl_line_buffer[rl_point] != '/')
+ rl_insert_text ("/");
+ }
+ else
+ {
+ if (rl_point == rl_end)
+ rl_insert_text (temp_string);
+ }
+ free (filename);
+ }
+ else
+ {
+ if (rl_point == rl_end)
+ rl_insert_text (temp_string);
+ }
+ }
+ break;
+
+ case '*':
+ {
+ int i = 1;
+
+ rl_delete_text (start, rl_point);
+ rl_point = start;
+ rl_begin_undo_group ();
+ if (matches[1])
+ {
+ while (matches[i])
+ {
+ rl_insert_text (matches[i++]);
+ rl_insert_text (" ");
+ }
+ }
+ else
+ {
+ rl_insert_text (matches[0]);
+ rl_insert_text (" ");
+ }
+ rl_end_undo_group ();
+ }
+ break;
+
+ case '?':
+ {
+ int len, count, limit, max = 0;
+ int j, k, l;
+
+ /* Handle simple case first. What if there is only one answer? */
+ if (!matches[1])
+ {
+ char *temp;
+
+ if (rl_filename_completion_desired)
+ temp = strrchr (matches[0], '/');
+ else
+ temp = (char *)NULL;
+
+ if (!temp)
+ temp = matches[0];
+ else
+ temp++;
+
+ crlf ();
+ fprintf (rl_outstream, "%s", temp);
+#if defined (VISIBLE_STATS)
+ if (rl_filename_completion_desired && rl_visible_stats)
+ {
+ int extension_char;
+
+ extension_char = stat_char (matches[0]);
+ if (extension_char)
+ putc (extension_char, rl_outstream);
+ }
+#endif /* VISIBLE_STATS */
+ crlf ();
+ goto restart;
+ }
+
+ /* There is more than one answer. Find out how many there are,
+ and find out what the maximum printed length of a single entry
+ is. */
+ for (i = 1; matches[i]; i++)
+ {
+ char *temp;
+ int name_length;
+
+ /* If we are hacking filenames, then only count the characters
+ after the last slash in the pathname. */
+ if (rl_filename_completion_desired)
+ temp = strrchr (matches[i], '/');
+ else
+ temp = (char *)NULL;
+
+ if (!temp)
+ temp = matches[i];
+ else
+ temp++;
+
+ name_length = strlen (temp);
+
+ if (name_length > max)
+ max = name_length;
+ }
+
+ len = i - 1;
+
+ /* If there are many items, then ask the user if she
+ really wants to see them all. */
+ if (len >= rl_completion_query_items)
+ {
+ crlf ();
+ fprintf (rl_outstream,
+ "There are %d possibilities. Do you really", len);
+ crlf ();
+ fprintf (rl_outstream, "wish to see them all? (y or n)");
+ fflush (rl_outstream);
+ if (!get_y_or_n ())
+ {
+ crlf ();
+ goto restart;
+ }
+ }
+ /* How many items of MAX length can we fit in the screen window? */
+ max += 2;
+ limit = screenwidth / max;
+ if (limit != 1 && (limit * max == screenwidth))
+ limit--;
+
+ /* Avoid a possible floating exception. If max > screenwidth,
+ limit will be 0 and a divide-by-zero fault will result. */
+ if (limit == 0)
+ limit = 1;
+
+ /* How many iterations of the printing loop? */
+ count = (len + (limit - 1)) / limit;
+
+ /* Watch out for special case. If LEN is less than LIMIT, then
+ just do the inner printing loop. */
+ if (len < limit)
+ count = 1;
+
+ /* Sort the items if they are not already sorted. */
+ if (!rl_ignore_completion_duplicates)
+ qsort (matches, len, sizeof (char *), compare_strings);
+
+ /* Print the sorted items, up-and-down alphabetically, like
+ ls might. */
+ crlf ();
+
+ for (i = 1; i < count + 1; i++)
+ {
+ for (j = 0, l = i; j < limit; j++)
+ {
+ if (l > len || !matches[l])
+ {
+ break;
+ }
+ else
+ {
+ char *temp = (char *)NULL;
+ int printed_length;
+
+ if (rl_filename_completion_desired)
+ temp = strrchr (matches[l], '/');
+
+ if (!temp)
+ temp = matches[l];
+ else
+ temp++;
+
+ printed_length = strlen (temp);
+ fprintf (rl_outstream, "%s", temp);
+
+#if defined (VISIBLE_STATS)
+ if (rl_filename_completion_desired &&
+ rl_visible_stats)
+ {
+ int extension_char;
+
+ extension_char = stat_char (matches[l]);
+
+ if (extension_char)
+ {
+ putc (extension_char, rl_outstream);
+ printed_length++;
+ }
+ }
+#endif /* VISIBLE_STATS */
+
+ if (j + 1 < limit)
+ {
+ for (k = 0; k < max - printed_length; k++)
+ putc (' ', rl_outstream);
+ }
+ }
+ l += count;
+ }
+ crlf ();
+ }
+ restart:
+
+ rl_on_new_line ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ for (i = 0; matches[i]; i++)
+ free (matches[i]);
+ free (matches);
+ }
+
+ /* Check to see if the line has changed through all of this manipulation. */
+ if (saved_line_buffer)
+ {
+ if (strcmp (rl_line_buffer, saved_line_buffer) != 0)
+ completion_changed_buffer = 1;
+ else
+ completion_changed_buffer = 0;
+
+ free (saved_line_buffer);
+ }
+}
+
+#if defined (VISIBLE_STATS)
+/* Return the character which best describes FILENAME.
+ `@' for symbolic links
+ `/' for directories
+ `*' for executables
+ `=' for sockets */
+static int
+stat_char (filename)
+ char *filename;
+{
+ struct stat finfo;
+ int character = 0;
+
+ if (stat (filename, &finfo) == -1)
+ return (character);
+
+ if (S_ISDIR (finfo.st_mode))
+ character = '/';
+#if defined (S_ISLNK)
+ else if (S_ISLNK (finfo.st_mode))
+ character = '@';
+#endif /* S_ISLNK */
+#if defined (S_ISSOCK)
+ else if (S_ISSOCK (finfo.st_mode))
+ character = '=';
+#endif /* S_ISSOCK */
+ else if (S_ISREG (finfo.st_mode))
+ {
+ if (access (filename, X_OK) == 0)
+ character = '*';
+ }
+ return (character);
+}
+#endif /* VISIBLE_STATS */
+
+/* Stupid comparison routine for qsort () ing strings. */
+static int
+compare_strings (s1, s2)
+ char **s1, **s2;
+{
+ return (strcmp (*s1, *s2));
+}
+
+/* A completion function for usernames.
+ TEXT contains a partial username preceded by a random
+ character (usually `~'). */
+char *
+username_completion_function (text, state)
+ int state;
+ char *text;
+{
+#ifdef __GO32__
+ return (char *)NULL;
+#else /* !__GO32__ */
+ static char *username = (char *)NULL;
+ static struct passwd *entry;
+ static int namelen, first_char, first_char_loc;
+
+ if (!state)
+ {
+ if (username)
+ free (username);
+
+ first_char = *text;
+
+ if (first_char == '~')
+ first_char_loc = 1;
+ else
+ first_char_loc = 0;
+
+ username = savestring (&text[first_char_loc]);
+ namelen = strlen (username);
+ setpwent ();
+ }
+
+ while (entry = getpwent ())
+ {
+ if (strncmp (username, entry->pw_name, namelen) == 0)
+ break;
+ }
+
+ if (!entry)
+ {
+ endpwent ();
+ return ((char *)NULL);
+ }
+ else
+ {
+ char *value = (char *)xmalloc (2 + strlen (entry->pw_name));
+
+ *value = *text;
+
+ strcpy (value + first_char_loc, entry->pw_name);
+
+ if (first_char == '~')
+ rl_filename_completion_desired = 1;
+
+ return (value);
+ }
+#endif /* !__GO32__ */
+}
+
+
+/* **************************************************************** */
+/* */
+/* Completion */
+/* */
+/* **************************************************************** */
+
+/* Non-zero means that case is not significant in completion. */
+int completion_case_fold = 0;
+
+/* Return an array of (char *) which is a list of completions for TEXT.
+ If there are no completions, return a NULL pointer.
+ The first entry in the returned array is the substitution for TEXT.
+ The remaining entries are the possible completions.
+ The array is terminated with a NULL pointer.
+
+ ENTRY_FUNCTION is a function of two args, and returns a (char *).
+ The first argument is TEXT.
+ The second is a state argument; it should be zero on the first call, and
+ non-zero on subsequent calls. It returns a NULL pointer to the caller
+ when there are no more matches.
+ */
+char **
+completion_matches (text, entry_function)
+ char *text;
+ char *(*entry_function) ();
+{
+ /* Number of slots in match_list. */
+ int match_list_size;
+
+ /* The list of matches. */
+ char **match_list =
+ (char **)xmalloc (((match_list_size = 10) + 1) * sizeof (char *));
+
+ /* Number of matches actually found. */
+ int matches = 0;
+
+ /* Temporary string binder. */
+ char *string;
+
+ match_list[1] = (char *)NULL;
+
+ while (string = (*entry_function) (text, matches))
+ {
+ if (matches + 1 == match_list_size)
+ match_list = (char **)xrealloc
+ (match_list, ((match_list_size += 10) + 1) * sizeof (char *));
+
+ match_list[++matches] = string;
+ match_list[matches + 1] = (char *)NULL;
+ }
+
+ /* If there were any matches, then look through them finding out the
+ lowest common denominator. That then becomes match_list[0]. */
+ if (matches)
+ {
+ register int i = 1;
+ int low = 100000; /* Count of max-matched characters. */
+
+ /* If only one match, just use that. */
+ if (matches == 1)
+ {
+ match_list[0] = match_list[1];
+ match_list[1] = (char *)NULL;
+ }
+ else
+ {
+ /* Otherwise, compare each member of the list with
+ the next, finding out where they stop matching. */
+
+ while (i < matches)
+ {
+ register int c1, c2, si;
+
+ if (completion_case_fold)
+ {
+ for (si = 0;
+ (c1 = to_lower(match_list[i][si])) &&
+ (c2 = to_lower(match_list[i + 1][si]));
+ si++)
+ if (c1 != c2) break;
+ }
+ else
+ {
+ for (si = 0;
+ (c1 = match_list[i][si]) &&
+ (c2 = match_list[i + 1][si]);
+ si++)
+ if (c1 != c2) break;
+ }
+
+ if (low > si) low = si;
+ i++;
+ }
+ match_list[0] = (char *)xmalloc (low + 1);
+ strncpy (match_list[0], match_list[1], low);
+ match_list[0][low] = '\0';
+ }
+ }
+ else /* There were no matches. */
+ {
+ free (match_list);
+ match_list = (char **)NULL;
+ }
+ return (match_list);
+}
+
+/* Okay, now we write the entry_function for filename completion. In the
+ general case. Note that completion in the shell is a little different
+ because of all the pathnames that must be followed when looking up the
+ completion for a command. */
+char *
+filename_completion_function (text, state)
+ int state;
+ char *text;
+{
+ static DIR *directory;
+ static char *filename = (char *)NULL;
+ static char *dirname = (char *)NULL;
+ static char *users_dirname = (char *)NULL;
+ static int filename_len;
+
+ dirent *entry = (dirent *)NULL;
+
+ /* If we don't have any state, then do some initialization. */
+ if (!state)
+ {
+ char *temp;
+
+ if (dirname) free (dirname);
+ if (filename) free (filename);
+ if (users_dirname) free (users_dirname);
+
+ filename = savestring (text);
+ if (!*text) text = ".";
+ dirname = savestring (text);
+
+ temp = strrchr (dirname, '/');
+
+ if (temp)
+ {
+ strcpy (filename, ++temp);
+ *temp = '\0';
+ }
+ else
+ strcpy (dirname, ".");
+
+ /* We aren't done yet. We also support the "~user" syntax. */
+
+ /* Save the version of the directory that the user typed. */
+ users_dirname = savestring (dirname);
+ {
+ char *temp_dirname;
+
+ temp_dirname = tilde_expand (dirname);
+ free (dirname);
+ dirname = temp_dirname;
+
+ if (rl_symbolic_link_hook)
+ (*rl_symbolic_link_hook) (&dirname);
+ }
+ directory = opendir (dirname);
+ filename_len = strlen (filename);
+
+ rl_filename_completion_desired = 1;
+ }
+
+ /* At this point we should entertain the possibility of hacking wildcarded
+ filenames, like /usr/man/man<WILD>/te<TAB>. If the directory name
+ contains globbing characters, then build an array of directories, and
+ then map over that list while completing. */
+ /* *** UNIMPLEMENTED *** */
+
+ /* Now that we have some state, we can read the directory. */
+
+ while (directory && (entry = readdir (directory)))
+ {
+ /* Special case for no filename.
+ All entries except "." and ".." match. */
+ if (!filename_len)
+ {
+ if ((strcmp (entry->d_name, ".") != 0) &&
+ (strcmp (entry->d_name, "..") != 0))
+ break;
+ }
+ else
+ {
+ /* Otherwise, if these match upto the length of filename, then
+ it is a match. */
+ if (((int)D_NAMLEN (entry)) >= filename_len &&
+ (entry->d_name[0] == filename[0]) &&
+ (strncmp (filename, entry->d_name, filename_len) == 0))
+ {
+ break;
+ }
+ }
+ }
+
+ if (!entry)
+ {
+ if (directory)
+ {
+ closedir (directory);
+ directory = (DIR *)NULL;
+ }
+
+ if (dirname)
+ {
+ free (dirname);
+ dirname = (char *)NULL;
+ }
+ if (filename)
+ {
+ free (filename);
+ filename = (char *)NULL;
+ }
+ if (users_dirname)
+ {
+ free (users_dirname);
+ users_dirname = (char *)NULL;
+ }
+
+ return (char *)NULL;
+ }
+ else
+ {
+ char *temp;
+
+ if (dirname && (strcmp (dirname, ".") != 0))
+ {
+ if (rl_complete_with_tilde_expansion && *users_dirname == '~')
+ {
+ int dirlen = strlen (dirname);
+ temp = (char *)xmalloc (2 + dirlen + D_NAMLEN (entry));
+ strcpy (temp, dirname);
+ /* Canonicalization cuts off any final slash present. We need
+ to add it back. */
+ if (dirname[dirlen - 1] != '/')
+ {
+ temp[dirlen] = '/';
+ temp[dirlen + 1] = '\0';
+ }
+ }
+ else
+ {
+ temp = (char *)
+ xmalloc (1 + strlen (users_dirname) + D_NAMLEN (entry));
+ strcpy (temp, users_dirname);
+ }
+
+ strcat (temp, entry->d_name);
+ }
+ else
+ {
+ temp = (savestring (entry->d_name));
+ }
+ return (temp);
+ }
+}
+
+/* A function for simple tilde expansion. */
+int
+rl_tilde_expand (ignore, key)
+ int ignore, key;
+{
+ register int start, end;
+ char *homedir;
+
+ end = rl_point;
+ start = end - 1;
+
+ if (rl_point == rl_end && rl_line_buffer[rl_point] == '~')
+ {
+ homedir = tilde_expand ("~");
+ goto insert;
+ }
+ else if (rl_line_buffer[start] != '~')
+ {
+ for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--);
+ start++;
+ }
+
+ end = start;
+ do
+ {
+ end++;
+ }
+ while (!whitespace (rl_line_buffer[end]) && end < rl_end);
+
+ if (whitespace (rl_line_buffer[end]) || end >= rl_end)
+ end--;
+
+ /* If the first character of the current word is a tilde, perform
+ tilde expansion and insert the result. If not a tilde, do
+ nothing. */
+ if (rl_line_buffer[start] == '~')
+ {
+ char *temp;
+ int len;
+
+ len = end - start + 1;
+ temp = (char *)alloca (len + 1);
+ strncpy (temp, rl_line_buffer + start, len);
+ temp[len] = '\0';
+ homedir = tilde_expand (temp);
+
+ insert:
+ rl_begin_undo_group ();
+ rl_delete_text (start, end + 1);
+ rl_point = start;
+ rl_insert_text (homedir);
+ rl_end_undo_group ();
+ }
+
+ return (0);
+}
+
+/* Find the first occurrence in STRING1 of any character from STRING2.
+ Return a pointer to the character in STRING1. */
+static char *
+rl_strpbrk (string1, string2)
+ char *string1, *string2;
+{
+ register char *scan;
+
+ for (; *string1; string1++)
+ {
+ for (scan = string2; *scan; scan++)
+ {
+ if (*string1 == *scan)
+ {
+ return (string1);
+ }
+ }
+ }
+ return ((char *)NULL);
+}
+
+#if defined (STATIC_MALLOC)
+
+/* **************************************************************** */
+/* */
+/* xmalloc and xrealloc () */
+/* */
+/* **************************************************************** */
+
+static void memory_error_and_abort ();
+
+static char *
+xmalloc (bytes)
+ int bytes;
+{
+ char *temp = (char *)malloc (bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+ return (temp);
+}
+
+static char *
+xrealloc (pointer, bytes)
+ char *pointer;
+ int bytes;
+{
+ char *temp;
+
+ if (!pointer)
+ temp = (char *)malloc (bytes);
+ else
+ temp = (char *)realloc (pointer, bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+
+ return (temp);
+}
+
+static void
+memory_error_and_abort ()
+{
+ fprintf (stderr, "readline: Out of virtual memory!\n");
+ abort ();
+}
+#endif /* STATIC_MALLOC */
diff --git a/readline/config.h.in b/readline/config.h.in
new file mode 100644
index 0000000..65927a8
--- /dev/null
+++ b/readline/config.h.in
@@ -0,0 +1,145 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on MINIX. */
+#undef _MINIX
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+#undef VOID_SIGHANDLER
+
+/* Define if you have the lstat function. */
+#undef HAVE_LSTAT
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the tcgetattr function. */
+#undef HAVE_TCGETATTR
+
+/* Define if you have the strcoll function. */
+#undef HAVE_STRCOLL
+
+#undef STRCOLL_BROKEN
+
+/* Define if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/dir.h> header file. */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/ndir.h> header file. */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/pte.h> header file. */
+#undef HAVE_SYS_PTE_H
+
+/* Define if you have the <sys/ptem.h> header file. */
+#undef HAVE_SYS_PTEM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/stream.h> header file. */
+#undef HAVE_SYS_STREAM_H
+
+/* Define if you have the <termcap.h> header file. */
+#undef HAVE_TERMCAP_H
+
+/* Define if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
+
+/* Define if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+#undef HAVE_LOCALE_H
+
+/* Definitions pulled in from aclocal.m4. */
+#undef VOID_SIGHANDLER
+
+#undef GWINSZ_IN_SYS_IOCTL
+
+#undef STRUCT_WINSIZE_IN_SYS_IOCTL
+
+#undef STRUCT_WINSIZE_IN_TERMIOS
+
+#undef TIOCSTAT_IN_SYS_IOCTL
+
+#undef FIONREAD_IN_SYS_IOCTL
+
+#undef SPEED_T_IN_SYS_TYPES
+
+#undef HAVE_GETPW_DECLS
+
+#undef STRUCT_DIRENT_HAS_D_INO
+
+#undef STRUCT_DIRENT_HAS_D_FILENO
+
+#undef HAVE_BSD_SIGNALS
+
+#undef HAVE_POSIX_SIGNALS
+
+#undef HAVE_USG_SIGHOLD
+
+#undef MUST_REINSTALL_SIGHANDLERS
+
+#undef HAVE_POSIX_SIGSETJMP
+
+/* config.h.bot */
+/* modify settings or make new ones based on what autoconf tells us. */
+
+/* Ultrix botches type-ahead when switching from canonical to
+ non-canonical mode, at least through version 4.3 */
+#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
+# define TERMIOS_MISSING
+#endif
+
+#if defined (STRCOLL_BROKEN)
+# undef HAVE_STRCOLL
+#endif
+
+#if defined (__STDC__) && defined (HAVE_STDARG_H)
+# define PREFER_STDARG
+# define USE_VARARGS
+#else
+# if defined (HAVE_VARARGS_H)
+# define PREFER_VARARGS
+# define USE_VARARGS
+# endif
+#endif
diff --git a/readline/config.sub b/readline/config.sub
deleted file mode 100755
index dac9ab8..0000000
--- a/readline/config.sub
+++ /dev/null
@@ -1,446 +0,0 @@
-#!/bin/sh
-
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration (e.g. a typo).
-
-# Please email any bugs, comments, and/or additions to this file to:
-# configure@cygnus.com
-
-# decode aliases into canonical names
-
-case "$1" in
-# cpu alone is a valid alias for cpu-none-none.
-vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
- | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
- | romp | rs6000 | i960 | h8300)
- cpu=$1
- vendor=none
- os=none
- ;;
-altos | altos3068)
- cpu=m68k
- vendor=altos
- os=sysv # maybe?
- ;;
-altosgas)
- cpu=m68k
- vendor=altos
- os=gas
- ;;
-am29k)
- cpu=a29k
- vendor=none
- os=bsd
- ;;
-amdahl)
- cpu=580
- vendor=amdahl
- os=uts
- ;;
-amigados)
- cpu=m68k
- vendor=cbm
- os=amigados # Native AmigaDOS
- ;;
-amigaunix | amix)
- cpu=m68k
- vendor=cbm
- os=svr4 # System V Release 4 (svr4 is an industry recognized acronym)
- ;;
-apollo68)
- cpu=m68k
- vendor=apollo
- os=sysv # maybe?
- ;;
-balance)
- cpu=ns32k
- vendor=sequent
- os=dynix
- ;;
-convex-c1)
- cpu=c1
- vendor=convex
- os=sysv # maybe?
- ;;
-convex-c2)
- cpu=c2
- vendor=convex
- os=sysv # maybe?
- ;;
-cray | ymp)
- cpu=ymp
- vendor=cray
- os=unicos
- ;;
-cray2)
- cpu=cray2
- vendor=cray
- os=unicos
- ;;
-dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin)
- cpu=mips
- vendor=dec
- os=ultrix
- ;;
-delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- cpu=m68k
- vendor=motorola
- os=sysv # maybe?
- ;;
-
-delta88)
- cpu=m88k
- vendor=motorola
- os=m88kbcs
- ;;
-
-gmicro)
- cpu=tron
- vendor=gmicro
- os=sysv # maybe?
- ;;
-
-h8300hds)
- cpu=h8300
- vendor=hitachi
- os=hds
- ;;
-
-# start-sanitize-v9
-hal-32 | hal32)
- cpu=sparc64
- vendor=hal
- os=hal32
- ;;
-hal-64 | hal64)
- cpu=sparc64
- vendor=hal
- os=hal64
- ;;
-sparc64)
- cpu=sparc64
- vendor=sun
- os=v9
- ;;
-sparc64-v7 | sparc64v7)
- cpu=sparc64
- vendor=sun
- os=v7
- ;;
-# end-sanitize-v9
-hp300bsd)
- cpu=m68k
- vendor=hp
- os=bsd
- ;;
-hp300hpux | hpux | hp9k3[2-9][0-9])
- cpu=m68k
- vendor=hp
- os=hpux
- ;;
-hp9k31[0-9] | hp9k2[0-9][0-9])
- cpu=m68000
- vendor=hp
- os=hpux
- ;;
-i386sco)
- cpu=i386
- vendor=sco
- os=sysv # maybe?
- ;;
-i386v)
- cpu=i386
- vendor=none
- os=sysv
- ;;
-i386v32)
- cpu=i386
- vendor=none
- os=sysv32
- ;;
-iris | iris4d)
- cpu=mips
- vendor=sgi
- os=irix # maybe?
- ;;
-
-dpx2)
- vendor=bull
- cpu=m68k
- os=sysv
- ;;
-isi | isi68)
- cpu=m68k
- vendor=isi
- os=sysv # maybe?
- ;;
-littlemips)
- cpu=mips
- vendor=little
- os=bsd
- ;;
-magnum | m3230)
- cpu=mips
- vendor=mips
- os=sysv # maybe?
- ;;
-merlin)
- cpu=ns32k
- vendor=utek
- os=sysv # maybe?
- ;;
-miniframe)
- cpu=m68000
- vendor=convergent
- os=sysv # maybe?
- ;;
-mmax)
- cpu=ns32k
- vendor=encore
- os=sysv # maybe?
- ;;
-news | news700 | news800 | news900)
- cpu=m68k
- vendor=sony
- os=newsos3 # Based on bsd-4.3
- ;;
-news1000)
- cpu=m68030
- vendor=sony
- os=newsos3 # ?
- ;;
-news-3600 | bigmips | risc-news)
- cpu=mips
- vendor=sony
- os=newsos4 # Presumably?
- ;;
-next)
- cpu=m68k
- vendor=next
- os=sysv # maybe?
- ;;
-nindy960)
- cpu=i960
- vendor=intel
- os=nindy
- ;;
-none)
- cpu=none
- vendor=none
- os=none
- ;;
-np1)
- cpu=np1
- vendor=gould
- os=sysv # maybe?
- ;;
-rtpc)
- cpu=romp
- vendor=ibm
- os=aix # maybe?
- ;;
-pbd)
- cpu=sparc
- vendor=unicom
- os=sysv
- ;;
-pn)
- cpu=pn
- vendor=gould
- os=sysv # maybe?
- ;;
-ps2)
- cpu=i386
- vendor=ibm
- os=sysv # maybe?
- ;;
-sun2)
- cpu=m68000
- vendor=sun
- os=sunos4
- ;;
-sun2os3)
- cpu=m68000
- vendor=sun
- os=sunos3
- ;;
-sun2os4)
- cpu=m68000
- vendor=sun
- os=sunos4
- ;;
-sun3)
- cpu=m68k
- vendor=sun
- os=sunos4
- ;;
-sun3os3)
- cpu=m68k
- vendor=sun
- os=sunos3
- ;;
-sun3os4)
- cpu=m68k
- vendor=sun
- os=sunos4
- ;;
-sun386 | roadrunner | sun386i)
- cpu=i386
- vendor=sun
- os=sunos
- ;;
-sun4)
- cpu=sparc
- vendor=sun
- os=sunos4
- ;;
-sun4os3)
- cpu=sparc
- vendor=sun
- os=sunos3
- ;;
-sun4os4)
- cpu=sparc
- vendor=sun
- os=sunos4
- ;;
-symmetry)
- cpu=i386
- vendor=sequent
- os=dynix
- ;;
-tower | tower-32)
- cpu=m68k
- vendor=ncr
- os=sysv # maybe?
- ;;
-ultra3)
- cpu=a29k
- vendor=nyu
- os=sym1
- ;;
-umax)
- cpu=ns32k
- vendor=encore
- os=sysv # maybe?
- ;;
-unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
- cpu=m68k
- vendor=att
- os=sysv # maybe?
- ;;
-vax-dec)
- cpu=vax
- vendor=dec
- os=ultrix # maybe?
- ;;
-vxworks68)
- cpu=m68k
- vendor=wrs
- os=vxworks
- ;;
-vxworks960)
- cpu=i960
- vendor=wrs
- os=vxworks
- ;;
-xmp)
- cpu=xmp
- vendor=cray
- os=unicos
- ;;
-# not an alias. parse what we expect to be a canonical name.
-*)
- cpu=`echo $1 | sed 's/-.*$//'`
-
- if [ "${cpu}" = "$1" ] ; then
- # no vendor so this is an invalid name.
- echo '***' No vendor: configuration \`$1\' not recognized 1>&2
- exit 1
- else
- # parse out vendor
- rest=`echo $1 | sed "s/${cpu}-//"`
- vendor=`echo ${rest} | sed 's/-.*$//'`
-
- if [ "${vendor}" = "${rest}" ] ; then
- # a missing os is acceptable
- os=none
- else
- os=`echo ${rest} | sed "s/${vendor}-//"`
- fi
- fi
- ;;
-esac
-
-# At this point we should have three parts of a canonical name in cpu,
-# vendor, and os.
-
-# verify that the cpu is known.
-
-case "${cpu}" in
-none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \
- | ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \
- | a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300)
- ;;
-
-# start-sanitize-v9
-sparc64) ;;
-# end-sanitize-v9
-
-*)
- echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# verify that the vendor is known.
-
-case "${vendor}" in
- altos | amdahl | aout | apollo | att | bcs | bout |\
- cbm | convergent | convex | coff | cray | dec | encore |\
- gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\
- ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\
- unicom | utek | wrs | bull ) ;;
-
-# start-sanitize-v9
-hal) ;;
-# end-sanitize-v9
-
-*)
- echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# verify that the os is known, if it exists.
-
-case "${os}" in
-aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \
- | hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \
- | osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \
- | vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \
- | amigados)
- ;;
-
-# start-sanitize-v9
-hal32 | hal64 | v7 | v9) ;;
-# end-sanitize-v9
-
-*)
- echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-echo ${cpu}-${vendor}-${os}
diff --git a/readline/configure b/readline/configure
index 2f3603a..23efc6e 100755
--- a/readline/configure
+++ b/readline/configure
@@ -1,23 +1,28 @@
#!/bin/sh
+# Please do not edit this file. It is generated automatically from
+# configure.in and a configure template.
+configdirs=
+
+#!/bin/sh
-# Configuration script
+# Configuration script template
# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
#This file is part of GNU.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 1, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id$
@@ -43,22 +48,16 @@ progname=$0
# clear some things potentially inherited from environment.
ansi=
-arguments=$*
defaulttargets=
destdir=
fatal=
hostsubdir=
-Makefile=Makefile
-Makefile_in=Makefile.in
-norecursion=
-recurring=
+norecurse=
removing=
srcdir=
srctrigger=
target=
targets=
-commontargets=
-configdirs=
targetsubdir=
template=
verbose=
@@ -66,32 +65,32 @@ verbose=
for arg in $*;
do
case ${arg} in
- -ansi | +a*)
+ -ansi | +ansi)
ansi=true
- clib=clib
;;
-destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
;;
+ -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+ | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
+ forcesubdirs=${arg}
+ ;;
-languages=* | +languages=* | +language=* | +languag=* \
| +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
| +l=*)
languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
;;
- -gas | +g*)
+ -gas | +gas | +ga | +g)
gas=yes
;;
- -help | +h*)
+ -help | +h | +help)
fatal=true
;;
- -nfp | +nf*)
+ -nfp | +nfp | +nf | +n)
nfp=yes
;;
- -norecursion | +no*)
- norecursion=true
- ;;
- -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
- recurring=true
+ -norecurse | +norecurse)
+ norecurse=true
;;
-rm | +rm)
removing=${arg}
@@ -99,21 +98,18 @@ do
# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
# ;;
- -subdirs | +f* | +su*)
- subdirs=${arg}
- ;;
- -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
+ -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=* | +t=*)
if [ -n "${targets}" ] ; then
- subdirs="+subdirs"
+ forcesubdirs="+forcesubdirs"
fi
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
targets="${newtargets}"
;;
- -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
+ -template=* | +template=*)
template=`echo ${arg} | sed 's/[+-]template=//'`
;;
- -v | -verbose | +v*)
+ +verbose | +verbos | +verbo | +verb | +ver | +ve | +v)
verbose=${arg}
;;
-* | +*)
@@ -124,7 +120,7 @@ do
;;
*)
if [ -n "${hosts}" ] ; then
- subdirs="+subdirs"
+ forcesubdirs="+forcesubdirs"
fi
newhosts="${hosts} ${arg}"
@@ -135,6 +131,7 @@ done
if [ -n "${verbose}" ] ; then
echo `pwd`/configure $*
+ echo targets=\"${targets}\"
fi
# process host and target only if not rebuilding configure itself or removing.
@@ -143,7 +140,7 @@ if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
if [ -z "${hosts}" ] ; then
(echo ;
echo "configure: No HOST specified." ;
- echo) 1>&2
+ echo) 2>&1
fatal=true
fi
fi
@@ -154,18 +151,18 @@ if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
echo "Options: [defaults in brackets]" ;
echo " +ansi configure w/ANSI library. [no ansi lib]" ;
echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
- echo " +subdirs configure in subdirectories. [in source directories]" ;
+ echo " +forcesubdirs configure in subdirectories. [in source directories]" ;
echo " +lang=LANG configure to build LANG. [gcc]" ;
echo " +help print this message. [normal config]" ;
echo " +gas configure the compilers for use with gas. [native as]" ;
echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
- echo " +norecursion configure this directory only. [recurse]" ;
+ echo " +norecurse configure this directory only. [recurse]" ;
echo " +rm remove this configuration. [build a configuration]" ;
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
echo " +template=TEM rebuild configure using TEM. [normal config]" ;
echo ;
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
- echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
+ echo "Asking for more than one \"+target\" implies \"+forcesubdirs\". Any other" ;
echo "options given will apply to all targets.") 1>&2
if [ -r config.status ] ; then
@@ -190,7 +187,7 @@ srcname="the readline library"
# are we rebuilding config itself?
if [ -n "${template}" ] ; then
if [ ! -r ${template} ] ; then
- echo '***' "Can't find template ${template}." 1>&2
+ echo "Can't find template ${template}."
exit 1
fi
@@ -204,42 +201,31 @@ if [ -n "${template}" ] ; then
-e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
#### configure.in per-target parts come in here.\
## end of per-target part.' \
- -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
-#### configure.in post-target parts come in here.\
-## end of post-target part.' \
< ${template} > template.new
if [ -r configure.in ] ; then
if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
- echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
+ echo `pwd`/configure.in has no "per-host:" line.
exit 1
fi
if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
- echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
+ echo `pwd`/configure.in has no "per-target:" line.
exit 1
fi
- # split configure.in into common, per-host, per-target,
- # and post-target parts. Post-target is optional.
+ # split configure.in into common, per-host, and per-target parts
sed -e '/^# per\-host:/,$d' configure.in > configure.com
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
- if grep -s '^# post-target:' configure.in ; then
- sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
- sed -e '1,/^# post\-target:/d' configure.in > configure.pos
- else
- sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
- echo >configure.pos
- fi
+ sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
# and insert them
sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
-e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
-e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
- -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
template.new > configure.new
- rm -f configure.com configure.tgt configure.hst configure.pos
+ rm -f configure.com configure.tgt configure.hst
else
echo Warning: no configure.in in `pwd`
cat ${template} >> configure
@@ -249,30 +235,9 @@ if [ -n "${template}" ] ; then
rm template.new
# mv configure configure.old
mv configure.new configure
+ echo Rebuilt configure in `pwd`
- if [ -n "${verbose}" ] ; then
- echo Rebuilt configure in `pwd`
- fi
-
- # Now update config.sub from the template directory.
- if echo "$template" | grep -s 'configure$' ; then
- cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
- # mv config.sub config.sub.old
- mv config.sub.new config.sub
-
- if [ -n "${verbose}" ] ; then
- echo Rebuilt config.sub in `pwd`
- fi
- fi
-
- if [ -z "${norecursion}" ] ; then
- # If template is relative path, make it absolute for recurring.
- if echo "${template}" | grep -s '^/' ; then
- true
- else
- template=`pwd`/${template}
- fi
-
+ if [ -z "${norecurse}" ] ; then
while [ -n "${configdirs}" ] ; do
# set configdir to car of configdirs, configdirs to cdr of configdirs
set ${configdirs}; configdir=$1; shift; configdirs=$*
@@ -289,12 +254,10 @@ if [ -n "${template}" ] ; then
(cd $i ;
./configure +template=${template} ${verbose})
else
- echo Warning: No configure script in `pwd`/$i
+ echo No configure script in `pwd`/$i
fi
else
- if [ -n "${verbose}" ] ; then
- echo Warning: directory $i is missing.
- fi
+ echo Warning: directory $i is missing.
fi
done
done
@@ -305,7 +268,7 @@ fi
# some sanity checks on configure.in
if [ -z "${srctrigger}" ] ; then
- echo Warning: srctrigger not set in configure.in. `pwd` not configured.
+ echo srctrigger not set in configure.in. `pwd` not configured.
exit 1
fi
@@ -316,85 +279,58 @@ for host in ${hosts} ; do
defaulttargets=true
fi
- host_alias=${host}
-
- result=`/bin/sh ./config.sub ${host}`
- host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
- host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
- host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
- host=${host_cpu}-${host_vendor}-${host_os}
- host_makefile_frag=config/hmake-${host}
-
#### configure.in per-host parts come in here.
-case "${host_os}" in
-sysv* | irix*) host_makefile_frag=config/hmake-sysv ;;
-esac
-
## end of per-host part.
+
for target in ${targets} ; do
- target_alias=${target}
- result=`/bin/sh ./config.sub ${target}`
- target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
- target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
- target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
- target=${target_cpu}-${target_vendor}-${target_os}
- target_makefile_frag=config/tmake-${target}
+ if [ -n "${verbose}" ] ; then
+ echo " "target=\"${target}\"
+ fi
#### configure.in per-target parts come in here.
## end of per-target part.
# Temporarily, we support only direct subdir builds.
- hostsubdir=H-${host_alias}
- targetsubdir=T-${target_alias}
+ hostsubdir=Host-${host}
+ targetsubdir=Target-${target}
if [ -n "${removing}" ] ; then
- if [ -n "${subdirs}" ] ; then
+ if [ -n "${forcesubdirs}" ] ; then
if [ -d "${hostsubdir}" ] ; then
rm -rf ${hostsubdir}/${targetsubdir}
- if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
+ if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
rm -rf ${hostsubdir}
fi
else
echo Warning: no `pwd`/${hostsubdir} to remove.
fi
else
- rm -f ${Makefile} config.status ${links}
+ rm -f Makefile config.status ${links}
fi
else
- if [ -n "${subdirs}" ] ; then
+ if [ -n "${forcesubdirs}" ] ; then
# check for existing status before allowing forced subdirs.
- if [ -f ${Makefile} ] ; then
- echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
+ if [ -f Makefile ] ; then
+ echo "Makefile already exists in source directory. `pwd` not configured."
exit 1
fi
if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
cd ${hostsubdir}
- if [ ! -d ${targetsubdir} ] ; then
- if [ -z "${commontargets}" ] ; then
- mkdir ${targetsubdir}
- else
- if [ ! -d Target-independent ] ; then
- mkdir Target-independent
- fi
-
- ${symbolic_link} Target-independent ${targetsubdir}
- fi # if target independent
- fi # if no target dir yet
-
+ if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
cd ${targetsubdir}
srcdir=../..
else
# if not subdir builds, then make sure none exist.
if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
- echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
+ echo "Configured subdirs exist. `pwd` not configured."
exit 1
fi
fi
@@ -410,12 +346,12 @@ esac
if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
if [ -z "${srcdirdefaulted}" ] ; then
- echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
+ echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
else
- echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
+ echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
fi
- echo '***' \(At least ${srctrigger} is missing.\) 1>&2
+ echo \(At least ${srctrigger} is missing.\) 1>&2
exit 1
fi
@@ -429,8 +365,8 @@ esac
set ${links}; link=$1; shift; links=$*
if [ ! -r ${srcdir}/${file} ] ; then
- echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
- echo '***' "since the file \"${file}\" does not exist." 1>&2
+ echo "${progname}: cannot create a link \"${link}\"," 1>&2
+ echo "since the file \"${file}\" does not exist." 1>&2
exit 1
fi
@@ -440,13 +376,10 @@ esac
${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
if [ ! -r ${link} ] ; then
- echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
+ echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
exit 1
fi
-
- if [ -n "${verbose}" ] ; then
- echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
- fi
+ echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
done
# Create a .gdbinit file which runs the one in srcdir
@@ -472,76 +405,76 @@ esac
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
if [ "${host}" != "${target}" ] ; then
- echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
- echo "ALL=start.encap" >> ${Makefile}
+ echo "CROSS=-DCROSS_COMPILE" > Makefile
+ echo "ALL=start.encap" >> Makefile
else
- echo "ALL=all.internal" > ${Makefile}
+ echo "ALL=all.internal" > Makefile
fi
# set target, host, VPATH
- echo "host_alias = ${host_alias}" >> ${Makefile}
- echo "host_cpu = ${host_cpu}" >> ${Makefile}
- echo "host_vendor = ${host_vendor}" >> ${Makefile}
- echo "host_os = ${host_os}" >> ${Makefile}
-
- echo "target_alias = ${target_alias}" >> ${Makefile}
- echo "target_cpu = ${target_cpu}" >> ${Makefile}
- echo "target_vendor = ${target_vendor}" >> ${Makefile}
- echo "target_os = ${target_os}" >> ${Makefile}
-
- if [ -n "${subdirs}" ] ; then
- echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
+ echo "host = ${host}" >> Makefile
+ echo "target = ${target}" >> Makefile
+
+ if [ -n "${forcesubdirs}" ] ; then
+ echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
else
- echo "subdir =" >> ${Makefile}
+ echo "subdir =" >> Makefile
fi
- # echo "workdir = `pwd`" >> ${Makefile}
- echo "VPATH = ${srcdir}" >> ${Makefile}
+ # echo "workdir = `pwd`" >> Makefile
+ echo "VPATH = ${srcdir}" >> Makefile
+
+ # add Makefile.in
+ cat ${srcdir}/Makefile.in >> Makefile
- # add "Makefile.in" (or whatever it's called)
- cat ${srcdir}/${Makefile_in} >> ${Makefile}
+ # and shake thoroughly.
+ if [ -z "${host_makefile_frag}" ] ; then
+ host_makefile_frag=config/hmake-${host}
+ fi
+
+ if [ -z "${target_makefile_frag}" ] ; then
+ target_makefile_frag=config/tmake-${target}
+ fi
# Conditionalize the makefile for this host.
if [ -f ${srcdir}/${host_makefile_frag} ] ; then
- (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
- sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
fi
# Conditionalize the makefile for this target.
if [ -f ${srcdir}/${target_makefile_frag} ] ; then
- (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
- sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
fi
# set srcdir
- sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
# set destdir
if [ -n "${destdir}" ] ; then
- sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed "s:^destdir =.*$:destdir = ${destdir}:" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
fi
+ # Remove all formfeeds, since some Makes get confused by them.
+ sed "s/ //" Makefile >> Makefile.tem
+ mv Makefile.tem Makefile
+
# reset SUBDIRS
- sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
# reset NONSUBDIRS
- sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
+ sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
+ mv Makefile.tem Makefile
using=
if [ -f ${srcdir}/${host_makefile_frag} ] ; then
using=" using \"${host_makefile_frag}\""
fi
- # remove any form feeds.
- sed -e "s/ //" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
-
if [ -f ${srcdir}/${target_makefile_frag} ] ; then
if [ -z "${using}" ] ; then
andusing=" using \"${target_makefile_frag}\""
@@ -552,72 +485,164 @@ esac
andusing=${using}
fi
- if [ -n "${verbose}" -o -z "${recurring}" ] ; then
- echo "Created \"${Makefile}\"" in `pwd`${andusing}.
- fi
-
-#### configure.in post-target parts come in here.
-
-## end of post-target part.
+ echo "Created \"Makefile\"" in `pwd`${andusing}.
- # describe the chosen configuration in config.status.
- # Make that file a shellscript which will reestablish
- # the same configuration. Used in Makefiles to rebuild
- # Makefiles.
-
- echo "#!/bin/sh
-# ${srcname} was configured as follows:
-${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
- chmod a+x config.status
+ if [ "${host}" = "${target}" ] ; then
+ echo "Links are now set up for use with a ${target}." \
+ > config.status
+ # | tee ${srcdir}/config.status
+ else
+ echo "Links are now set up for host ${host} and target ${target}." \
+ > config.status
+ # | tee ${srcdir}/config.status
+ fi
originaldir=`pwd`
cd ${srcdir}
fi
+ done # for each target
- # If there are subdirectories, then recurse.
- if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
- for configdir in ${configdirs} ; do
- if [ -n "${verbose}" ] ; then
- echo Configuring ${configdir}...
- fi
+# # Now build a Makefile for this host.
+# if [ -n "${forcesubdirs}" ] ; then
+# cd ${hostsubdir}
+# cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+# for i in ${targets} ; do \
+# $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+# fi
+done # for each host
- if [ -d ${configdir} ] ; then
- (cd ${configdir} ;
- ./configure +recurring ${host_alias} +target=${target_alias} \
- ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
- | sed 's/^/ /'
- else
- if [ -n "${verbose}" ] ; then
- echo Warning: directory \"${configdir}\" is missing.
- fi
- fi
- done
- fi
- done # for each target
+# If there are subdirectories, then recurse.
- # Now build a Makefile for this host.
- if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
- cd ${hostsubdir}
- cat > GNUmakefile << E!O!F
-# Makefile generated by configure for host ${host_alias}.
+if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
-ALL := $(shell ls -d Target-*)
+# configdirs is not null
+for configdir in ${configdirs} ; do
+ echo Configuring ${configdir}...
+ specifics=
+ commons=
-%:
- $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
+ if [ -n "${defaulttargets}" ] ; then
+ for host in ${hosts} ; do
+ if [ -d ${configdir}.${host} ] ; then
+ newspecifics="${specifics} ${host}"
+ specifics=${newspecifics}
+ else
+ newcommons="${commons} ${host}"
+ commons=${newcommons}
+ fi # if target specific
+ done # for each host
+
+ if [ -n "${commons}" ] ; then
+ if [ -d ${configdir} ] ; then
+ (cd ${configdir} ;
+ ./configure ${commons} ${verbose} ${forcesubdirs} ${removing}) \
+ | sed 's/^/ /'
+ else
+ echo Warning: directory \"${configdir}\" is missing.
+ fi
+ fi # if any common hosts
+
+ if [ -n "${specifics}" ] ; then
+ for host in ${specifics} ; do
+ echo Configuring target specific directory ${configdir}.${host}...
+ (cd ${configdir}.${host} ;
+ ./configure ${host} ${verbose} ${forcesubdirs} ${removing}) \
+ | sed 's/^/ /'
+ done # for host in specifics
+ fi # if there are any specifics
+ else
-all:
-E!O!F
- cd ..
- fi
-done # for each host
+ for target in ${targets} ; do
+ if [ -d ${configdir}.${target} ] ; then
+ newspecifics="${specifics} ${target}"
+ specifics=${newspecifics}
+ else
+ newcommons="${commons} +target=${target}"
+ commons=${newcommons}
+ fi
+
+ done # check for target specific dir override
+
+ if [ -n "${verbose}" ] ; then
+ echo " "commons=\"${commons}\"
+ echo " "specifics=\"${specifics}\"
+ fi # if verbose
+
+ if [ -n "${commons}" ] ; then
+ if [ -d ${configdir} ] ; then
+ (cd ${configdir} ;
+ ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
+ | sed 's/^/ /'
+ else
+ echo Warning: directory \"${configdir}\" is missing.
+ fi
+ fi # if any commons
+
+ if [ -n "${specifics}" ] ; then
+ for target in ${specifics} ; do
+ echo Configuring target specific directory ${configdir}.${target}...
+ (cd ${configdir}.${target} ;
+ ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
+ | sed 's/^/ /'
+ done
+ fi # if any specifics
+ fi # not default targets
+done
exit 0
#
+# $Log$
+# Revision 1.1 1991/05/21 19:55:06 rich
+# Initial revision
+#
+# Revision 1.12 1991/05/19 00:32:13 rich
+# Changes to deal with missing subdirs gracefully, and changes dictated
+# from dropping configure over gdb.
+#
+# Revision 1.4 1991/05/19 00:16:45 rich
+# Configure for gdb.
+#
+# Revision 1.10 1991/05/04 00:58:38 rich
+# Fix program name bug.
+#
+# Revision 1.9 1991/05/03 19:14:18 rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8 1991/04/24 16:50:59 rich
+# Three staging checkpoint.
+#
+# Revision 1.7 1991/04/17 01:34:47 rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
+#
+# Revision 1.6 1991/04/16 00:18:44 rich
+# Now handles multiple hosts and targets.
+#
+# Revision 1.5 1991/04/15 23:43:44 rich
+# Now handles multiple hosts and targets.
+#
+# Revision 1.4 1991/04/13 02:11:03 rich
+# Config cut 3. We now almost install a29k.
+#
+# Revision 1.3 1991/04/11 02:41:54 rich
+# Cut 2 config. Subdirs.
+#
+#
+#
+
+#
# Local Variables:
# fill-column: 131
# End:
#
-# end of configure
+# end of configure.template
diff --git a/readline/configure.in b/readline/configure.in
deleted file mode 100644
index 4006e70..0000000
--- a/readline/configure.in
+++ /dev/null
@@ -1,29 +0,0 @@
-# This file is a shell script fragment that supplies the information
-# necessary to tailor a template configure script into the configure
-# script appropriate for this directory. For more information, check
-# any existing configure script.
-
-configdirs=
-srctrigger=readline.c
-srcname="the readline library"
-commontargets=true
-
-# per-host:
-
-files=sysdep-norm.h
-links=sysdep.h
-
-case "${host_os}" in
-m88kbcs | sysv* | irix*)
- host_makefile_frag=config/hm-sysv
- ;;
-
-aix*)
- host_makefile_frag=config/hm-sysv
- case "${host_arch}" in
- rs6000) files=sysdep-aix.h
- esac
- ;;
-esac
-
-# per-target:
diff --git a/readline/display.c b/readline/display.c
new file mode 100644
index 0000000..c889318
--- /dev/null
+++ b/readline/display.c
@@ -0,0 +1,801 @@
+/* display.c -- readline redisplay facility. */
+
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+
+/* Some standard library routines. */
+#include "readline.h"
+#include "history.h"
+
+#if !defined (strrchr)
+extern char *strrchr ();
+#endif /* !strchr */
+
+/* Global and pseudo-global variables and functions
+ imported from readline.c. */
+extern char *rl_prompt;
+extern int readline_echoing_p;
+extern char *term_clreol, *term_im, *term_ic, *term_ei, *term_DC;
+/* Termcap variables. */
+extern char *term_up, *term_dc, *term_cr, *term_IC;
+extern int screenheight, screenwidth, terminal_can_insert;
+
+extern void _rl_output_some_chars ();
+extern void _rl_output_character_function ();
+
+extern int _rl_convert_meta_chars_to_ascii;
+extern int _rl_horizontal_scroll_mode;
+extern int _rl_mark_modified_lines;
+extern int _rl_prefer_visible_bell;
+
+/* Pseudo-global functions (local to the readline library) exported
+ by this file. */
+void _rl_move_cursor_relative (), _rl_output_some_chars ();
+void _rl_move_vert ();
+
+static void update_line (), clear_to_eol ();
+static void delete_chars (), insert_some_chars ();
+
+extern char *xmalloc (), *xrealloc ();
+
+/* **************************************************************** */
+/* */
+/* Display stuff */
+/* */
+/* **************************************************************** */
+
+/* This is the stuff that is hard for me. I never seem to write good
+ display routines in C. Let's see how I do this time. */
+
+/* (PWP) Well... Good for a simple line updater, but totally ignores
+ the problems of input lines longer than the screen width.
+
+ update_line and the code that calls it makes a multiple line,
+ automatically wrapping line update. Carefull attention needs
+ to be paid to the vertical position variables.
+
+ handling of terminals with autowrap on (incl. DEC braindamage)
+ could be improved a bit. Right now I just cheat and decrement
+ screenwidth by one. */
+
+/* Keep two buffers; one which reflects the current contents of the
+ screen, and the other to draw what we think the new contents should
+ be. Then compare the buffers, and make whatever changes to the
+ screen itself that we should. Finally, make the buffer that we
+ just drew into be the one which reflects the current contents of the
+ screen, and place the cursor where it belongs.
+
+ Commands that want to can fix the display themselves, and then let
+ this function know that the display has been fixed by setting the
+ RL_DISPLAY_FIXED variable. This is good for efficiency. */
+
+/* What YOU turn on when you have handled all redisplay yourself. */
+int rl_display_fixed = 0;
+
+/* The stuff that gets printed out before the actual text of the line.
+ This is usually pointing to rl_prompt. */
+char *rl_display_prompt = (char *)NULL;
+
+/* Pseudo-global variables declared here. */
+/* The visible cursor position. If you print some text, adjust this. */
+int _rl_last_c_pos = 0;
+int _rl_last_v_pos = 0;
+
+/* Number of lines currently on screen minus 1. */
+int _rl_vis_botlin = 0;
+
+/* Variables used only in this file. */
+/* The last left edge of text that was displayed. This is used when
+ doing horizontal scrolling. It shifts in thirds of a screenwidth. */
+static int last_lmargin = 0;
+
+/* The line display buffers. One is the line currently displayed on
+ the screen. The other is the line about to be displayed. */
+static char *visible_line = (char *)NULL;
+static char *invisible_line = (char *)NULL;
+
+/* A buffer for `modeline' messages. */
+static char msg_buf[128];
+
+/* Non-zero forces the redisplay even if we thought it was unnecessary. */
+static int forced_display = 0;
+
+/* Default and initial buffer size. Can grow. */
+static int line_size = 1024;
+
+/* Basic redisplay algorithm. */
+rl_redisplay ()
+{
+ register int in, out, c, linenum;
+ register char *line = invisible_line;
+ char *prompt_this_line;
+ int c_pos = 0;
+ int inv_botlin = 0; /* Number of lines in newly drawn buffer. */
+
+ if (!readline_echoing_p)
+ return;
+
+ if (!rl_display_prompt)
+ rl_display_prompt = "";
+
+ if (!invisible_line)
+ {
+ visible_line = (char *)xmalloc (line_size);
+ invisible_line = (char *)xmalloc (line_size);
+ line = invisible_line;
+ for (in = 0; in < line_size; in++)
+ {
+ visible_line[in] = 0;
+ invisible_line[in] = 1;
+ }
+ rl_on_new_line ();
+ }
+
+ /* Draw the line into the buffer. */
+ c_pos = -1;
+
+ /* Mark the line as modified or not. We only do this for history
+ lines. */
+ out = 0;
+ if (_rl_mark_modified_lines && current_history () && rl_undo_list)
+ {
+ line[out++] = '*';
+ line[out] = '\0';
+ }
+
+ /* If someone thought that the redisplay was handled, but the currently
+ visible line has a different modification state than the one about
+ to become visible, then correct the caller's misconception. */
+ if (visible_line[0] != invisible_line[0])
+ rl_display_fixed = 0;
+
+ prompt_this_line = strrchr (rl_display_prompt, '\n');
+ if (!prompt_this_line)
+ prompt_this_line = rl_display_prompt;
+ else
+ {
+ prompt_this_line++;
+ if (forced_display)
+ _rl_output_some_chars
+ (rl_display_prompt, prompt_this_line - rl_display_prompt);
+ }
+
+ strncpy (line + out, prompt_this_line, strlen (prompt_this_line));
+ out += strlen (prompt_this_line);
+ line[out] = '\0';
+
+ for (in = 0; in < rl_end; in++)
+ {
+ c = (unsigned char)rl_line_buffer[in];
+
+ if (out + 8 >= line_size) /* XXX - 8 for \t */
+ {
+ line_size *= 2;
+ visible_line = (char *)xrealloc (visible_line, line_size);
+ invisible_line = (char *)xrealloc (invisible_line, line_size);
+ line = invisible_line;
+ }
+
+ if (in == rl_point)
+ c_pos = out;
+
+ if (META_CHAR (c))
+ {
+ if (_rl_convert_meta_chars_to_ascii)
+ {
+ sprintf (line + out, "\\%o", c);
+ out += 4;
+ }
+ else
+ line[out++] = c;
+ }
+#define DISPLAY_TABS
+#if defined (DISPLAY_TABS)
+ else if (c == '\t')
+ {
+ register int newout = (out | (int)7) + 1;
+ while (out < newout)
+ line[out++] = ' ';
+ }
+#endif
+ else if (c < ' ')
+ {
+ line[out++] = '^';
+ line[out++] = UNCTRL (c); /* XXX was c ^ 0x40 */
+ }
+ else if (c == 127)
+ {
+ line[out++] = '^';
+ line[out++] = '?';
+ }
+ else
+ line[out++] = c;
+ }
+ line[out] = '\0';
+ if (c_pos < 0)
+ c_pos = out;
+
+ /* PWP: now is when things get a bit hairy. The visible and invisible
+ line buffers are really multiple lines, which would wrap every
+ (screenwidth - 1) characters. Go through each in turn, finding
+ the changed region and updating it. The line order is top to bottom. */
+
+ /* If we can move the cursor up and down, then use multiple lines,
+ otherwise, let long lines display in a single terminal line, and
+ horizontally scroll it. */
+
+ if (!_rl_horizontal_scroll_mode && term_up && *term_up)
+ {
+ int total_screen_chars = (screenwidth * screenheight);
+
+ if (!rl_display_fixed || forced_display)
+ {
+ forced_display = 0;
+
+ /* If we have more than a screenful of material to display, then
+ only display a screenful. We should display the last screen,
+ not the first. I'll fix this in a minute. */
+ if (out >= total_screen_chars)
+ out = total_screen_chars - 1;
+
+ /* Number of screen lines to display. */
+ inv_botlin = out / screenwidth;
+
+ /* For each line in the buffer, do the updating display. */
+ for (linenum = 0; linenum <= inv_botlin; linenum++)
+ update_line (linenum > _rl_vis_botlin ? ""
+ : &visible_line[linenum * screenwidth],
+ &invisible_line[linenum * screenwidth],
+ linenum);
+
+ /* We may have deleted some lines. If so, clear the left over
+ blank ones at the bottom out. */
+ if (_rl_vis_botlin > inv_botlin)
+ {
+ char *tt;
+ for (; linenum <= _rl_vis_botlin; linenum++)
+ {
+ tt = &visible_line[linenum * screenwidth];
+ _rl_move_vert (linenum);
+ _rl_move_cursor_relative (0, tt);
+ clear_to_eol
+ ((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth);
+ }
+ }
+ _rl_vis_botlin = inv_botlin;
+
+ /* Move the cursor where it should be. */
+ _rl_move_vert (c_pos / screenwidth);
+ _rl_move_cursor_relative (c_pos % screenwidth,
+ &invisible_line[(c_pos / screenwidth) * screenwidth]);
+ }
+ }
+ else /* Do horizontal scrolling. */
+ {
+ int lmargin;
+
+ /* Always at top line. */
+ _rl_last_v_pos = 0;
+
+ /* If the display position of the cursor would be off the edge
+ of the screen, start the display of this line at an offset that
+ leaves the cursor on the screen. */
+ if (c_pos - last_lmargin > screenwidth - 2)
+ lmargin = (c_pos / (screenwidth / 3) - 2) * (screenwidth / 3);
+ else if (c_pos - last_lmargin < 1)
+ lmargin = ((c_pos - 1) / (screenwidth / 3)) * (screenwidth / 3);
+ else
+ lmargin = last_lmargin;
+
+ /* If the first character on the screen isn't the first character
+ in the display line, indicate this with a special character. */
+ if (lmargin > 0)
+ line[lmargin] = '<';
+
+ if (lmargin + screenwidth < out)
+ line[lmargin + screenwidth - 1] = '>';
+
+ if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
+ {
+ forced_display = 0;
+ update_line (&visible_line[last_lmargin],
+ &invisible_line[lmargin], 0);
+
+ _rl_move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]);
+ last_lmargin = lmargin;
+ }
+ }
+ fflush (rl_outstream);
+
+ /* Swap visible and non-visible lines. */
+ {
+ char *temp = visible_line;
+ visible_line = invisible_line;
+ invisible_line = temp;
+ rl_display_fixed = 0;
+ }
+}
+
+/* PWP: update_line() is based on finding the middle difference of each
+ line on the screen; vis:
+
+ /old first difference
+ /beginning of line | /old last same /old EOL
+ v v v v
+old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
+new: eddie> Oh, my little buggy says to me, as lurgid as
+ ^ ^ ^ ^
+ \beginning of line | \new last same \new end of line
+ \new first difference
+
+ All are character pointers for the sake of speed. Special cases for
+ no differences, as well as for end of line additions must be handeled.
+
+ Could be made even smarter, but this works well enough */
+static void
+update_line (old, new, current_line)
+ register char *old, *new;
+ int current_line;
+{
+ register char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ int lendiff, wsatend;
+
+ /* Find first difference. */
+ for (ofd = old, nfd = new;
+ (ofd - old < screenwidth) && *ofd && (*ofd == *nfd);
+ ofd++, nfd++)
+ ;
+
+ /* Move to the end of the screen line. */
+ for (oe = ofd; ((oe - old) < screenwidth) && *oe; oe++);
+ for (ne = nfd; ((ne - new) < screenwidth) && *ne; ne++);
+
+ /* If no difference, continue to next line. */
+ if (ofd == oe && nfd == ne)
+ return;
+
+ wsatend = 1; /* flag for trailing whitespace */
+ ols = oe - 1; /* find last same */
+ nls = ne - 1;
+ while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
+ {
+ if (*ols != ' ')
+ wsatend = 0;
+ ols--;
+ nls--;
+ }
+
+ if (wsatend)
+ {
+ ols = oe;
+ nls = ne;
+ }
+ else if (*ols != *nls)
+ {
+ if (*ols) /* don't step past the NUL */
+ ols++;
+ if (*nls)
+ nls++;
+ }
+
+ _rl_move_vert (current_line);
+ _rl_move_cursor_relative (ofd - old, old);
+
+ /* if (len (new) > len (old)) */
+ lendiff = (nls - nfd) - (ols - ofd);
+
+ /* Insert (diff (len (old), len (new)) ch. */
+ if (lendiff > 0)
+ {
+ if (terminal_can_insert)
+ {
+ /* Sometimes it is cheaper to print the characters rather than
+ use the terminal's capabilities. */
+ if ((2 * (ne - nfd)) < lendiff && !term_IC)
+ {
+ _rl_output_some_chars (nfd, (ne - nfd));
+ _rl_last_c_pos += (ne - nfd);
+ }
+ else
+ {
+ if (*ols)
+ {
+ insert_some_chars (nfd, lendiff);
+ _rl_last_c_pos += lendiff;
+ }
+ else
+ {
+ /* At the end of a line the characters do not have to
+ be "inserted". They can just be placed on the screen. */
+ _rl_output_some_chars (nfd, lendiff);
+ _rl_last_c_pos += lendiff;
+ }
+ /* Copy (new) chars to screen from first diff to last match. */
+ if (((nls - nfd) - lendiff) > 0)
+ {
+ _rl_output_some_chars (&nfd[lendiff], ((nls - nfd) - lendiff));
+ _rl_last_c_pos += ((nls - nfd) - lendiff);
+ }
+ }
+ }
+ else
+ { /* cannot insert chars, write to EOL */
+ _rl_output_some_chars (nfd, (ne - nfd));
+ _rl_last_c_pos += (ne - nfd);
+ }
+ }
+ else /* Delete characters from line. */
+ {
+ /* If possible and inexpensive to use terminal deletion, then do so. */
+ if (term_dc && (2 * (ne - nfd)) >= (-lendiff))
+ {
+ if (lendiff)
+ delete_chars (-lendiff); /* delete (diff) characters */
+
+ /* Copy (new) chars to screen from first diff to last match */
+ if ((nls - nfd) > 0)
+ {
+ _rl_output_some_chars (nfd, (nls - nfd));
+ _rl_last_c_pos += (nls - nfd);
+ }
+ }
+ /* Otherwise, print over the existing material. */
+ else
+ {
+ _rl_output_some_chars (nfd, (ne - nfd));
+ _rl_last_c_pos += (ne - nfd);
+ clear_to_eol ((oe - old) - (ne - new));
+ }
+ }
+}
+
+/* Tell the update routines that we have moved onto a new (empty) line. */
+rl_on_new_line ()
+{
+ if (visible_line)
+ visible_line[0] = '\0';
+
+ _rl_last_c_pos = _rl_last_v_pos = 0;
+ _rl_vis_botlin = last_lmargin = 0;
+}
+
+/* Actually update the display, period. */
+rl_forced_update_display ()
+{
+ if (visible_line)
+ {
+ register char *temp = visible_line;
+
+ while (*temp) *temp++ = '\0';
+ }
+ rl_on_new_line ();
+ forced_display++;
+ rl_redisplay ();
+}
+
+/* Move the cursor from _rl_last_c_pos to NEW, which are buffer indices.
+ DATA is the contents of the screen line of interest; i.e., where
+ the movement is being done. */
+void
+_rl_move_cursor_relative (new, data)
+ int new;
+ char *data;
+{
+ register int i;
+
+ /* It may be faster to output a CR, and then move forwards instead
+ of moving backwards. */
+ if (new + 1 < _rl_last_c_pos - new)
+ {
+#ifdef __MSDOS__
+ putc('\r', rl_outstream);
+#else
+ tputs (term_cr, 1, _rl_output_character_function);
+#endif
+ _rl_last_c_pos = 0;
+ }
+
+ if (_rl_last_c_pos == new) return;
+
+ if (_rl_last_c_pos < new)
+ {
+ /* Move the cursor forward. We do it by printing the command
+ to move the cursor forward if there is one, else print that
+ portion of the output buffer again. Which is cheaper? */
+
+ /* The above comment is left here for posterity. It is faster
+ to print one character (non-control) than to print a control
+ sequence telling the terminal to move forward one character.
+ That kind of control is for people who don't know what the
+ data is underneath the cursor. */
+#if defined (HACK_TERMCAP_MOTION)
+ extern char *term_forward_char;
+
+ if (term_forward_char)
+ for (i = _rl_last_c_pos; i < new; i++)
+ tputs (term_forward_char, 1, _rl_output_character_function);
+ else
+ for (i = _rl_last_c_pos; i < new; i++)
+ putc (data[i], rl_outstream);
+#else
+ for (i = _rl_last_c_pos; i < new; i++)
+ putc (data[i], rl_outstream);
+#endif /* HACK_TERMCAP_MOTION */
+ }
+ else
+ backspace (_rl_last_c_pos - new);
+ _rl_last_c_pos = new;
+}
+
+/* PWP: move the cursor up or down. */
+void
+_rl_move_vert (to)
+ int to;
+{
+ register int delta, i;
+
+ if (_rl_last_v_pos == to || to > screenheight)
+ return;
+
+#ifdef __GO32__
+ {
+ int row, col;
+ ScreenGetCursor (&row, &col);
+ ScreenSetCursor ((row + to - _rl_last_v_pos), col);
+ }
+#else /* __GO32__ */
+ if ((delta = to - _rl_last_v_pos) > 0)
+ {
+ for (i = 0; i < delta; i++)
+ putc ('\n', rl_outstream);
+ tputs (term_cr, 1, _rl_output_character_function);
+ _rl_last_c_pos = 0;
+ }
+ else
+ { /* delta < 0 */
+ if (term_up && *term_up)
+ for (i = 0; i < -delta; i++)
+ tputs (term_up, 1, _rl_output_character_function);
+ }
+#endif /* !__GO32__ */
+ _rl_last_v_pos = to; /* Now TO is here */
+}
+
+/* Physically print C on rl_outstream. This is for functions which know
+ how to optimize the display. */
+rl_show_char (c)
+ int c;
+{
+ if (META_CHAR (c) && _rl_convert_meta_chars_to_ascii)
+ {
+ fprintf (rl_outstream, "M-");
+ c = UNMETA (c);
+ }
+
+#if defined (DISPLAY_TABS)
+ if (c < 32 && c != '\t')
+#else
+ if (c < 32)
+#endif /* !DISPLAY_TABS */
+ {
+
+ c += 64;
+ }
+
+ putc (c, rl_outstream);
+ fflush (rl_outstream);
+}
+
+int
+rl_character_len (c, pos)
+ register int c, pos;
+{
+ if (META_CHAR (c))
+ return (_rl_convert_meta_chars_to_ascii ? 4 : 1);
+
+ if (c == '\t')
+ {
+#if defined (DISPLAY_TABS)
+ return (((pos | (int)7) + 1) - pos);
+#else
+ return (2);
+#endif /* !DISPLAY_TABS */
+ }
+
+ if (isprint (c))
+ return (1);
+ else
+ return (2);
+}
+
+/* How to print things in the "echo-area". The prompt is treated as a
+ mini-modeline. */
+
+#if defined (HAVE_VARARGS_H)
+rl_message (va_alist)
+ va_dcl
+{
+ char *format;
+ va_list args;
+
+ va_start (args);
+ format = va_arg (args, char *);
+ vsprintf (msg_buf, format, args);
+ va_end (args);
+
+ rl_display_prompt = msg_buf;
+ rl_redisplay ();
+}
+#else /* !HAVE_VARARGS_H */
+rl_message (format, arg1, arg2)
+ char *format;
+{
+ sprintf (msg_buf, format, arg1, arg2);
+ rl_display_prompt = msg_buf;
+ rl_redisplay ();
+}
+#endif /* !HAVE_VARARGS_H */
+
+/* How to clear things from the "echo-area". */
+rl_clear_message ()
+{
+ rl_display_prompt = rl_prompt;
+ rl_redisplay ();
+}
+
+rl_reset_line_state ()
+{
+ rl_on_new_line ();
+
+ rl_display_prompt = rl_prompt ? rl_prompt : "";
+ forced_display = 1;
+}
+
+/* Quick redisplay hack when erasing characters at the end of the line. */
+void
+_rl_erase_at_end_of_line (l)
+ int l;
+{
+ register int i;
+
+ backspace (l);
+ for (i = 0; i < l; i++)
+ putc (' ', rl_outstream);
+ backspace (l);
+ for (i = 0; i < l; i++)
+ visible_line[--_rl_last_c_pos] = '\0';
+ rl_display_fixed++;
+}
+
+/* Clear to the end of the line. COUNT is the minimum
+ number of character spaces to clear, */
+static void
+clear_to_eol (count)
+ int count;
+{
+#ifndef __GO32__
+ if (term_clreol)
+ {
+ tputs (term_clreol, 1, _rl_output_character_function);
+ }
+ else
+#endif /* !__GO32__ */
+ {
+ register int i;
+
+ /* Do one more character space. */
+ count++;
+
+ for (i = 0; i < count; i++)
+ putc (' ', rl_outstream);
+
+ backspace (count);
+ }
+}
+/* Insert COUNT characters from STRING to the output stream. */
+static void
+insert_some_chars (string, count)
+ char *string;
+ int count;
+{
+#ifdef __GO32__
+ int row, col, width;
+ char *row_start;
+
+ ScreenGetCursor (&row, &col);
+ width = ScreenCols ();
+ row_start = ScreenPrimary + (row * width);
+ memcpy (row_start + col + count, row_start + col, width - col - count);
+ /* Place the text on the screen. */
+ _rl_output_some_chars (string, count);
+#else /* __GO32__ */
+ /* If IC is defined, then we do not have to "enter" insert mode. */
+ if (term_IC)
+ {
+ char *tgoto (), *buffer;
+ buffer = tgoto (term_IC, 0, count);
+ tputs (buffer, 1, _rl_output_character_function);
+ _rl_output_some_chars (string, count);
+ }
+ else
+ {
+ register int i;
+
+ /* If we have to turn on insert-mode, then do so. */
+ if (term_im && *term_im)
+ tputs (term_im, 1, _rl_output_character_function);
+
+ /* If there is a special command for inserting characters, then
+ use that first to open up the space. */
+ if (term_ic && *term_ic)
+ {
+ for (i = count; i--; )
+ tputs (term_ic, 1, _rl_output_character_function);
+ }
+
+ /* Print the text. */
+ _rl_output_some_chars (string, count);
+
+ /* If there is a string to turn off insert mode, we had best use
+ it now. */
+ if (term_ei && *term_ei)
+ tputs (term_ei, 1, _rl_output_character_function);
+ }
+#endif /* __GO32__ */
+}
+
+/* Delete COUNT characters from the display line. */
+static void
+delete_chars (count)
+ int count;
+{
+#if defined (__GO32__)
+ int row, col, width;
+ char *row_start;
+
+ ScreenGetCursor (&row, &col);
+ width = ScreenCols ();
+ row_start = ScreenPrimary + (row * width);
+ memcpy (row_start + col, row_start + col + count, width - col - count);
+ memset (row_start + width - count, 0, count * 2);
+#else /* !__GO32__ */
+ if (count > screenwidth)
+ return;
+
+ if (term_DC && *term_DC)
+ {
+ char *tgoto (), *buffer;
+ buffer = tgoto (term_DC, 0, count);
+ tputs (buffer, 1, _rl_output_character_function);
+ }
+ else
+ {
+ if (term_dc && *term_dc)
+ while (count--)
+ tputs (term_dc, 1, _rl_output_character_function);
+ }
+#endif /* !__GO32__ */
+}
diff --git a/readline/doc/Makefile b/readline/doc/Makefile
deleted file mode 100644
index 6ea7eb8..0000000
--- a/readline/doc/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# This makefile for Readline library documentation is in -*- text -*- mode.
-# Emacs likes it that way.
-
-DVIOBJ = readline.dvi history.dvi
-INFOBJ = readline.info history.info
-
-all: $(DVIOBJ) $(INFOBJ)
-
-readline.dvi: texindex rlman.texinfo rluser.texinfo rltech.texinfo
- tex rlman.texinfo
- ./texindex rlman.??
- tex rlman.texinfo
- mv rlman.dvi readline.dvi
-
-history.dvi: texindex hist.texinfo hsuser.texinfo hstech.texinfo
- tex hist.texinfo
- tex hist.texinfo
- mv hist.dvi history.dvi
-
-readline.info: rlman.texinfo rluser.texinfo rltech.texinfo
- makeinfo rlman.texinfo
-
-history.info: hist.texinfo hsuser.texinfo hstech.texinfo
- makeinfo hist.texinfo
-
-texindex: texindex.o
- $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $?
-texindex.o: texindex.c
-
-clean:
- rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
- *.fns *.kys *.tps *.vrs *.o core texindex
-
-squeaky-clean:
- rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
- *.dvi *.info *.info-* *.fns *.kys *.tps *.vrs *.o core texindex
diff --git a/readline/doc/Makefile.in b/readline/doc/Makefile.in
new file mode 100644
index 0000000..5e0d2d5
--- /dev/null
+++ b/readline/doc/Makefile.in
@@ -0,0 +1,94 @@
+## Copyright (C) 1993 Free Software Foundation, Inc.
+
+# Makefile for Readline documentation.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+srcdir = .
+
+prefix = /usr/local
+
+infodir = $(prefix)/info
+
+SHELL = /bin/sh
+
+INSTALL = install -c
+INSTALL_DATA = $(INSTALL)
+
+# where to find texinfo
+TEXIDIR=$(srcdir)/../../texinfo
+
+# where to find makeinfo, preferably one designed for texinfo-2
+MAKEINFO=makeinfo
+
+# auxiliary program for sorting Texinfo indices
+TEXINDEX=texindex
+
+# Don Knuth's TeX formatter
+TEX=tex
+
+#### Host, target, and site specific Makefile fragments come in here.
+###
+
+all: info dvi
+
+install: install-info
+
+info: history.info readline.info
+
+dvi: history.dvi readline.dvi
+
+install-info: info
+ -parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
+ if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
+ -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
+ for i in *.info* ; do \
+ $(INSTALL_DATA) $$i $(infodir)/$$i ; \
+ done
+
+history.info: hist.texinfo hsuser.texinfo hstech.texinfo
+ $(MAKEINFO) -I $(srcdir) -o ./history.info $(srcdir)/hist.texinfo
+
+history.dvi: hist.texinfo hsuser.texinfo hstech.texinfo $(TEXIDIR)/texinfo.tex
+ TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo
+ $(TEXINDEX) hist.??
+ TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo
+
+readline.info: rlman.texinfo rluser.texinfo rltech.texinfo
+ $(MAKEINFO) -I $(srcdir) -o ./readline.info $(srcdir)/rlman.texinfo
+
+readline.dvi: rlman.texinfo rluser.texinfo rltech.texinfo
+ TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo
+ $(TEXINDEX) rlman.??
+ TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo
+
+distclean: clean
+ rm -f Makefile config.status
+
+mostlyclean: clean
+
+realclean: distclean
+
+clean: clean-info clean-dvi
+
+clean-info:
+ rm -f history.info* readline.info*
+
+clean-dvi:
+ rm -f hist.?? hist.???
+ rm -f rlman.?? rlman.???
+
+Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
+ $(SHELL) ./config.status
diff --git a/readline/doc/texindex.c b/readline/doc/texindex.c
deleted file mode 100644
index cb979da..0000000
--- a/readline/doc/texindex.c
+++ /dev/null
@@ -1,1606 +0,0 @@
-/* Prepare Tex index dribble output into an actual index.
- Copyright (C) 1987 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-extern int errno;
-
-#ifdef VMS
-#ifndef VAX11C
-#define noshare
-#endif
-
-#include <perror.h>
-#include <file.h>
-
-#define EXIT_SUCCESS ((1 << 28) | 1)
-#define EXIT_FATAL ((1 << 28) | 4)
-#define unlink delete
-#define tell(fd) lseek(fd, 0L, 1)
-
-#else /* Not VMS */
-
-#ifdef USG
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#endif
-#include <sys/file.h>
-
-#define EXIT_SUCCESS 0
-#define EXIT_FATAL 1
-
-#endif /* Not VMS */
-
-
-#ifndef L_XTND
-#define L_XTND 2
-#endif
-
-#ifdef VMS
-extern noshare int sys_nerr;
-extern noshare char *sys_errlist[];
-#else
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif
-
-/* When sorting in core, this structure describes one line
- and the position and length of its first keyfield. */
-
-struct lineinfo
- {
- char *text; /* The actual text of the line */
- union
- { /* The start of the key (for textual comparison) */
- char *text;
- long number; /* or the numeric value (for numeric comparison) */
- } key;
- long keylen; /* Length of key field */
- };
-
-/* This structure describes a field to use as a sort key */
-
-struct keyfield
- {
- int startwords; /* # words to skip */
- int startchars; /* and # additional chars to skip, to start of field */
- int endwords; /* similar, from beg (or end) of line, to find end of field */
- int endchars;
- char ignore_blanks; /* Ignore spaces and tabs within the field */
- char fold_case; /* Convert upper case to lower before comparing */
- char reverse; /* Compare in reverse order */
- char numeric; /* Parse text as an integer and compare the integers */
- char positional; /* Sort according to position within the file */
- char braced; /* Count balanced-braced groupings as fields */
- };
-
-/* Vector of keyfields to use */
-
-struct keyfield keyfields[3];
-
-/* Number of keyfields stored in that vector. */
-
-int num_keyfields = 3;
-
-/* Vector of input file names, terminated with a zero (null pointer) */
-
-char **infiles;
-
-/* Vector of corresponding output file names, or zero meaning default it */
-
-char **outfiles;
-
-/* Length of `infiles' */
-
-int num_infiles;
-
-/* Pointer to the array of pointers to lines being sorted */
-
-char **linearray;
-
-/* The allocated length of `linearray'. */
-
-long nlines;
-
-/* Directory to use for temporary files. On Unix, it ends with a slash. */
-
-char *tempdir;
-
-/* Start of filename to use for temporary files. */
-
-char *tempbase;
-
-/* Number of last temporary file. */
-
-int tempcount;
-
-/* Number of last temporary file already deleted.
- Temporary files are deleted by `flush_tempfiles' in order of creation. */
-
-int last_deleted_tempcount;
-
-/* During in-core sort, this points to the base of the data block
- which contains all the lines of data. */
-
-char *text_base;
-
-/* Additional command switches */
-
-int keep_tempfiles; /* Nonzero means do not delete tempfiles -- for debugging */
-
-/* Forward declarations of functions in this file */
-
-void decode_command ();
-void sort_in_core ();
-void sort_offline ();
-char **parsefile ();
-char *find_field ();
-char *find_pos ();
-long find_value ();
-char *find_braced_pos ();
-char *find_braced_end ();
-void writelines ();
-int compare_full ();
-long readline ();
-int merge_files ();
-int merge_direct ();
-char *concat ();
-char *maketempname ();
-void flush_tempfiles ();
-char *tempcopy ();
-
-extern char *mktemp ();
-
-#define MAX_IN_CORE_SORT 500000
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int i;
-
- tempcount = 0;
- last_deleted_tempcount = 0;
-
- /* Describe the kind of sorting to do. */
- /* The first keyfield uses the first braced field and folds case */
- keyfields[0].braced = 1;
- keyfields[0].fold_case = 1;
- keyfields[0].endwords = -1;
- keyfields[0].endchars = -1;
- /* The second keyfield uses the second braced field, numerically */
- keyfields[1].braced = 1;
- keyfields[1].numeric = 1;
- keyfields[1].startwords = 1;
- keyfields[1].endwords = -1;
- keyfields[1].endchars = -1;
- /* The third keyfield (which is ignored while discarding duplicates)
- compares the whole line */
- keyfields[2].endwords = -1;
- keyfields[2].endchars = -1;
-
- decode_command (argc, argv);
-
- tempbase = mktemp (concat ("txiXXXXXX", "", ""));
-
- /* Process input files completely, one by one. */
-
- for (i = 0; i < num_infiles; i++)
- {
- int desc;
- long ptr;
- char *outfile;
- char *p;
-
- desc = open (infiles[i], 0, 0);
- if (desc < 0) pfatal_with_name (infiles[i]);
- lseek (desc, 0, L_XTND);
- ptr = tell (desc);
- close (desc);
-
- outfile = outfiles[i];
- if (!outfile)
- {
- outfile = concat (infiles[i], "s", "");
- }
-
- if (ptr < MAX_IN_CORE_SORT)
- /* Sort a small amount of data */
- sort_in_core (infiles[i], ptr, outfile);
- else
- sort_offline (infiles[i], ptr, outfile);
- }
-
- flush_tempfiles (tempcount);
- exit (EXIT_SUCCESS);
-}
-
-/* This page decodes the command line arguments to set the parameter variables
- and set up the vector of keyfields and the vector of input files */
-
-void
-decode_command (argc, argv)
- int argc;
- char **argv;
-{
- int i;
- char **ip;
- char **op;
-
- /* Store default values into parameter variables */
-
-#ifdef VMS
- tempdir = "sys$scratch:";
-#else
- tempdir = "/tmp/";
-#endif
-
- keep_tempfiles = 0;
-
- /* Allocate argc input files, which must be enough. */
-
- infiles = (char **) xmalloc (argc * sizeof (char *));
- outfiles = (char **) xmalloc (argc * sizeof (char *));
- ip = infiles;
- op = outfiles;
-
- /* First find all switches that control the default kind-of-sort */
-
- for (i = 1; i < argc; i++)
- {
- int tem = classify_arg (argv[i]);
- char c;
- char *p;
-
- if (tem <= 0)
- {
- *ip++ = argv[i];
- *op++ = 0;
- continue;
- }
- if (tem > 1)
- {
- if (i + 1 == argc)
- fatal ("switch %s given with no argument following it", argv[i]);
- else if (!strcmp (argv[i], "-T"))
- tempdir = argv[i + 1];
- else if (!strcmp (argv[i], "-o"))
- *(op - 1) = argv[i + 1];
- i += tem - 1;
- continue;
- }
-
- p = &argv[i][1];
- while (c = *p++)
- switch (c)
- {
- case 'k':
- keep_tempfiles = 1;
- break;
-
- default:
- fatal ("invalid command switch %c", c);
- }
- switchdone: ;
- }
-
- /* Record number of keyfields, terminate list of filenames */
-
- num_infiles = ip - infiles;
- *ip = 0;
-}
-
-/* Return 0 for an argument that is not a switch;
- for a switch, return 1 plus the number of following arguments that the switch swallows.
-*/
-
-int
-classify_arg (arg)
- char *arg;
-{
- if (!strcmp (arg, "-T") || !strcmp (arg, "-o"))
- return 2;
- if (arg[0] == '-')
- return 1;
- return 0;
-}
-
-/* Create a name for a temporary file */
-
-char *
-maketempname (count)
- int count;
-{
- char tempsuffix[10];
- sprintf (tempsuffix, "%d", count);
- return concat (tempdir, tempbase, tempsuffix);
-}
-
-/* Delete all temporary files up to the specified count */
-
-void
-flush_tempfiles (to_count)
- int to_count;
-{
- if (keep_tempfiles) return;
- while (last_deleted_tempcount < to_count)
- unlink (maketempname (++last_deleted_tempcount));
-}
-
-/* Copy an input file into a temporary file, and return the temporary file name */
-
-#define BUFSIZE 1024
-
-char *
-tempcopy (idesc)
- int idesc;
-{
- char *outfile = maketempname (++tempcount);
- int odesc;
- char buffer[BUFSIZE];
-
- odesc = open (outfile, O_WRONLY | O_CREAT, 0666);
-
- if (odesc < 0) pfatal_with_name (outfile);
-
- while (1)
- {
- int nread = read (idesc, buffer, BUFSIZE);
- write (odesc, buffer, nread);
- if (!nread) break;
- }
-
- close (odesc);
-
- return outfile;
-}
-
-/* Compare two lines, provided as pointers to pointers to text,
- according to the specified set of keyfields */
-
-int
-compare_full (line1, line2)
- char **line1, **line2;
-{
- int i;
-
- /* Compare using the first keyfield;
- if that does not distinguish the lines, try the second keyfield; and so on. */
-
- for (i = 0; i < num_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], *line1, &length1);
- char *start2 = find_field (&keyfields[i], *line2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, *line1 - text_base,
- start2, length2, *line2 - text_base);
- if (tem)
- {
- if (keyfields[i].reverse)
- return - tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly */
-}
-
-/* Compare two lines described by structures
- in which the first keyfield is identified in advance.
- For positional sorting, assumes that the order of the lines in core
- reflects their nominal order. */
-
-int
-compare_prepared (line1, line2)
- struct lineinfo *line1, *line2;
-{
- int i;
- int tem;
- char *text1, *text2;
-
- /* Compare using the first keyfield, which has been found for us already */
- if (keyfields->positional)
- {
- if (line1->text - text_base > line2->text - text_base)
- tem = 1;
- else
- tem = -1;
- }
- else if (keyfields->numeric)
- tem = line1->key.number - line2->key.number;
- else
- tem = compare_field (keyfields, line1->key.text, line1->keylen, 0, line2->key.text, line2->keylen, 0);
- if (tem)
- {
- if (keyfields->reverse)
- return - tem;
- return tem;
- }
-
- text1 = line1->text;
- text2 = line2->text;
-
- /* Compare using the second keyfield;
- if that does not distinguish the lines, try the third keyfield; and so on. */
-
- for (i = 1; i < num_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], text1, &length1);
- char *start2 = find_field (&keyfields[i], text2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, text1 - text_base,
- start2, length2, text2 - text_base);
- if (tem)
- {
- if (keyfields[i].reverse)
- return - tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly */
-}
-
-/* Like compare_full but more general.
- You can pass any strings, and you can say how many keyfields to use.
- `pos1' and `pos2' should indicate the nominal positional ordering of
- the two lines in the input. */
-
-int
-compare_general (str1, str2, pos1, pos2, use_keyfields)
- char *str1, *str2;
- long pos1, pos2;
- int use_keyfields;
-{
- int i;
-
- /* Compare using the first keyfield;
- if that does not distinguish the lines, try the second keyfield; and so on. */
-
- for (i = 0; i < use_keyfields; i++)
- {
- long length1, length2;
- char *start1 = find_field (&keyfields[i], str1, &length1);
- char *start2 = find_field (&keyfields[i], str2, &length2);
- int tem = compare_field (&keyfields[i], start1, length1, pos1, start2, length2, pos2);
- if (tem)
- {
- if (keyfields[i].reverse)
- return - tem;
- return tem;
- }
- }
-
- return 0; /* Lines match exactly */
-}
-
-/* Find the start and length of a field in `str' according to `keyfield'.
- A pointer to the starting character is returned, and the length
- is stored into the int that `lengthptr' points to. */
-
-char *
-find_field (keyfield, str, lengthptr)
- struct keyfield *keyfield;
- char *str;
- long *lengthptr;
-{
- char *start;
- char *end;
- char *(*fun) ();
-
- if (keyfield->braced) fun = find_braced_pos;
- else fun = find_pos;
-
- start = ( *fun )(str, keyfield->startwords, keyfield->startchars,
- keyfield->ignore_blanks);
- if (keyfield->endwords < 0)
- {
- if (keyfield->braced)
- end = find_braced_end (start);
- else
- {
- end = start;
- while (*end && *end != '\n') end++;
- }
- }
- else
- {
- end = ( *fun )(str, keyfield->endwords, keyfield->endchars, 0);
- if (end - str < start - str) end = start;
- }
- *lengthptr = end - start;
- return start;
-}
-
-/* Find a pointer to a specified place within `str',
- skipping (from the beginning) `words' words and then `chars' chars.
- If `ignore_blanks' is nonzero, we skip all blanks
- after finding the specified word. */
-
-char *
-find_pos (str, words, chars, ignore_blanks)
- char *str;
- int words, chars;
- int ignore_blanks;
-{
- int i;
- char *p = str;
-
- for (i = 0; i < words; i++)
- {
- char c;
- /* Find next bunch of nonblanks and skip them. */
- while ((c = *p) == ' ' || c == '\t') p++;
- while ((c = *p) && c != '\n' && !(c == ' ' || c == '\t')) p++;
- if (!*p || *p == '\n') return p;
- }
-
- while (*p == ' ' || *p == '\t') p++;
-
- for (i = 0; i < chars; i++)
- {
- if (!*p || *p == '\n') break;
- p++;
- }
- return p;
-}
-
-/* Like find_pos but assumes that each field is surrounded by braces
- and that braces within fields are balanced. */
-
-char *
-find_braced_pos (str, words, chars, ignore_blanks)
- char *str;
- int words, chars;
- int ignore_blanks;
-{
- int i;
- int bracelevel;
- char *p = str;
- char c;
-
- for (i = 0; i < words; i++)
- {
- bracelevel = 1;
- while ((c = *p++) != '{' && c != '\n' && c);
- if (c != '{')
- return p - 1;
- while (bracelevel)
- {
- c = *p++;
- if (c == '{') bracelevel++;
- if (c == '}') bracelevel--;
-#if 0
- if (c == '\\' || c == '@') c = *p++; /* \ quotes braces and \ */
-#endif
- if (c == 0 || c == '\n') return p-1;
- }
- }
-
- while ((c = *p++) != '{' && c != '\n' && c);
-
- if (c != '{')
- return p-1;
-
- if (ignore_blanks)
- while ((c = *p) == ' ' || c == '\t') p++;
-
- for (i = 0; i < chars; i++)
- {
- if (!*p || *p == '\n') break;
- p++;
- }
- return p;
-}
-
-/* Find the end of the balanced-brace field which starts at `str'.
- The position returned is just before the closing brace. */
-
-char *
-find_braced_end (str)
- char *str;
-{
- int bracelevel;
- char *p = str;
- char c;
-
- bracelevel = 1;
- while (bracelevel)
- {
- c = *p++;
- if (c == '{') bracelevel++;
- if (c == '}') bracelevel--;
-#if 0
- if (c == '\\' || c == '@') c = *p++;
-#endif
- if (c == 0 || c == '\n') return p-1;
- }
- return p - 1;
-}
-
-long
-find_value (start, length)
- char *start;
- long length;
-{
- while (length != 0L) {
- if (isdigit(*start))
- return atol(start);
- length--;
- start++;
- }
- return 0l;
-}
-
-/* Vector used to translate characters for comparison.
- This is how we make all alphanumerics follow all else,
- and ignore case in the first sorting. */
-int char_order[256];
-
-init_char_order ()
-{
- int i;
- for (i = 1; i < 256; i++)
- char_order[i] = i;
-
- for (i = '0'; i <= '9'; i++)
- char_order[i] += 512;
-
- for (i = 'a'; i <= 'z'; i++) {
- char_order[i] = 512 + i;
- char_order[i + 'A' - 'a'] = 512 + i;
- }
-}
-
-/* Compare two fields (each specified as a start pointer and a character count)
- according to `keyfield'. The sign of the value reports the relation between the fields */
-
-int
-compare_field (keyfield, start1, length1, pos1, start2, length2, pos2)
- struct keyfield *keyfield;
- char *start1;
- long length1;
- long pos1;
- char *start2;
- long length2;
- long pos2;
-{
- if (keyfields->positional)
- {
- if (pos1 > pos2)
- return 1;
- else
- return -1;
- }
- if (keyfield->numeric)
- {
- long value = find_value (start1, length1) - find_value (start2, length2);
- if (value > 0) return 1;
- if (value < 0) return -1;
- return 0;
- }
- else
- {
- char *p1 = start1;
- char *p2 = start2;
- char *e1 = start1 + length1;
- char *e2 = start2 + length2;
-
- int fold_case = keyfield->fold_case;
-
- while (1)
- {
- int c1, c2;
-
- if (p1 == e1) c1 = 0;
- else c1 = *p1++;
- if (p2 == e2) c2 = 0;
- else c2 = *p2++;
-
- if (char_order[c1] != char_order[c2])
- return char_order[c1] - char_order[c2];
- if (!c1) break;
- }
-
- /* Strings are equal except possibly for case. */
- p1 = start1;
- p2 = start2;
- while (1)
- {
- int c1, c2;
-
- if (p1 == e1) c1 = 0;
- else c1 = *p1++;
- if (p2 == e2) c2 = 0;
- else c2 = *p2++;
-
- if (c1 != c2)
- /* Reverse sign here so upper case comes out last. */
- return c2 - c1;
- if (!c1) break;
- }
-
- return 0;
- }
-}
-
-/* A `struct linebuffer' is a structure which holds a line of text.
- `readline' reads a line from a stream into a linebuffer
- and works regardless of the length of the line. */
-
-struct linebuffer
- {
- long size;
- char *buffer;
- };
-
-/* Initialize a linebuffer for use */
-
-void
-initbuffer (linebuffer)
- struct linebuffer *linebuffer;
-{
- linebuffer->size = 200;
- linebuffer->buffer = (char *) xmalloc (200);
-}
-
-/* Read a line of text from `stream' into `linebuffer'.
- Return the length of the line. */
-
-long
-readline (linebuffer, stream)
- struct linebuffer *linebuffer;
- FILE *stream;
-{
- char *buffer = linebuffer->buffer;
- char *p = linebuffer->buffer;
- char *end = p + linebuffer->size;
-
- while (1)
- {
- int c = getc (stream);
- if (p == end)
- {
- buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
- p += buffer - linebuffer->buffer;
- end += buffer - linebuffer->buffer;
- linebuffer->buffer = buffer;
- }
- if (c < 0 || c == '\n')
- {
- *p = 0;
- break;
- }
- *p++ = c;
- }
-
- return p - buffer;
-}
-
-/* Sort an input file too big to sort in core. */
-
-void
-sort_offline (infile, nfiles, total, outfile)
- char *infile;
- long total;
- char *outfile;
-{
- int ntemps = 2 * (total + MAX_IN_CORE_SORT - 1) / MAX_IN_CORE_SORT; /* More than enough */
- char **tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
- FILE *istream = fopen (infile, "r");
- int i;
- struct linebuffer lb;
- long linelength;
- int failure = 0;
-
- initbuffer (&lb);
-
- /* Read in one line of input data. */
-
- linelength = readline (&lb, istream);
-
- if (lb.buffer[0] != '\\' && lb.buffer[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- /* Split up the input into `ntemps' temporary files, or maybe fewer,
- and put the new files' names into `tempfiles' */
-
- for (i = 0; i < ntemps; i++)
- {
- char *outname = maketempname (++tempcount);
- FILE *ostream = fopen (outname, "w");
- long tempsize = 0;
-
- if (!ostream) pfatal_with_name (outname);
- tempfiles[i] = outname;
-
- /* Copy lines into this temp file as long as it does not make file "too big"
- or until there are no more lines. */
-
- while (tempsize + linelength + 1 <= MAX_IN_CORE_SORT)
- {
- tempsize += linelength + 1;
- fputs (lb.buffer, ostream);
- putc ('\n', ostream);
-
- /* Read another line of input data. */
-
- linelength = readline (&lb, istream);
- if (!linelength && feof (istream)) break;
-
- if (lb.buffer[0] != '\\' && lb.buffer[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- failure = 1;
- goto fail;
- }
- }
- fclose (ostream);
- if (feof (istream)) break;
- }
-
- free (lb.buffer);
-
- fail:
- /* Record number of temp files we actually needed. */
-
- ntemps = i;
-
- /* Sort each tempfile into another tempfile.
- Delete the first set of tempfiles and put the names of the second into `tempfiles' */
-
- for (i = 0; i < ntemps; i++)
- {
- char *newtemp = maketempname (++tempcount);
- sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp);
- if (!keep_tempfiles)
- unlink (tempfiles[i]);
- tempfiles[i] = newtemp;
- }
-
- if (failure)
- return;
-
- /* Merge the tempfiles together and indexify */
-
- merge_files (tempfiles, ntemps, outfile);
-}
-
-/* Sort `infile', whose size is `total',
- assuming that is small enough to be done in-core,
- then indexify it and send the output to `outfile' (or to stdout). */
-
-void
-sort_in_core (infile, total, outfile)
- char *infile;
- long total;
- char *outfile;
-{
- char **nextline;
- char *data = (char *) xmalloc (total + 1);
- char *file_data;
- long file_size;
- int i;
- FILE *ostream = stdout;
- struct lineinfo *lineinfo;
-
- /* Read the contents of the file into the moby array `data' */
-
- int desc = open (infile, 0, 0);
-
- if (desc < 0)
- fatal ("failure reopening %s", infile);
- for (file_size = 0; ; )
- {
- if ((i = read (desc, data + file_size, total - file_size)) <= 0)
- break;
- file_size += i;
- }
- file_data = data;
- data[file_size] = 0;
-
- close (desc);
-
- if (file_size > 0 && data[0] != '\\' && data[0] != '@')
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- init_char_order ();
-
- /* Sort routines want to know this address */
-
- text_base = data;
-
- /* Create the array of pointers to lines, with a default size frequently enough. */
-
- nlines = total / 50;
- if (!nlines) nlines = 2;
- linearray = (char **) xmalloc (nlines * sizeof (char *));
-
- /* `nextline' points to the next free slot in this array.
- `nlines' is the allocated size. */
-
- nextline = linearray;
-
- /* Parse the input file's data, and make entries for the lines. */
-
- nextline = parsefile (infile, nextline, file_data, file_size);
- if (nextline == 0)
- {
- error ("%s: not a texinfo index file", infile);
- return;
- }
-
- /* Sort the lines */
-
- /* If we have enough space, find the first keyfield of each line in advance.
- Make a `struct lineinfo' for each line, which records the keyfield
- as well as the line, and sort them. */
-
- lineinfo = (struct lineinfo *) malloc ((nextline - linearray) * sizeof (struct lineinfo));
-
- if (lineinfo)
- {
- struct lineinfo *lp;
- char **p;
-
- for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
- {
- lp->text = *p;
- lp->key.text = find_field (keyfields, *p, &lp->keylen);
- if (keyfields->numeric)
- lp->key.number = find_value (lp->key.text, lp->keylen);
- }
-
- qsort (lineinfo, nextline - linearray, sizeof (struct lineinfo), compare_prepared);
-
- for (lp = lineinfo, p = linearray; p != nextline; lp++, p++)
- *p = lp->text;
-
- free (lineinfo);
- }
- else
- qsort (linearray, nextline - linearray, sizeof (char *), compare_full);
-
- /* Open the output file */
-
- if (outfile)
- {
- ostream = fopen (outfile, "w");
- if (!ostream)
- pfatal_with_name (outfile);
- }
-
- writelines (linearray, nextline - linearray, ostream);
- if (outfile) fclose (ostream);
-
- free (linearray);
- free (data);
-}
-
-/* Parse an input string in core into lines.
- DATA is the input string, and SIZE is its length.
- Data goes in LINEARRAY starting at NEXTLINE.
- The value returned is the first entry in LINEARRAY still unused.
- Value 0 means input file contents are invalid. */
-
-char **
-parsefile (filename, nextline, data, size)
- char *filename;
- char **nextline;
- char *data;
- long size;
-{
- char *p, *end;
- char **line = nextline;
-
- p = data;
- end = p + size;
- *end = 0;
-
- while (p != end)
- {
- if (p[0] != '\\' && p[0] != '@')
- return 0;
-
- *line = p;
- while (*p && *p != '\n') p++;
- if (p != end) p++;
-
- line++;
- if (line == linearray + nlines)
- {
- char **old = linearray;
- linearray = (char **) xrealloc (linearray, sizeof (char *) * (nlines *= 4));
- line += linearray - old;
- }
- }
-
- return line;
-}
-
-/* Indexification is a filter applied to the sorted lines
- as they are being written to the output file.
- Multiple entries for the same name, with different page numbers,
- get combined into a single entry with multiple page numbers.
- The first braced field, which is used for sorting, is discarded.
- However, its first character is examined, folded to lower case,
- and if it is different from that in the previous line fed to us
- a \initial line is written with one argument, the new initial.
-
- If an entry has four braced fields, then the second and third
- constitute primary and secondary names.
- In this case, each change of primary name
- generates a \primary line which contains only the primary name,
- and in between these are \secondary lines which contain
- just a secondary name and page numbers.
-*/
-
-/* The last primary name we wrote a \primary entry for.
- If only one level of indexing is being done, this is the last name seen */
-char *lastprimary;
-int lastprimarylength; /* Length of storage allocated for lastprimary */
-
-/* Similar, for the secondary name. */
-char *lastsecondary;
-int lastsecondarylength;
-
-/* Zero if we are not in the middle of writing an entry.
- One if we have written the beginning of an entry but have not
- yet written any page numbers into it.
- Greater than one if we have written the beginning of an entry
- plus at least one page number. */
-int pending;
-
-/* The initial (for sorting purposes) of the last primary entry written.
- When this changes, a \initial {c} line is written */
-
-char * lastinitial;
-
-int lastinitiallength;
-
-/* When we need a string of length 1 for the value of lastinitial,
- store it here. */
-
-char lastinitial1[2];
-
-/* Initialize static storage for writing an index */
-
-void
-init_index ()
-{
- pending = 0;
- lastinitial = lastinitial1;
- lastinitial1[0] = 0;
- lastinitial1[1] = 0;
- lastinitiallength = 0;
- lastprimarylength = 100;
- lastprimary = (char *) xmalloc (lastprimarylength + 1);
- bzero (lastprimary, lastprimarylength + 1);
- lastsecondarylength = 100;
- lastsecondary = (char *) xmalloc (lastsecondarylength + 1);
- bzero (lastsecondary, lastsecondarylength + 1);
-}
-
-/* Indexify. Merge entries for the same name,
- insert headers for each initial character, etc. */
-
-indexify (line, ostream)
- char *line;
- FILE *ostream;
-{
- char *primary, *secondary, *pagenumber;
- int primarylength, secondarylength, pagelength;
- int len = strlen (line);
- int nosecondary;
- int initiallength;
- char *initial;
- char initial1[2];
- register char *p;
-
- /* First, analyze the parts of the entry fed to us this time */
-
- p = find_braced_pos (line, 0, 0, 0);
- if (*p == '{')
- {
- initial = p;
- /* Get length of inner pair of braces starting at p,
- including that inner pair of braces. */
- initiallength = find_braced_end (p + 1) + 1 - p;
- }
- else
- {
- initial = initial1;
- initial1[0] = *p;
- initial1[1] = 0;
- initiallength = 1;
-
- if (initial1[0] >= 'a' && initial1[0] <= 'z')
- initial1[0] -= 040;
- }
-
- pagenumber = find_braced_pos (line, 1, 0, 0);
- pagelength = find_braced_end (pagenumber) - pagenumber;
- if (pagelength == 0)
- abort ();
-
- primary = find_braced_pos (line, 2, 0, 0);
- primarylength = find_braced_end (primary) - primary;
-
- secondary = find_braced_pos (line, 3, 0, 0);
- nosecondary = !*secondary;
- if (!nosecondary)
- secondarylength = find_braced_end (secondary) - secondary;
-
- /* If the primary is different from before, make a new primary entry */
- if (strncmp (primary, lastprimary, primarylength))
- {
- /* Close off current secondary entry first, if one is open */
- if (pending)
- {
- fputs ("}\n", ostream);
- pending = 0;
- }
-
- /* If this primary has a different initial, include an entry for the initial */
- if (initiallength != lastinitiallength ||
- strncmp (initial, lastinitial, initiallength))
- {
- fprintf (ostream, "\\initial {");
- fwrite (initial, 1, initiallength, ostream);
- fprintf (ostream, "}\n", initial);
- if (initial == initial1)
- {
- lastinitial = lastinitial1;
- *lastinitial1 = *initial1;
- }
- else
- {
- lastinitial = initial;
- }
- lastinitiallength = initiallength;
- }
-
- /* Make the entry for the primary. */
- if (nosecondary)
- fputs ("\\entry {", ostream);
- else
- fputs ("\\primary {", ostream);
- fwrite (primary, primarylength, 1, ostream);
- if (nosecondary)
- {
- fputs ("}{", ostream);
- pending = 1;
- }
- else
- fputs ("}\n", ostream);
-
- /* Record name of most recent primary */
- if (lastprimarylength < primarylength)
- {
- lastprimarylength = primarylength + 100;
- lastprimary = (char *) xrealloc (lastprimary,
- 1 + lastprimarylength);
- }
- strncpy (lastprimary, primary, primarylength);
- lastprimary[primarylength] = 0;
-
- /* There is no current secondary within this primary, now */
- lastsecondary[0] = 0;
- }
-
- /* Should not have an entry with no subtopic following one with a subtopic */
-
- if (nosecondary && *lastsecondary)
- error ("entry %s follows an entry with a secondary name", line);
-
- /* Start a new secondary entry if necessary */
- if (!nosecondary && strncmp (secondary, lastsecondary, secondarylength))
- {
- if (pending)
- {
- fputs ("}\n", ostream);
- pending = 0;
- }
-
- /* Write the entry for the secondary. */
- fputs ("\\secondary {", ostream);
- fwrite (secondary, secondarylength, 1, ostream);
- fputs ("}{", ostream);
- pending = 1;
-
- /* Record name of most recent secondary */
- if (lastsecondarylength < secondarylength)
- {
- lastsecondarylength = secondarylength + 100;
- lastsecondary = (char *) xrealloc (lastsecondary,
- 1 + lastsecondarylength);
- }
- strncpy (lastsecondary, secondary, secondarylength);
- lastsecondary[secondarylength] = 0;
- }
-
- /* Here to add one more page number to the current entry */
- if (pending++ != 1)
- fputs (", ", ostream); /* Punctuate first, if this is not the first */
- fwrite (pagenumber, pagelength, 1, ostream);
-}
-
-/* Close out any unfinished output entry */
-
-void
-finish_index (ostream)
- FILE *ostream;
-{
- if (pending)
- fputs ("}\n", ostream);
- free (lastprimary);
- free (lastsecondary);
-}
-
-/* Copy the lines in the sorted order.
- Each line is copied out of the input file it was found in. */
-
-void
-writelines (linearray, nlines, ostream)
- char **linearray;
- int nlines;
- FILE *ostream;
-{
- char **stop_line = linearray + nlines;
- char **next_line;
-
- init_index ();
-
- /* Output the text of the lines, and free the buffer space */
-
- for (next_line = linearray; next_line != stop_line; next_line++)
- {
- /* If -u was specified, output the line only if distinct from previous one. */
- if (next_line == linearray
- /* Compare previous line with this one, using only the explicitly specd keyfields */
- || compare_general (*(next_line - 1), *next_line, 0L, 0L, num_keyfields - 1))
- {
- char *p = *next_line;
- char c;
- while ((c = *p++) && c != '\n');
- *(p-1) = 0;
- indexify (*next_line, ostream);
- }
- }
-
- finish_index (ostream);
-}
-
-/* Assume (and optionally verify) that each input file is sorted;
- merge them and output the result.
- Returns nonzero if any input file fails to be sorted.
-
- This is the high-level interface that can handle an unlimited number of files. */
-
-#define MAX_DIRECT_MERGE 10
-
-int
-merge_files (infiles, nfiles, outfile)
- char **infiles;
- int nfiles;
- char *outfile;
-{
- char **tempfiles;
- int ntemps;
- int i;
- int value = 0;
- int start_tempcount = tempcount;
-
- if (nfiles <= MAX_DIRECT_MERGE)
- return merge_direct (infiles, nfiles, outfile);
-
- /* Merge groups of MAX_DIRECT_MERGE input files at a time,
- making a temporary file to hold each group's result. */
-
- ntemps = (nfiles + MAX_DIRECT_MERGE - 1) / MAX_DIRECT_MERGE;
- tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
- for (i = 0; i < ntemps; i++)
- {
- int nf = MAX_DIRECT_MERGE;
- if (i + 1 == ntemps)
- nf = nfiles - i * MAX_DIRECT_MERGE;
- tempfiles[i] = maketempname (++tempcount);
- value |= merge_direct (&infiles[i * MAX_DIRECT_MERGE], nf, tempfiles[i]);
- }
-
- /* All temporary files that existed before are no longer needed
- since their contents have been merged into our new tempfiles.
- So delete them. */
- flush_tempfiles (start_tempcount);
-
- /* Now merge the temporary files we created. */
-
- merge_files (tempfiles, ntemps, outfile);
-
- free (tempfiles);
-
- return value;
-}
-
-/* Assume (and optionally verify) that each input file is sorted;
- merge them and output the result.
- Returns nonzero if any input file fails to be sorted.
-
- This version of merging will not work if the number of
- input files gets too high. Higher level functions
- use it only with a bounded number of input files. */
-
-int
-merge_direct (infiles, nfiles, outfile)
- char **infiles;
- int nfiles;
- char *outfile;
-{
- char **ip = infiles;
- struct linebuffer *lb1, *lb2;
- struct linebuffer **thisline, **prevline;
- FILE **streams;
- int i;
- int nleft;
- int lossage = 0;
- int *file_lossage;
- struct linebuffer *prev_out = 0;
- FILE *ostream = stdout;
-
- if (outfile)
- {
- ostream = fopen (outfile, "w");
- }
- if (!ostream) pfatal_with_name (outfile);
-
- init_index ();
-
- if (nfiles == 0)
- {
- if (outfile)
- fclose (ostream);
- return 0;
- }
-
- /* For each file, make two line buffers.
- Also, for each file, there is an element of `thisline'
- which points at any time to one of the file's two buffers,
- and an element of `prevline' which points to the other buffer.
- `thisline' is supposed to point to the next available line from the file,
- while `prevline' holds the last file line used,
- which is remembered so that we can verify that the file is properly sorted. */
-
- /* lb1 and lb2 contain one buffer each per file */
- lb1 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
- lb2 = (struct linebuffer *) xmalloc (nfiles * sizeof (struct linebuffer));
-
- /* thisline[i] points to the linebuffer holding the next available line in file i,
- or is zero if there are no lines left in that file. */
- thisline = (struct linebuffer **) xmalloc (nfiles * sizeof (struct linebuffer *));
- /* prevline[i] points to the linebuffer holding the last used line from file i.
- This is just for verifying that file i is properly sorted. */
- prevline = (struct linebuffer **) xmalloc (nfiles * sizeof (struct linebuffer *));
- /* streams[i] holds the input stream for file i. */
- streams = (FILE **) xmalloc (nfiles * sizeof (FILE *));
- /* file_lossage[i] is nonzero if we already know file i is not properly sorted. */
- file_lossage = (int *) xmalloc (nfiles * sizeof (int));
-
- /* Allocate and initialize all that storage */
-
- for (i = 0; i < nfiles; i++)
- {
- initbuffer (&lb1[i]);
- initbuffer (&lb2[i]);
- thisline[i] = &lb1[i];
- prevline[i] = &lb2[i];
- file_lossage[i] = 0;
- streams[i] = fopen (infiles[i], "r");
- if (!streams[i])
- pfatal_with_name (infiles[i]);
-
- readline (thisline[i], streams[i]);
- }
-
- /* Keep count of number of files not at eof */
- nleft = nfiles;
-
- while (nleft)
- {
- struct linebuffer *best = 0;
- struct linebuffer *exch;
- int bestfile = -1;
- int i;
-
- /* Look at the next avail line of each file; choose the least one. */
-
- for (i = 0; i < nfiles; i++)
- {
- if (thisline[i] &&
- (!best ||
- 0 < compare_general (best->buffer, thisline[i]->buffer,
- (long) bestfile, (long) i, num_keyfields)))
- {
- best = thisline[i];
- bestfile = i;
- }
- }
-
- /* Output that line, unless it matches the previous one and we don't want duplicates */
-
- if (!(prev_out &&
- !compare_general (prev_out->buffer, best->buffer, 0L, 1L, num_keyfields - 1)))
- indexify (best->buffer, ostream);
- prev_out = best;
-
- /* Now make the line the previous of its file, and fetch a new line from that file */
-
- exch = prevline[bestfile];
- prevline[bestfile] = thisline[bestfile];
- thisline[bestfile] = exch;
-
- while (1)
- {
- /* If the file has no more, mark it empty */
-
- if (feof (streams[bestfile]))
- {
- thisline[bestfile] = 0;
- nleft--; /* Update the number of files still not empty */
- break;
- }
- readline (thisline[bestfile], streams[bestfile]);
- if (thisline[bestfile]->buffer[0] || !feof (streams[bestfile])) break;
- }
- }
-
- finish_index (ostream);
-
- /* Free all storage and close all input streams */
-
- for (i = 0; i < nfiles; i++)
- {
- fclose (streams[i]);
- free (lb1[i].buffer);
- free (lb2[i].buffer);
- }
- free (file_lossage);
- free (lb1);
- free (lb2);
- free (thisline);
- free (prevline);
- free (streams);
-
- if (outfile)
- fclose (ostream);
-
- return lossage;
-}
-
-/* Print error message and exit. */
-
-fatal (s1, s2)
- char *s1, *s2;
-{
- error (s1, s2);
- exit (EXIT_FATAL);
-}
-
-/* Print error message. `s1' is printf control string, `s2' is arg for it. */
-
-error (s1, s2)
- char *s1, *s2;
-{
- printf ("texindex: ");
- printf (s1, s2);
- printf ("\n");
-}
-
-perror_with_name (name)
- char *name;
-{
- char *s;
-
- if (errno < sys_nerr)
- s = concat ("", sys_errlist[errno], " for %s");
- else
- s = "cannot open %s";
- error (s, name);
-}
-
-pfatal_with_name (name)
- char *name;
-{
- char *s;
-
- if (errno < sys_nerr)
- s = concat ("", sys_errlist[errno], " for %s");
- else
- s = "cannot open %s";
- fatal (s, name);
-}
-
-/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
-
-char *
-concat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
-
- strcpy (result, s1);
- strcpy (result + len1, s2);
- strcpy (result + len1 + len2, s3);
- *(result + len1 + len2 + len3) = 0;
-
- return result;
-}
-
-/* Like malloc but get fatal error if memory is exhausted. */
-
-int
-xmalloc (size)
- int size;
-{
- int result = malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
-}
-
-
-int
-xrealloc (ptr, size)
- char *ptr;
- int size;
-{
- int result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-bzero (b, length)
- register char *b;
- register int length;
-{
-#ifdef VMS
- short zero = 0;
- long max_str = 65535;
- long len;
-
- while (length > max_str)
- {
- (void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
- length -= max_str;
- b += max_str;
- }
- len = length;
- (void) LIB$MOVC5 (&zero, &zero, &zero, &len, b);
-#else
- while (length-- > 0)
- *b++ = 0;
-#endif /* not VMS */
-}
diff --git a/readline/examples/Makefile b/readline/examples/Makefile
deleted file mode 100644
index 3d1fc52..0000000
--- a/readline/examples/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# This is the Makefile for the examples subdirectory of readline. -*- text -*-
-#
-
-EXECUTABLES = fileman
-CFLAGS = -g -I../..
-LDFLAGS = -g -L..
-
-fileman: fileman.o
- $(CC) $(LDFLAGS) -o fileman fileman.o -lreadline -ltermcap
-
-fileman.o: fileman.c
-
diff --git a/readline/examples/histexamp.c b/readline/examples/histexamp.c
new file mode 100644
index 0000000..eceb66d
--- /dev/null
+++ b/readline/examples/histexamp.c
@@ -0,0 +1,82 @@
+main ()
+{
+ char line[1024], *t;
+ int len, done = 0;
+
+ line[0] = 0;
+
+ using_history ();
+ while (!done)
+ {
+ printf ("history$ ");
+ fflush (stdout);
+ t = fgets (line, sizeof (line) - 1, stdin);
+ if (t && *t)
+ {
+ len = strlen (t);
+ if (t[len - 1] == '\n')
+ t[len - 1] = '\0';
+ }
+
+ if (!t)
+ strcpy (line, "quit");
+
+ if (line[0])
+ {
+ char *expansion;
+ int result;
+
+ using_history ();
+
+ result = history_expand (line, &expansion);
+ if (result)
+ fprintf (stderr, "%s\n", expansion);
+
+ if (result < 0 || result == 2)
+ {
+ free (expansion);
+ continue;
+ }
+
+ add_history (expansion);
+ strncpy (line, expansion, sizeof (line) - 1);
+ free (expansion);
+ }
+
+ if (strcmp (line, "quit") == 0)
+ done = 1;
+ else if (strcmp (line, "save") == 0)
+ write_history ("history_file");
+ else if (strcmp (line, "read") == 0)
+ read_history ("history_file");
+ else if (strcmp (line, "list") == 0)
+ {
+ register HIST_ENTRY **the_list;
+ register int i;
+
+ the_list = history_list ();
+ if (the_list)
+ for (i = 0; the_list[i]; i++)
+ printf ("%d: %s\n", i + history_base, the_list[i]->line);
+ }
+ else if (strncmp (line, "delete", 6) == 0)
+ {
+ int which;
+ if ((sscanf (line + 6, "%d", &which)) == 1)
+ {
+ HIST_ENTRY *entry = remove_history (which);
+ if (!entry)
+ fprintf (stderr, "No such entry %d\n", which);
+ else
+ {
+ free (entry->line);
+ free (entry);
+ }
+ }
+ else
+ {
+ fprintf (stderr, "non-numeric arg given to `delete'\n");
+ }
+ }
+ }
+}
diff --git a/readline/history.texi b/readline/history.texi
deleted file mode 100755
index 5fd9125..0000000
--- a/readline/history.texi
+++ /dev/null
@@ -1,202 +0,0 @@
-\input texinfo.tex
-@setfilename history.info
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* History: (history). The GNU History library.
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-
-@ifinfo
-This file documents the GNU History library.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-Authored by Brian Fox.
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ifinfo
-
-@node Top, Introduction, , (DIR)
-
-This document describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-@menu
-* Introduction:: What is the GNU History library for?
-* Interactive Use:: What it feels like using History as a user.
-* Programming:: How to use History in your programs.
-@end menu
-
-@node Introduction, Interactive Use, Top, Top
-@unnumbered Introduction
-
-Many programs read input from the user a line at a time. The GNU history
-library is able to keep track of those lines, associate arbitrary data with
-each line, and utilize information from previous lines in making up new
-ones.
-
-The programmer using the History library has available to him functions for
-remembering lines on a history stack, associating arbitrary data with a
-line, removing lines from the stack, searching through the stack for a
-line containing an arbitrary text string, and referencing any line on the
-stack directly. In addition, a history @dfn{expansion} function is
-available which provides for a consistent user interface across many
-different programs.
-
-The end-user using programs written with the History library has the
-benifit of a consistent user interface, with a set of well-known commands
-for manipulating the text of previous lines and using that text in new
-commands. The basic history manipulation commands are similar to the
-history substitution used by Csh.
-
-If the programmer desires, he can use the Readline library, which includes
-history manipulation by default, and has the added advantage of Emacs style
-command line editing.
-
-@node Interactive Use, Programming, Introduction, Top
-@chapter Interactive Use
-
-@section History Expansion
-@cindex expansion
-
-The History library provides a history expansion feature that is similar to
-the history expansion in Csh. The following text describes what syntax
-features are available.
-
-History expansion takes place in two parts. The first is to determine
-which line from the previous history should be used during substitution.
-The second is to select portions of that line for inclusion into the
-current one. The line selected from the previous history is called the
-@dfn{event}, and the portions of that line that are acted upon are called
-@dfn{words}. The line is broken into words in the same fashion that the
-Bash shell does, so that several English (or Unix) words surrounded by
-quotes are considered as one word.
-
-@menu
-* Event Designators:: How to specify which history line to use.
-* Word Designators:: Specifying which words are of interest.
-* Modifiers:: Modifying the results of susbstitution.
-@end menu
-
-@node Event Designators, Word Designators, , Interactive Use
-@subsection Event Designators
-@cindex event designators
-
-An event designator is a reference to a command line entry in the history
-list.
-
-@table @var
-
-@item !
-Start a history subsititution, except when followed by a @key{SPC},
-@key{TAB}, @key{RET}, @key{=} or @key{(}.
-
-@item !!
-Refer to the previous command. This is a synonym for @code{!-1}.
-
-@item !n
-Refer to command line @var{n}.
-
-@item !-n
-Refer to the current command line minus @var{n}.
-
-@item !string
-Refer to the most recent command starting with @var{string}.
-
-@item !?string[?]
-Refer to the most recent command containing @var{string}.
-
-@end table
-
-@node Word Designators, Modifiers, Event Designators, Interactive Use
-@subsection Word Designators
-
-A @key{:} separates the event specification from the word designator. It
-can be omitted if the word designator begins with a @key{^}, @key{$},
-@key{*} or @key{%}. Words are numbered from the beginning of the line,
-with the first word being denoted by a 0 (zero).
-
-@table @asis
-
-@item @var{0} (zero)
-The zero'th word. For many applications, this is the command word.
-
-@item n
-The @var{n}'th word.
-
-@item @var{^}
-The first argument. that is, word 1.
-
-@item @var{$}
-The last argument.
-
-@item @var{%}
-The word matched by the most recent @code{?string?} search.
-
-@item @var{x}-@var{y}
-A range of words; @code{-@var{y}} is equivalent to @code{0-@var{y}}.
-
-@item @var{*}
-All of the words, excepting the zero'th. This is a synonym for @samp{1-$}.
-It is not an error to use @samp{*} if there is just one word in the event.
-The empty string is returned in that case.
-
-@end table
-
-@node Modifiers, , Word Designators, Interactive Use
-@subsection Modifiers
-
-After the optional word designator, you can add a sequence of one or more
-of the following modifiers, each preceded by a @key{:}.
-
-@table @code
-
-@item #
-The entire command line typed so far. This means the current command,
-not the previous command, so it really isn't a word designator, and doesn't
-belong in this section.
-
-@item h
-Remove a trailing pathname component, leaving only the head.
-
-@item r
-Remove a trailing suffix of the form ".xxx", leaving the basename (root).
-
-@item e
-Remove all but the suffix (end).
-
-@item t
-Remove all leading pathname components (before the last slash), leaving
-the tail.
-
-@item p
-Print the new command but do not execute it. This takes effect
-immediately, so it should be the last specifier on the line.
-
-@end table
-
-@node Programming, , Interactive Use, Top
-@chapter Programming
-
-@bye
diff --git a/readline/history.texinfo b/readline/history.texinfo
deleted file mode 100755
index 1e619e1..0000000
--- a/readline/history.texinfo
+++ /dev/null
@@ -1,194 +0,0 @@
-\input texinfo.tex
-@setfilename history.info
-
-@ifinfo
-This file documents the GNU History library.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-Authored by Brian Fox.
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-@end ignore
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ifinfo
-
-@node Top, Introduction, , (DIR)
-
-This document describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-@menu
-* Introduction:: What is the GNU History library for?
-* Interactive Use:: What it feels like using History as a user.
-* Programming:: How to use History in your programs.
-@end menu
-
-@node Introduction, Interactive Use, , Top
-@unnumbered Introduction
-
-Many programs read input from the user a line at a time. The GNU history
-library is able to keep track of those lines, associate arbitrary data with
-each line, and utilize information from previous lines in making up new
-ones.
-
-The programmer using the History library has available to him functions for
-remembering lines on a history stack, associating arbitrary data with a
-line, removing lines from the stack, searching through the stack for a
-line containing an arbitrary text string, and referencing any line on the
-stack directly. In addition, a history @dfn{expansion} function is
-available which provides for a consistent user interface across many
-different programs.
-
-The end-user using programs written with the History library has the
-benifit of a consistent user interface, with a set of well-known commands
-for manipulating the text of previous lines and using that text in new
-commands. The basic history manipulation commands are similar to the
-history substitution used by Csh.
-
-If the programmer desires, he can use the Readline library, which includes
-history manipulation by default, and has the added advantage of Emacs style
-command line editing.
-
-@node Interactive Use, Programming, Introduction, Top
-@chapter Interactive Use
-
-@section History Expansion
-@cindex expansion
-
-The History library provides a history expansion feature that is similar to
-the history expansion in Csh. The following text describes what syntax
-features are available.
-
-History expansion takes place in two parts. The first is to determine
-which line from the previous history should be used during substitution.
-The second is to select portions of that line for inclusion into the
-current one. The line selected from the previous history is called the
-@dfn{event}, and the portions of that line that are acted upon are called
-@dfn{words}. The line is broken into words in the same fashion that the
-Bash shell does, so that several English (or Unix) words surrounded by
-quotes are considered as one word.
-
-@menu
-* Event Designators:: How to specify which history line to use.
-* Word Designators:: Specifying which words are of interest.
-* Modifiers:: Modifying the results of susbstitution.
-@end menu
-
-@node Event Designators, Word Designators, , Interactive Use
-@subsection Event Designators
-@cindex event designators
-
-An event designator is a reference to a command line entry in the history
-list.
-
-@table @var
-
-@item !
-Start a history subsititution, except when followed by a @key{SPC},
-@key{TAB}, @key{RET}, @key{=} or @key{(}.
-
-@item !!
-Refer to the previous command. This is a synonym for @code{!-1}.
-
-@item !n
-Refer to command line @var{n}.
-
-@item !-n
-Refer to the current command line minus @var{n}.
-
-@item !string
-Refer to the most recent command starting with @var{string}.
-
-@item !?string[?]
-Refer to the most recent command containing @var{string}.
-
-@end table
-
-@node Word Designators, Modifiers, Event Designators, Interactive Use
-@subsection Word Designators
-
-A @key{:} separates the event specification from the word designator. It
-can be omitted if the word designator begins with a @key{^}, @key{$},
-@key{*} or @key{%}. Words are numbered from the beginning of the line,
-with the first word being denoted by a 0 (zero).
-
-@table @asis
-
-@item @var{0} (zero)
-The zero'th word. For many applications, this is the command word.
-
-@item n
-The @var{n}'th word.
-
-@item @var{^}
-The first argument. that is, word 1.
-
-@item @var{$}
-The last argument.
-
-@item @var{%}
-The word matched by the most recent @code{?string?} search.
-
-@item @var{x}-@var{y}
-A range of words; @code{-@var{y}} is equivalent to @code{0-@var{y}}.
-
-@item @var{*}
-All of the words, excepting the zero'th. This is a synonym for @samp{1-$}.
-It is not an error to use @samp{*} if there is just one word in the event.
-The empty string is returned in that case.
-
-@end table
-
-@node Modifiers, , Word Designators, Interactive Use
-@subsection Modifiers
-
-After the optional word designator, you can add a sequence of one or more
-of the following modifiers, each preceded by a @key{:}.
-
-@table @code
-
-@item #
-The entire command line typed so far. This means the current command,
-not the previous command, so it really isn't a word designator, and doesn't
-belong in this section.
-
-@item h
-Remove a trailing pathname component, leaving only the head.
-
-@item r
-Remove a trailing suffix of the form ".xxx", leaving the basename (root).
-
-@item e
-Remove all but the suffix (end).
-
-@item t
-Remove all leading pathname components (before the last slash), leaving
-the tail.
-
-@item p
-Print the new command but do not execute it. This takes effect
-immediately, so it should be the last specifier on the line.
-
-@end table
-
-@node Programming, , Interactive Use, Top
-@chapter Programming
-
-@bye
diff --git a/readline/inc-hist.texi b/readline/inc-hist.texi
deleted file mode 100755
index 9bbb575..0000000
--- a/readline/inc-hist.texi
+++ /dev/null
@@ -1,188 +0,0 @@
-@ifinfo
-This file documents the GNU History library.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-Authored by Brian Fox.
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-@end ifinfo
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ignore
-
-@node History Top,,,
-@appendix Command Line History
-@ifinfo
-This file is meant to be an inclusion in the documentation of programs
-that use the history library features. There is also a standalone
-document, entitled @file{history.texinfo}.
-@end ifinfo
-
-This Appendix describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-@menu
-* Introduction to History:: What is the GNU History library for?
-* History Interaction:: What it feels like using History as a user.
-@end menu
-
-@node Introduction to History, History Interaction, History Top, Top
-@appendixsec Introduction to History
-
-Many programs read input from the user a line at a time. The GNU history
-library is able to keep track of those lines, associate arbitrary data with
-each line, and utilize information from previous lines in making up new
-ones.
-
-The programmer using the History library has available to him functions
-for remembering lines on a history stack, associating arbitrary data
-with a line, removing lines from the stack, searching through the stack
-for a line containing an arbitrary text string, and referencing any line
-on the stack directly. In addition, a history @dfn{expansion} function
-is available which provides for a consistent user interface across many
-different programs.
-
-When you use programs written with the History library, you have the
-benefit of a consistent user interface, with a set of well-known
-commands for manipulating the text of previous lines and using that text
-in new commands. The basic history manipulation commands are similar to
-the history substitution used by Csh.
-
-GNU programs often also use the Readline library, which includes history
-manipulation by default, and has the added advantage of Emacs style
-command line editing.
-
-@node History Interaction, , Introduction to History, Top
-@appendixsec History Interaction
-@cindex expansion
-
-The History library provides a history expansion feature that is similar
-to the history expansion in Csh. The following text describes what
-syntax features are available.
-
-History expansion takes place in two parts. The first is to determine
-which line from the previous history should be used during substitution.
-The second is to select portions of that line for inclusion into the
-current one. The line selected from the previous history is called the
-@dfn{event}, and the portions of that line that are acted upon are
-called @dfn{words}. The line is broken into words in the same fashion
-used by the Bash shell, so that several words surrounded by quotes are
-treated as if they were a single word.
-
-@menu
-* Event Designators:: How to specify which history line to use. *
-Word Designators:: Specifying which words are of interest. *
-Modifiers:: Modifying the results of susbstitution.
-@end menu
-
-@node Event Designators, Word Designators, , History Interaction
-@appendixsubsec Event Designators
-@cindex event designators
-
-An event designator is a reference to a command line entry in the
-history list.
-
-@table @asis
-
-@item @code{!}
-Start a history subsititution, except when followed by a space, tab, or
-the end of the line; or by @samp{=} or @samp{(}.
-
-@item @code{!!}
-Refer to the previous command. This is a synonym for @code{!-1}.
-
-@item @code{!@var{n}}
-Refer to command line @var{n}.
-
-@item @code{!-@var{n}}
-Refer to the command line @var{n} lines back.
-
-@item @code{!@var{string}}
-Refer to the most recent command starting with @var{string}.
-
-@item @code{!?@var{string}}[@code{?}]
-Refer to the most recent command containing @var{string}.
-
-@end table
-
-@node Word Designators, Modifiers, Event Designators, History Interaction
-@appendixsubsec Word Designators
-
-A @samp{:} separates the event specification from the word designator. It
-can be omitted if the word designator begins with a @samp{^}, @samp{$},
-@samp{*} or @samp{%}. Words are numbered from the beginning of the line,
-with the first word being denoted by a 0 (zero).
-
-@table @code
-
-@item 0 (zero)
-The zero'th word. For many applications, this is the command word.
-
-@item n
-The @var{n}'th word.
-
-@item ^
-The first argument. that is, word 1.
-
-@item $
-The last argument.
-
-@item %
-The word matched by the most recent @code{?@var{string}?} search.
-
-@item @var{x}-@var{y}
-A range of words; @code{-@var{y}} abbreviates @code{0-@var{y}}.
-
-@item *
-All of the words, excepting the zero'th. This is a synonym for @samp{1-$}.
-It is not an error to use @samp{*} if there is just one word in the event.
-The empty string is returned in that case.
-
-@end table
-
-@node Modifiers, , Word Designators, History Interaction
-@appendixsubsec Modifiers
-
-After the optional word designator, you can add a sequence of one or more
-of the following modifiers, each preceded by a @samp{:}.
-
-@table @code
-
-@item #
-The entire command line typed so far. This means the current command,
-not the previous command, so it really isn't a word designator, and doesn't
-belong in this section.
-
-@item h
-Remove a trailing pathname component, leaving only the head.
-
-@item r
-Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving the basename.
-
-@item e
-Remove all but the suffix.
-
-@item t
-Remove all leading pathname components, leaving the tail.
-
-@item p
-Print the new command but do not execute it. This takes effect
-immediately, so it should be the last specifier on the line.
-
-@end table
diff --git a/readline/inc-history.texinfo b/readline/inc-history.texinfo
deleted file mode 100755
index 9bbb575..0000000
--- a/readline/inc-history.texinfo
+++ /dev/null
@@ -1,188 +0,0 @@
-@ifinfo
-This file documents the GNU History library.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-Authored by Brian Fox.
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-@end ifinfo
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ignore
-
-@node History Top,,,
-@appendix Command Line History
-@ifinfo
-This file is meant to be an inclusion in the documentation of programs
-that use the history library features. There is also a standalone
-document, entitled @file{history.texinfo}.
-@end ifinfo
-
-This Appendix describes the GNU History library, a programming tool that
-provides a consistent user interface for recalling lines of previously
-typed input.
-
-@menu
-* Introduction to History:: What is the GNU History library for?
-* History Interaction:: What it feels like using History as a user.
-@end menu
-
-@node Introduction to History, History Interaction, History Top, Top
-@appendixsec Introduction to History
-
-Many programs read input from the user a line at a time. The GNU history
-library is able to keep track of those lines, associate arbitrary data with
-each line, and utilize information from previous lines in making up new
-ones.
-
-The programmer using the History library has available to him functions
-for remembering lines on a history stack, associating arbitrary data
-with a line, removing lines from the stack, searching through the stack
-for a line containing an arbitrary text string, and referencing any line
-on the stack directly. In addition, a history @dfn{expansion} function
-is available which provides for a consistent user interface across many
-different programs.
-
-When you use programs written with the History library, you have the
-benefit of a consistent user interface, with a set of well-known
-commands for manipulating the text of previous lines and using that text
-in new commands. The basic history manipulation commands are similar to
-the history substitution used by Csh.
-
-GNU programs often also use the Readline library, which includes history
-manipulation by default, and has the added advantage of Emacs style
-command line editing.
-
-@node History Interaction, , Introduction to History, Top
-@appendixsec History Interaction
-@cindex expansion
-
-The History library provides a history expansion feature that is similar
-to the history expansion in Csh. The following text describes what
-syntax features are available.
-
-History expansion takes place in two parts. The first is to determine
-which line from the previous history should be used during substitution.
-The second is to select portions of that line for inclusion into the
-current one. The line selected from the previous history is called the
-@dfn{event}, and the portions of that line that are acted upon are
-called @dfn{words}. The line is broken into words in the same fashion
-used by the Bash shell, so that several words surrounded by quotes are
-treated as if they were a single word.
-
-@menu
-* Event Designators:: How to specify which history line to use. *
-Word Designators:: Specifying which words are of interest. *
-Modifiers:: Modifying the results of susbstitution.
-@end menu
-
-@node Event Designators, Word Designators, , History Interaction
-@appendixsubsec Event Designators
-@cindex event designators
-
-An event designator is a reference to a command line entry in the
-history list.
-
-@table @asis
-
-@item @code{!}
-Start a history subsititution, except when followed by a space, tab, or
-the end of the line; or by @samp{=} or @samp{(}.
-
-@item @code{!!}
-Refer to the previous command. This is a synonym for @code{!-1}.
-
-@item @code{!@var{n}}
-Refer to command line @var{n}.
-
-@item @code{!-@var{n}}
-Refer to the command line @var{n} lines back.
-
-@item @code{!@var{string}}
-Refer to the most recent command starting with @var{string}.
-
-@item @code{!?@var{string}}[@code{?}]
-Refer to the most recent command containing @var{string}.
-
-@end table
-
-@node Word Designators, Modifiers, Event Designators, History Interaction
-@appendixsubsec Word Designators
-
-A @samp{:} separates the event specification from the word designator. It
-can be omitted if the word designator begins with a @samp{^}, @samp{$},
-@samp{*} or @samp{%}. Words are numbered from the beginning of the line,
-with the first word being denoted by a 0 (zero).
-
-@table @code
-
-@item 0 (zero)
-The zero'th word. For many applications, this is the command word.
-
-@item n
-The @var{n}'th word.
-
-@item ^
-The first argument. that is, word 1.
-
-@item $
-The last argument.
-
-@item %
-The word matched by the most recent @code{?@var{string}?} search.
-
-@item @var{x}-@var{y}
-A range of words; @code{-@var{y}} abbreviates @code{0-@var{y}}.
-
-@item *
-All of the words, excepting the zero'th. This is a synonym for @samp{1-$}.
-It is not an error to use @samp{*} if there is just one word in the event.
-The empty string is returned in that case.
-
-@end table
-
-@node Modifiers, , Word Designators, History Interaction
-@appendixsubsec Modifiers
-
-After the optional word designator, you can add a sequence of one or more
-of the following modifiers, each preceded by a @samp{:}.
-
-@table @code
-
-@item #
-The entire command line typed so far. This means the current command,
-not the previous command, so it really isn't a word designator, and doesn't
-belong in this section.
-
-@item h
-Remove a trailing pathname component, leaving only the head.
-
-@item r
-Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving the basename.
-
-@item e
-Remove all but the suffix.
-
-@item t
-Remove all leading pathname components, leaving the tail.
-
-@item p
-Print the new command but do not execute it. This takes effect
-immediately, so it should be the last specifier on the line.
-
-@end table
diff --git a/readline/inc-read.texi b/readline/inc-read.texi
deleted file mode 100755
index 3a46aaa..0000000
--- a/readline/inc-read.texi
+++ /dev/null
@@ -1,490 +0,0 @@
-@ignore
-
-This file documents the end user interface to the GNU command line
-editing feautres. It is to be an appendix to manuals for programs which
-use these features. There is a document entitled "readline.texinfo"
-which contains both end-user and programmer documentation for the GNU
-Readline Library.
-
-Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
-Written by Brian Fox.
-
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ignore
-
-@node Command Line Editing, , , Top
-@appendix Command Line Editing
-
-This appendix describes GNU's command line editing interface.
-Often during an interactive session you will type in a long line of
-text, only to notice that the first word on the line is misspelled. The
-Readline library gives you a set of commands for manipulating the text
-as you type it in, allowing you to just fix your typo, and not forcing
-you to retype the majority of the line. Using these editing commands,
-you move the cursor to the place that needs correction, and delete or
-insert the text of the corrections. Then, when you are satisfied with
-the line, you simply press @key{RETURN}. You do not have to be at the
-end of the line to press @key{RETURN}; the entire line will be accepted
-in any case.
-
-@menu
-* Conventions:: Notation used in this appendix.
-* Readline Interaction:: How to use Readline
-* Readline Init File:: Customizing Readline for your own use
-@end menu
-
-@node Conventions, Readline Interaction, Command Line Editing, Command Line Editing
-@appendixsec Conventions on Notation
-
-In this Appendix, the following notation is used to describe
-keystrokes.
-
-The text @kbd{C-k} is read as `Control-K' and describes the character
-produced when the Control key is depressed and the @key{k} key is struck.
-
-The text @kbd{M-k} is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the
-@key{k} key is struck. If you do not have a meta key, it is equivalent
-to type @key{ESC} @i{first}, and then type @key{k}. Either process is
-known as @dfn{metafying} the @key{k} key.
-
-The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the
-character produced by @dfn{metafying} @kbd{C-k}.
-
-In addition, several keys have their own names. Specifically,
-@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
-stand for themselves when seen in this text, or in an init file
-(@pxref{Readline Init File}, for more info).
-
-@node Readline Interaction, Readline Init File, Conventions, Command Line Editing
-@appendixsec Readline Interaction
-@cindex interaction, readline
-
-@menu
-* Readline Bare Essentials:: The least you need to know about Readline.
-* Readline Movement Commands:: Moving about the input line.
-* Readline Killing Commands:: How to delete text, and how to get it back!
-* Readline Arguments:: Giving numeric arguments to commands.
-@end menu
-
-@node Readline Bare Essentials, Readline Movement Commands, Readline Interaction, Readline Interaction
-@appendixsubsec Bare Essentials
-
-In order to enter characters into the line, simply type them. The typed
-character appears where the cursor was, and then the cursor moves one
-space to the right. If you mistype a character, you can use @key{DEL} to
-back up, and delete the mistyped character.
-
-Sometimes you may miss typing a character that you wanted to type, and
-not notice your error until you have typed several other characters. In
-that case, you can type @kbd{C-b} to move the cursor to the left, and then
-correct your mistake. Aftwerwards, you can move the cursor to the right
-with @kbd{C-f}.
-
-When you add text in the middle of a line, you will notice that characters
-to the right of the cursor get `pushed over' to make room for the text
-that you have inserted. Likewise, when you delete text behind the cursor,
-characters to the right of the cursor get `pulled back' to fill in the
-blank space created by the removal of the text. A list of the basic bare
-essentials for editing the text of an input line follows.
-
-@table @asis
-@item @kbd{C-b}
-Move back one character.
-@item @kbd{C-f}
-Move forward one character.
-@item @key{DEL}
-Delete the character to the left of the cursor.
-@item @kbd{C-d}
-Delete the character underneath the cursor.
-@item @var{c}
-Insert an ordinary printing character @var{c} into the line at the cursor.
-@item @kbd{C-_}
-Undo the last thing that you did. You can undo all the way back to an
-empty line.
-@end table
-
-@node Readline Movement Commands, Readline Killing Commands, Readline Bare Essentials, Readline Interaction
-@appendixsubsec Movement Commands
-
-
-The above table describes the most basic possible keystrokes that you need
-in order to do editing of the input line. For your convenience, many
-other commands have been added in addition to @kbd{C-b}, @kbd{C-f},
-@kbd{C-d}, and @key{DEL}. Here are some commands for moving more rapidly
-about the line.
-
-@table @kbd
-@item C-a
-Move to the start of the line.
-@item C-e
-Move to the end of the line.
-@item M-f
-Move forward a word.
-@item M-b
-Move backward a word.
-@item C-l
-Clear the screen, reprinting the current line at the top.
-@end table
-
-Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves
-forward a word. It is a loose convention that control keystrokes
-operate on characters while meta keystrokes operate on words.
-
-@node Readline Killing Commands, Readline Arguments, Readline Movement Commands, Readline Interaction
-@appendixsubsec Killing Commands
-
-@dfn{Killing} text means to delete the text from the line, but to save
-it away for later use, usually by @dfn{yanking} it back into the line.
-If the description for a command says that it `kills' text, then you can
-be sure that you can get the text back in a different (or the same)
-place later.
-
-Here is the list of commands for killing text.
-
-@table @kbd
-@item C-k
-Kill the text from the current cursor position to the end of the line.
-
-@item M-d
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word.
-
-@item M-@key{DEL}
-Kill from the cursor the start ofthe previous word, or if between words, to the start of the previous word.
-
-@item C-w
-Kill from the cursor to the previous whitespace. This is different than
-@kbd{M-@key{DEL}} because the word boundaries differ.
-
-@end table
-
-And, here is how to @dfn{yank} the text back into the line. Yanking
-is
-
-@table @kbd
-@item C-y
-Yank the most recently killed text back into the buffer at the cursor.
-
-@item M-y
-Rotate the kill-ring, and yank the new top. You can only do this if
-the prior command is @kbd{C-y} or @kbd{M-y}.
-@end table
-
-When you use a kill command, the text is saved in a @dfn{kill-ring}.
-Any number of consecutive kills save all of the killed text together, so
-that when you yank it back, you get it in one clean sweep. The kill
-ring is not line specific; the text that you killed on a previously
-typed line is available to be yanked back later, when you are typing
-another line.
-
-@node Readline Arguments, , Readline Killing Commands, Readline Interaction
-@appendixsubsec Arguments
-
-You can pass numeric arguments to Readline commands. Sometimes the
-argument acts as a repeat count, other times it is the @i{sign} of the
-argument that is significant. If you pass a negative argument to a
-command which normally acts in a forward direction, that command will
-act in a backward direction. For example, to kill text back to the
-start of the line, you might type @kbd{M--} @kbd{C-k}.
-
-The general way to pass numeric arguments to a command is to type meta
-digits before the command. If the first `digit' you type is a minus
-sign (@kbd{-}), then the sign of the argument will be negative. Once
-you have typed one meta digit to get the argument started, you can type
-the remainder of the digits, and then the command. For example, to give
-the @kbd{C-d} command an argument of 10, you could type @kbd{M-1 0 C-d}.
-
-
-@node Readline Init File, , Readline Interaction, Command Line Editing
-@appendixsec Readline Init File
-
-Although the Readline library comes with a set of Emacs-like
-keybindings, it is possible that you would like to use a different set
-of keybindings. You can customize programs that use Readline by putting
-commands in an @dfn{init} file in your home directory. The name of this
-file is @file{~/.inputrc}.
-
-When a program which uses the Readline library starts up, it reads the file
-@file{~/.inputrc}, and sets the keybindings.
-
-@menu
-* Readline Init Syntax:: Syntax for the commands in @file{~/.inputrc}.
-* Readline Vi Mode:: Switching to @code{vi} mode in Readline.
-@end menu
-
-@node Readline Init Syntax, Readline Vi Mode, Readline Init File, Readline Init File
-@appendixsubsec Readline Init Syntax
-
-You can start up with a vi-like editing mode by placing
-
-@example
-@code{set editing-mode vi}
-@end example
-
-@noindent
-in your @file{~/.inputrc} file.
-
-You can have Readline use a single line for display, scrolling the input
-between the two edges of the screen by placing
-
-@example
-@code{set horizontal-scroll-mode On}
-@end example
-
-@noindent
-in your @file{~/.inputrc} file.
-
-The syntax for controlling keybindings in the @file{~/.inputrc} file is
-simple. First you have to know the @i{name} of the command that you
-want to change. The following pages contain tables of the command name, the
-default keybinding, and a short description of what the command does.
-
-Once you know the name of the command, simply place the name of the key
-you wish to bind the command to, a colon, and then the name of the
-command on a line in the @file{~/.inputrc} file. Here is an example:
-
-@example
-# This is a comment line.
-Meta-Rubout: backward-kill-word
-Control-u: universal-argument
-@end example
-
-@menu
-* Commands For Moving:: Moving about the line.
-* Commands For History:: Getting at previous lines.
-* Commands For Text:: Commands for changing text.
-* Commands For Killing:: Commands for killing and yanking.
-* Numeric Arguments:: Specifying numeric arguments, repeat counts.
-* Commands For Completion:: Getting Readline to do the typing for you.
-* Miscellaneous Commands:: Other miscillaneous commands.
-@end menu
-
-@node Commands For Moving, Commands For History, Readline Init Syntax, Readline Init Syntax
-@appendixsubsubsec Moving
-@table @code
-@item beginning-of-line (C-a)
-Move to the start of the current line.
-
-@item end-of-line (C-e)
-Move to the end of the line.
-
-@item forward-char (C-f)
-Move forward a character.
-
-@item backward-char (C-b)
-Move back a character.
-
-@item forward-word (M-f)
-Move forward to the end of the next word.
-
-@item backward-word (M-b)
-Move back to the start of this, or the previous, word.
-
-@item clear-screen (C-l)
-Clear the screen leaving the current line at the top of the screen.
-
-@end table
-
-@node Commands For History, Commands For Text, Commands For Moving, Readline Init Syntax
-@appendixsubsubsec Using the History
-
-@table @code
-@item accept-line (Newline, Return)
-Accept the line regardless of where the cursor is. If this line is
-non-empty, add it to the history list. If this line was a history
-line, then restore the history line to its original state.
-
-@item previous-history (C-p)
-Move `up' through the history list.
-
-@item next-history (C-n)
-Move `down' through the history list.
-
-@item beginning-of-history (M-<)
-Move to the first line in the history.
-
-@item end-of-history (M->)
-Move to the end of the input history, i.e., the line you are entering!
-
-@item reverse-search-history (C-r)
-Search backward starting at the current line and moving `up' through
-the history as necessary. This is an incremental search.
-
-@item forward-search-history (C-s)
-Search forward starting at the current line and moving `down' through
-the the history as neccessary.
-
-@end table
-
-@node Commands For Text, Commands For Killing, Commands For History, Readline Init Syntax
-@appendixsubsubsec Changing Text
-
-@table @code
-@item delete-char (C-d)
-Delete the character under the cursor. If the cursor is at the
-beginning of the line, and there are no characters in the line, and
-the last character typed was not C-d, then return EOF.
-
-@item backward-delete-char (Rubout)
-Delete the character behind the cursor. A numeric arg says to kill
-the characters instead of deleting them.
-
-@item quoted-insert (C-q, C-v)
-Add the next character that you type to the line verbatim. This is
-how to insert things like C-q for example.
-
-@item tab-insert (M-TAB)
-Insert a tab character.
-
-@item self-insert (a, b, A, 1, !, ...)
-Insert an ordinary printing character into the line.
-
-@item transpose-chars (C-t)
-Drag the character before point forward over the character at point.
-Point moves forward as well. If point is at the end of the line, then
-transpose the two characters before point. Negative args don't work.
-
-@item transpose-words (M-t)
-Drag the word behind the cursor past the word in front of the cursor
-moving the cursor over that word as well.
-
-@item upcase-word (M-u)
-Uppercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@item downcase-word (M-l)
-Lowercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@item capitalize-word (M-c)
-Uppercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@end table
-
-@node Commands For Killing, Numeric Arguments, Commands For Text, Readline Init Syntax
-@appendixsubsubsec Killing And Yanking
-
-@table @code
-
-@item kill-line (C-k)
-Kill the text from the current cursor position to the end of the line.
-
-@item backward-kill-line ()
-Kill backward to the beginning of the line. This is normally unbound.
-
-@item kill-word (M-d)
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word.
-
-@item backward-kill-word (M-DEL)
-Kill the word behind the cursor.
-
-@item unix-line-discard (C-u)
-Kill the entire line. This is similar to the use of the Unix kill
-character (often also @key{C-u}), save that here the killed text can be
-retrieved later (since it goes on the kill-ring).
-
-@item unix-word-rubout (C-w)
-Kill the current word, like the Unix word erase character. The killed
-text goes on the kill-ring. This is different than
-@code{backward-kill-word} because the word boundaries differ.
-
-@item yank (C-y)
-Yank the top of the kill ring into the buffer at point.
-
-@item yank-pop (M-y)
-Rotate the kill-ring, and yank the new top. You can only do this if
-the prior command is @code{yank} or @code{yank-pop}.
-@end table
-
-@node Numeric Arguments, Commands For Completion, Commands For Killing, Readline Init Syntax
-@appendixsubsubsec Numeric Arguments
-@table @code
-
-@item digit-argument (M-0, M-1, ... M--)
-Add this digit to the argument already accumulating, or start a new
-argument. @kbd{M--} starts a negative argument.
-
-@item universal-argument ()
-Do what @key{C-u} does in emacs. By default, this is not bound to any keys.
-@end table
-
-
-@node Commands For Completion, Miscellaneous Commands, Numeric Arguments, Readline Init Syntax
-@appendixsubsubsec Letting Readline Type
-
-@table @code
-@item complete (TAB)
-Attempt to do completion on the text before point. This is
-implementation defined. Generally, if you are typing a filename
-argument, you can do filename completion; if you are typing a command,
-you can do command completion, if you are typing in a symbol to GDB, you
-can do symbol name completion, if you are typing in a variable to Bash,
-you can do variable name completion...
-
-@item possible-completions (M-?)
-List the possible completions of the text before point.
-@end table
-
-@node Miscellaneous Commands, , Commands For Completion, Readline Init Syntax
-@appendixsubsubsec Other Commands
-@table @code
-
-@item abort (@kbd{C-g})
-The line editing commands @code{reverse-search-history} (@kbd{C-r}) and
-@code{forward-search-history} (@kbd{C-s} go into a separate input mode;
-you can abort the search, and return to normal input mode, by using the
-@code{abort} (@kbd{C-g}) command.
-
-@item do-uppercase-version (@kbd{M-a}, @kbd{M-b}, @dots{})
-Run the command that is bound to your uppercase brother.
-
-@item prefix-meta (@key{ESC})
-Make the next character that you type be metafied. This is for
-people without a meta key. @kbd{@key{ESC}-f} is equivalent to @kbd{M-f}.
-
-@item undo (@kbd{C-_})
-Incremental undo, separately remembered for each line.
-
-@item revert-line (@kbd{M-r})
-Undo all changes made to this line. This is like typing the `undo'
-command enough times to get back to the beginning.
-@end table
-
-@node Readline vi Mode, , Readline Init Syntax, Readline Init File
-@appendixsubsec Readline @code{vi} Mode
-
-While the Readline library does not have a full set of @code{vi} editing
-functions, it does contain enough to allow simple editing of the line.
-
-In order to switch interactively between Emacs and @code{vi} editing modes, use
-the command @kbd{M-C-j} (@code{toggle-editing-mode}).
-
-When you enter a line in @code{vi} mode, you are already in
-``insertion'' mode, as if you had typed an @kbd{i}. Pressing @key{ESC}
-switches you into ``edit'' mode, where you can edit the text of the line
-with the standard @code{vi} movement keys, move to previous history
-lines with @kbd{k}, to following lines with @kbd{j}, and so forth.
-
-
-
-
diff --git a/readline/inc-readline.texinfo b/readline/inc-readline.texinfo
deleted file mode 100755
index 52a0e33..0000000
--- a/readline/inc-readline.texinfo
+++ /dev/null
@@ -1,494 +0,0 @@
-@ignore
-
-This file documents the end user interface to the GNU command line
-editing feautres. It is to be an appendix to manuals for programs which
-use these features. There is a document entitled "readline.texinfo"
-which contains both end-user and programmer documentation for the GNU
-Readline Library.
-
-Copyright (C) 1988, 1991 Free Software Foundation, Inc.
-
-Written by Brian Fox.
-
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-Permission is granted to make and distribute verbatim copies of this manual
-provided the copyright notice and this permission notice are preserved on
-all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that the
-GNU Copyright statement is available to the distributee, and provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ignore
-
-@node Command Line Editing, , , Top
-@appendix Command Line Editing
-
-This appendix describes GNU's command line editing interface.
-Often during an interactive session you will type in a long line of
-text, only to notice that the first word on the line is misspelled. The
-Readline library gives you a set of commands for manipulating the text
-as you type it in, allowing you to just fix your typo, and not forcing
-you to retype the majority of the line. Using these editing commands,
-you move the cursor to the place that needs correction, and delete or
-insert the text of the corrections. Then, when you are satisfied with
-the line, you simply press @key{RETURN}. You do not have to be at the
-end of the line to press @key{RETURN}; the entire line will be accepted
-in any case.
-
-@menu
-* Conventions:: Notation used in this appendix.
-* Basic Line Editing:: The minimum set of commands for editing a line.
-* Movement Commands:: Commands for moving the cursor about the line.
-* Cutting and Pasting:: Deletion and copying of text sections.
-* Transposition:: Exchanging two characters or words.
-* Completion:: Expansion of a partially typed word into
- the full text.
-@end menu
-
-@node Conventions, Basic Line Editing, Command Line Editing, Command Line Editing
-@appendixsec Conventions on Notation
-
-In this Appendix, the following notation is used to describe
-keystrokes.
-
-The text @kbd{C-k} is read as `Control-K' and describes the character
-produced when the Control key is depressed and the @key{k} key is struck.
-
-The text @kbd{M-k} is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the
-@key{k} key is struck. If you do not have a meta key, it is equivalent
-to type @key{ESC} @i{first}, and then type @key{k}. Either process is
-known as @dfn{metafying} the @key{k} key.
-
-The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the
-character produced by @dfn{metafying} @kbd{C-k}.
-
-In addition, several keys have their own names. Specifically,
-@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
-stand for themselves when seen in this text, or in an init file
-(@pxref{Readline Init File}, for more info).
-
-@node Readline Interaction, Readline Init File, Readline Introduction, Readline Top
-@appendixsec Readline Interaction
-@cindex interaction, readline
-
-@menu
-* Readline Bare Essentials:: The least you need to know about Readline.
-* Readline Movement Commands:: Moving about the input line.
-* Readline Killing Commands:: How to delete text, and how to get it back!
-* Readline Arguments:: Giving numeric arguments to commands.
-@end menu
-
-@node Readline Bare Essentials, Readline Movement Commands, Readline Interaction, Readline Interaction
-@appendixsubsec Bare Essentials
-
-In order to enter characters into the line, simply type them. The typed
-character appears where the cursor was, and then the cursor moves one
-space to the right. If you mistype a character, you can use @key{DEL} to
-back up, and delete the mistyped character.
-
-Sometimes you may miss typing a character that you wanted to type, and
-not notice your error until you have typed several other characters. In
-that case, you can type @kbd{C-b} to move the cursor to the left, and then
-correct your mistake. Aftwerwards, you can move the cursor to the right
-with @kbd{C-f}.
-
-When you add text in the middle of a line, you will notice that characters
-to the right of the cursor get `pushed over' to make room for the text
-that you have inserted. Likewise, when you delete text behind the cursor,
-characters to the right of the cursor get `pulled back' to fill in the
-blank space created by the removal of the text. A list of the basic bare
-essentials for editing the text of an input line follows.
-
-@table @asis
-@item @kbd{C-b}
-Move back one character.
-@item @kbd{C-f}
-Move forward one character.
-@item @key{DEL}
-Delete the character to the left of the cursor.
-@item @kbd{C-d}
-Delete the character underneath the cursor.
-@item @var{c}
-Insert an ordinary printing character @var{c} into the line at the cursor.
-@item @kbd{C-_}
-Undo the last thing that you did. You can undo all the way back to an
-empty line.
-@end table
-
-@node Readline Movement Commands, Readline Killing Commands, Readline Bare Essentials, Readline Interaction
-@appendixsubsec Movement Commands
-
-
-The above table describes the most basic possible keystrokes that you need
-in order to do editing of the input line. For your convenience, many
-other commands have been added in addition to @kbd{C-b}, @kbd{C-f},
-@kbd{C-d}, and @key{DEL}. Here are some commands for moving more rapidly
-about the line.
-
-@table @kbd
-@item C-a
-Move to the start of the line.
-@item C-e
-Move to the end of the line.
-@item M-f
-Move forward a word.
-@item M-b
-Move backward a word.
-@item C-l
-Clear the screen, reprinting the current line at the top.
-@end table
-
-Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves
-forward a word. It is a loose convention that control keystrokes
-operate on characters while meta keystrokes operate on words.
-
-@node Readline Killing Commands, Readline Arguments, Readline Movement Commands, Readline Interaction
-@appendixsubsec Killing Commands
-
-@dfn{Killing} text means to delete the text from the line, but to save
-it away for later use, usually by @dfn{yanking} it back into the line.
-If the description for a command says that it `kills' text, then you can
-be sure that you can get the text back in a different (or the same)
-place later.
-
-Here is the list of commands for killing text.
-
-@table @kbd
-@item C-k
-Kill the text from the current cursor position to the end of the line.
-
-@item M-d
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word.
-
-@item M-@key{DEL}
-Kill from the cursor the start ofthe previous word, or if between words, to the start of the previous word.
-
-@item C-w
-Kill from the cursor to the previous whitespace. This is different than
-@kbd{M-@key{DEL}} because the word boundaries differ.
-
-@end table
-
-And, here is how to @dfn{yank} the text back into the line. Yanking
-is
-
-@table @kbd
-@item C-y
-Yank the most recently killed text back into the buffer at the cursor.
-
-@item M-y
-Rotate the kill-ring, and yank the new top. You can only do this if
-the prior command is @kbd{C-y} or @kbd{M-y}.
-@end table
-
-When you use a kill command, the text is saved in a @dfn{kill-ring}.
-Any number of consecutive kills save all of the killed text together, so
-that when you yank it back, you get it in one clean sweep. The kill
-ring is not line specific; the text that you killed on a previously
-typed line is available to be yanked back later, when you are typing
-another line.
-
-@node Readline Arguments, , Readline Killing Commands, Readline Interaction
-@appendixsubsec Arguments
-
-You can pass numeric arguments to Readline commands. Sometimes the
-argument acts as a repeat count, other times it is the @i{sign} of the
-argument that is significant. If you pass a negative argument to a
-command which normally acts in a forward direction, that command will
-act in a backward direction. For example, to kill text back to the
-start of the line, you might type @kbd{M--} @kbd{C-k}.
-
-The general way to pass numeric arguments to a command is to type meta
-digits before the command. If the first `digit' you type is a minus
-sign (@kbd{-}), then the sign of the argument will be negative. Once
-you have typed one meta digit to get the argument started, you can type
-the remainder of the digits, and then the command. For example, to give
-the @kbd{C-d} command an argument of 10, you could type @kbd{M-1 0 C-d}.
-
-
-@node Readline Init File, , Readline Interaction, Readline Top
-@appendixsec Readline Init File
-
-Although the Readline library comes with a set of Emacs-like
-keybindings, it is possible that you would like to use a different set
-of keybindings. You can customize programs that use Readline by putting
-commands in an @dfn{init} file in your home directory. The name of this
-file is @file{~/.inputrc}.
-
-When a program which uses the Readline library starts up, it reads the file
-@file{~/.inputrc}, and sets the keybindings.
-
-@menu
-* Readline Init Syntax:: Syntax for the commands in @file{~/.inputrc}.
-* Readline Vi Mode:: Switching to @code{vi} mode in Readline.
-@end menu
-
-@node Readline Init Syntax, Readline Vi Mode, Readline Init File, Readline Init File
-@appendixsubsec Readline Init Syntax
-
-You can start up with a vi-like editing mode by placing
-
-@example
-@code{set editing-mode vi}
-@end example
-
-@noindent
-in your @file{~/.inputrc} file.
-
-You can have Readline use a single line for display, scrolling the input
-between the two edges of the screen by placing
-
-@example
-@code{set horizontal-scroll-mode On}
-@end example
-
-@noindent
-in your @file{~/.inputrc} file.
-
-The syntax for controlling keybindings in the @file{~/.inputrc} file is
-simple. First you have to know the @i{name} of the command that you
-want to change. The following pages contain tables of the command name, the
-default keybinding, and a short description of what the command does.
-
-Once you know the name of the command, simply place the name of the key
-you wish to bind the command to, a colon, and then the name of the
-command on a line in the @file{~/.inputrc} file. Here is an example:
-
-@example
-# This is a comment line.
-Meta-Rubout: backward-kill-word
-Control-u: universal-argument
-@end example
-
-@menu
-* Commands For Moving:: Moving about the line.
-* Commands For History:: Getting at previous lines.
-* Commands For Text:: Commands for changing text.
-* Commands For Killing:: Commands for killing and yanking.
-* Numeric Arguments:: Specifying numeric arguments, repeat counts.
-* Commands For Completion:: Getting Readline to do the typing for you.
-* Miscellaneous Commands:: Other miscillaneous commands.
-@end menu
-
-@node Commands For Moving, Commands For History, Readline Init Syntax, Readline Init Syntax
-@appendixsubsubsec Moving
-@table @code
-@item beginning-of-line (C-a)
-Move to the start of the current line.
-
-@item end-of-line (C-e)
-Move to the end of the line.
-
-@item forward-char (C-f)
-Move forward a character.
-
-@item backward-char (C-b)
-Move back a character.
-
-@item forward-word (M-f)
-Move forward to the end of the next word.
-
-@item backward-word (M-b)
-Move back to the start of this, or the previous, word.
-
-@item clear-screen (C-l)
-Clear the screen leaving the current line at the top of the screen.
-
-@end table
-
-@node Commands For History, Commands For Text, Commands For Moving, Readline Init Syntax
-@appendixsubsubsec Using the History
-
-@table @code
-@item accept-line (Newline, Return)
-Accept the line regardless of where the cursor is. If this line is
-non-empty, add it to the history list. If this line was a history
-line, then restore the history line to its original state.
-
-@item previous-history (C-p)
-Move `up' through the history list.
-
-@item next-history (C-n)
-Move `down' through the history list.
-
-@item beginning-of-history (M-<)
-Move to the first line in the history.
-
-@item end-of-history (M->)
-Move to the end of the input history, i.e., the line you are entering!
-
-@item reverse-search-history (C-r)
-Search backward starting at the current line and moving `up' through
-the history as necessary. This is an incremental search.
-
-@item forward-search-history (C-s)
-Search forward starting at the current line and moving `down' through
-the the history as neccessary.
-
-@end table
-
-@node Commands For Text, Commands For Killing, Commands For History, Readline Init Syntax
-@appendixsubsubsec Changing Text
-
-@table @code
-@item delete-char (C-d)
-Delete the character under the cursor. If the cursor is at the
-beginning of the line, and there are no characters in the line, and
-the last character typed was not C-d, then return EOF.
-
-@item backward-delete-char (Rubout)
-Delete the character behind the cursor. A numeric arg says to kill
-the characters instead of deleting them.
-
-@item quoted-insert (C-q, C-v)
-Add the next character that you type to the line verbatim. This is
-how to insert things like C-q for example.
-
-@item tab-insert (M-TAB)
-Insert a tab character.
-
-@item self-insert (a, b, A, 1, !, ...)
-Insert an ordinary printing character into the line.
-
-@item transpose-chars (C-t)
-Drag the character before point forward over the character at point.
-Point moves forward as well. If point is at the end of the line, then
-transpose the two characters before point. Negative args don't work.
-
-@item transpose-words (M-t)
-Drag the word behind the cursor past the word in front of the cursor
-moving the cursor over that word as well.
-
-@item upcase-word (M-u)
-Uppercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@item downcase-word (M-l)
-Lowercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@item capitalize-word (M-c)
-Uppercase the current (or following) word. With a negative argument,
-do the previous word, but do not move point.
-
-@end table
-
-@node Commands For Killing, Numeric Arguments, Commands For Text, Readline Init Syntax
-@appendixsubsubsec Killing And Yanking
-
-@table @code
-
-@item kill-line (C-k)
-Kill the text from the current cursor position to the end of the line.
-
-@item backward-kill-line ()
-Kill backward to the beginning of the line. This is normally unbound.
-
-@item kill-word (M-d)
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word.
-
-@item backward-kill-word (M-DEL)
-Kill the word behind the cursor.
-
-@item unix-line-discard (C-u)
-Kill the entire line. This is similar to the use of the Unix kill
-character (often also @key{C-u}), save that here the killed text can be
-retrieved later (since it goes on the kill-ring).
-
-@item unix-word-rubout (C-w)
-Kill the current word, like the Unix word erase character. The killed
-text goes on the kill-ring. This is different than
-@code{backward-kill-word} because the word boundaries differ.
-
-@item yank (C-y)
-Yank the top of the kill ring into the buffer at point.
-
-@item yank-pop (M-y)
-Rotate the kill-ring, and yank the new top. You can only do this if
-the prior command is @code{yank} or @code{yank-pop}.
-@end table
-
-@node Numeric Arguments, Commands For Completion, Commands For Killing, Readline Init Syntax
-@appendixsubsubsec Numeric Arguments
-@table @code
-
-@item digit-argument (M-0, M-1, ... M--)
-Add this digit to the argument already accumulating, or start a new
-argument. @kbd{M--} starts a negative argument.
-
-@item universal-argument ()
-Do what @key{C-u} does in emacs. By default, this is not bound to any keys.
-@end table
-
-
-@node Commands For Completion, Miscellaneous Commands, Numeric Arguments, Readline Init Syntax
-@appendixsubsubsec Letting Readline Type
-
-@table @code
-@item complete (TAB)
-Attempt to do completion on the text before point. This is
-implementation defined. Generally, if you are typing a filename
-argument, you can do filename completion; if you are typing a command,
-you can do command completion, if you are typing in a symbol to GDB, you
-can do symbol name completion, if you are typing in a variable to Bash,
-you can do variable name completion...
-
-@item possible-completions (M-?)
-List the possible completions of the text before point.
-@end table
-
-@node Miscellaneous Commands, , Commands For Completion, Readline Init Syntax
-@appendixsubsubsec Other Commands
-@table @code
-
-@item abort (@kbd{C-g})
-The line editing commands @code{reverse-search-history} (@kbd{C-r}) and
-@code{forward-search-history} (@kbd{C-s} go into a separate input mode;
-you can abort the search, and return to normal input mode, by using the
-@code{abort} (@kbd{C-g}) command.
-
-@item do-uppercase-version (@kbd{M-a}, @kbd{M-b}, @dots)
-Run the command that is bound to your uppercase brother.
-
-@item prefix-meta (@key{ESC})
-Make the next character that you type be metafied. This is for
-people without a meta key. @kbd{@key{ESC}-f} is equivalent to @kbd{M-f}.
-
-@item undo (@kbd{C-_})
-Incremental undo, separately remembered for each line.
-
-@item revert-line (@kbd{M-r})
-Undo all changes made to this line. This is like typing the `undo'
-command enough times to get back to the beginning.
-@end table
-
-@node Readline vi Mode, , Readline Init Syntax, Readline Init File
-@appendixsubsec Readline @code{vi} Mode
-
-While the Readline library does not have a full set of @code{vi} editing
-functions, it does contain enough to allow simple editing of the line.
-
-In order to switch interactively between Emacs and @code{vi} editing modes, use
-the command @kbd{M-C-j} (@code{toggle-editing-mode}).
-
-When you enter a line in @code{vi} mode, you are already in
-``insertion'' mode, as if you had typed an @kbd{i}. Pressing @key{ESC}
-switches you into ``edit'' mode, where you can edit the text of the line
-with the standard @code{vi} movement keys, move to previous history
-lines with @kbd{k}, to following lines with @kbd{j}, and so forth.
-
-
-
-
diff --git a/readline/isearch.c b/readline/isearch.c
new file mode 100644
index 0000000..9b44c93
--- /dev/null
+++ b/readline/isearch.c
@@ -0,0 +1,378 @@
+/* **************************************************************** */
+/* */
+/* I-Search and Searching */
+/* */
+/* **************************************************************** */
+
+/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
+
+ This file contains the Readline Library (the Library), a set of
+ routines for providing Emacs style line input to programs that ask
+ for it.
+
+ The Library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ The Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+
+#if defined (__GNUC__)
+# define alloca __builtin_alloca
+#else
+# if defined (sparc) || defined (HAVE_ALLOCA_H)
+# include <alloca.h>
+# endif
+#endif
+
+#include "readline.h"
+#include "history.h"
+
+extern Keymap _rl_keymap;
+extern HIST_ENTRY *saved_line_for_history;
+extern int rl_line_buffer_len;
+extern int rl_point, rl_end;
+extern char *rl_prompt, *rl_line_buffer;
+
+/* Remove these declarations when we have a complete libgnu.a. */
+extern char *xmalloc (), *xrealloc ();
+
+static void rl_search_history ();
+
+/* Search backwards through the history looking for a string which is typed
+ interactively. Start with the current line. */
+rl_reverse_search_history (sign, key)
+ int sign;
+ int key;
+{
+ rl_search_history (-sign, key);
+}
+
+/* Search forwards through the history looking for a string which is typed
+ interactively. Start with the current line. */
+rl_forward_search_history (sign, key)
+ int sign;
+ int key;
+{
+ rl_search_history (sign, key);
+}
+
+/* Display the current state of the search in the echo-area.
+ SEARCH_STRING contains the string that is being searched for,
+ DIRECTION is zero for forward, or 1 for reverse,
+ WHERE is the history list number of the current line. If it is
+ -1, then this line is the starting one. */
+static void
+rl_display_search (search_string, reverse_p, where)
+ char *search_string;
+ int reverse_p, where;
+{
+ char *message = (char *)NULL;
+
+ message =
+ (char *)xmalloc (1 + (search_string ? strlen (search_string) : 0) + 30);
+
+ *message = '\0';
+
+#if defined (NOTDEF)
+ if (where != -1)
+ sprintf (message, "[%d]", where + history_base);
+#endif /* NOTDEF */
+
+ strcat (message, "(");
+
+ if (reverse_p)
+ strcat (message, "reverse-");
+
+ strcat (message, "i-search)`");
+
+ if (search_string)
+ strcat (message, search_string);
+
+ strcat (message, "': ");
+ rl_message ("%s", message, 0);
+ free (message);
+ rl_redisplay ();
+}
+
+/* Search through the history looking for an interactively typed string.
+ This is analogous to i-search. We start the search in the current line.
+ DIRECTION is which direction to search; >= 0 means forward, < 0 means
+ backwards. */
+static void
+rl_search_history (direction, invoking_key)
+ int direction;
+ int invoking_key;
+{
+ /* The string that the user types in to search for. */
+ char *search_string;
+
+ /* The current length of SEARCH_STRING. */
+ int search_string_index;
+
+ /* The amount of space that SEARCH_STRING has allocated to it. */
+ int search_string_size;
+
+ /* The list of lines to search through. */
+ char **lines;
+
+ /* The length of LINES. */
+ int hlen;
+
+ /* Where we get LINES from. */
+ HIST_ENTRY **hlist = history_list ();
+
+ register int i = 0;
+ int orig_point = rl_point;
+ int orig_line = where_history ();
+ int last_found_line = orig_line;
+ int c, done = 0;
+
+ /* The line currently being searched. */
+ char *sline;
+
+ /* Offset in that line. */
+ int index;
+
+ /* Non-zero if we are doing a reverse search. */
+ int reverse = (direction < 0);
+
+ /* Create an arrary of pointers to the lines that we want to search. */
+ maybe_replace_line ();
+ if (hlist)
+ for (i = 0; hlist[i]; i++);
+
+ /* Allocate space for this many lines, +1 for the current input line,
+ and remember those lines. */
+ lines = (char **)alloca ((1 + (hlen = i)) * sizeof (char *));
+ for (i = 0; i < hlen; i++)
+ lines[i] = hlist[i]->line;
+
+ if (saved_line_for_history)
+ lines[i] = saved_line_for_history->line;
+ else
+ /* So I have to type it in this way instead. */
+ {
+ char *alloced_line;
+
+ /* Keep that MIPS alloca () happy. */
+ alloced_line = (char *)alloca (1 + strlen (rl_line_buffer));
+ lines[i] = alloced_line;
+ strcpy (lines[i], &rl_line_buffer[0]);
+ }
+
+ hlen++;
+
+ /* The line where we start the search. */
+ i = orig_line;
+
+ /* Initialize search parameters. */
+ search_string = (char *)xmalloc (search_string_size = 128);
+ *search_string = '\0';
+ search_string_index = 0;
+
+ /* Normalize DIRECTION into 1 or -1. */
+ if (direction >= 0)
+ direction = 1;
+ else
+ direction = -1;
+
+ rl_display_search (search_string, reverse, -1);
+
+ sline = rl_line_buffer;
+ index = rl_point;
+
+ while (!done)
+ {
+ c = rl_read_key ();
+
+ /* Hack C to Do What I Mean. */
+ {
+ Function *f = (Function *)NULL;
+
+ if (_rl_keymap[c].type == ISFUNC)
+ {
+ f = _rl_keymap[c].function;
+
+ if (f == rl_reverse_search_history)
+ c = reverse ? -1 : -2;
+ else if (f == rl_forward_search_history)
+ c = !reverse ? -1 : -2;
+ }
+ }
+
+ switch (c)
+ {
+ case ESC:
+ done = 1;
+ continue;
+
+ /* case invoking_key: */
+ case -1:
+ goto search_again;
+
+ /* switch directions */
+ case -2:
+ direction = -direction;
+ reverse = (direction < 0);
+
+ goto do_search;
+
+ case CTRL ('G'):
+ strcpy (rl_line_buffer, lines[orig_line]);
+ rl_point = orig_point;
+ rl_end = strlen (rl_line_buffer);
+ rl_clear_message ();
+ return;
+
+ default:
+ if (c < 32 || c > 126)
+ {
+ rl_execute_next (c);
+ done = 1;
+ continue;
+ }
+ else
+ {
+ if (search_string_index + 2 >= search_string_size)
+ search_string = (char *)xrealloc
+ (search_string, (search_string_size += 128));
+ search_string[search_string_index++] = c;
+ search_string[search_string_index] = '\0';
+ goto do_search;
+
+ search_again:
+
+ if (!search_string_index)
+ continue;
+ else
+ {
+ if (reverse)
+ --index;
+ else
+ if (index != strlen (sline))
+ ++index;
+ else
+ ding ();
+ }
+ do_search:
+
+ while (1)
+ {
+ if (reverse)
+ {
+ while (index >= 0)
+ if (strncmp
+ (search_string, sline + index, search_string_index)
+ == 0)
+ goto string_found;
+ else
+ index--;
+ }
+ else
+ {
+ register int limit =
+ (strlen (sline) - search_string_index) + 1;
+
+ while (index < limit)
+ {
+ if (strncmp (search_string,
+ sline + index,
+ search_string_index) == 0)
+ goto string_found;
+ index++;
+ }
+ }
+
+ next_line:
+ i += direction;
+
+ /* At limit for direction? */
+ if ((reverse && i < 0) ||
+ (!reverse && i == hlen))
+ goto search_failed;
+
+ sline = lines[i];
+ if (reverse)
+ index = strlen (sline);
+ else
+ index = 0;
+
+ /* If the search string is longer than the current
+ line, no match. */
+ if (search_string_index > (int)strlen (sline))
+ goto next_line;
+
+ /* Start actually searching. */
+ if (reverse)
+ index -= search_string_index;
+ }
+
+ search_failed:
+ /* We cannot find the search string. Ding the bell. */
+ ding ();
+ i = last_found_line;
+ break;
+
+ string_found:
+ /* We have found the search string. Just display it. But don't
+ actually move there in the history list until the user accepts
+ the location. */
+ {
+ int line_len;
+
+ line_len = strlen (lines[i]);
+
+ if (line_len >= rl_line_buffer_len)
+ rl_extend_line_buffer (line_len);
+
+ strcpy (rl_line_buffer, lines[i]);
+ rl_point = index;
+ rl_end = line_len;
+ last_found_line = i;
+ rl_display_search
+ (search_string, reverse, (i == orig_line) ? -1 : i);
+ }
+ }
+ }
+ continue;
+ }
+
+ /* The searching is over. The user may have found the string that she
+ was looking for, or else she may have exited a failing search. If
+ INDEX is -1, then that shows that the string searched for was not
+ found. We use this to determine where to place rl_point. */
+ {
+ int now = last_found_line;
+
+ /* First put back the original state. */
+ strcpy (rl_line_buffer, lines[orig_line]);
+
+ /* Free the search string. */
+ free (search_string);
+
+ if (now < orig_line)
+ rl_get_previous_history (orig_line - now);
+ else
+ rl_get_next_history (now - orig_line);
+
+ /* If the index of the "matched" string is less than zero, then the
+ final search string was never matched, so put point somewhere
+ reasonable. */
+ if (index < 0)
+ index = strlen (rl_line_buffer);
+
+ rl_point = index;
+ rl_clear_message ();
+ }
+}
diff --git a/readline/parens.c b/readline/parens.c
new file mode 100644
index 0000000..2c96012
--- /dev/null
+++ b/readline/parens.c
@@ -0,0 +1,115 @@
+/* parens.c -- Implemenation of matching parenthesis feature. */
+
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include "readline.h"
+
+/* Non-zero means try to blink the matching open parenthesis when the
+ close parenthesis is inserted. */
+#if defined (FD_SET)
+int rl_blink_matching_paren = 1;
+#else /* !FD_SET */
+int rl_blink_matching_paren = 0;
+#endif /* !FD_SET */
+
+static int find_matching_open ();
+
+rl_insert_close (count, invoking_key)
+ int count, invoking_key;
+{
+ extern int rl_explicit_arg;
+
+ if (rl_explicit_arg || !rl_blink_matching_paren)
+ rl_insert (count, invoking_key);
+ else
+ {
+#if defined (FD_SET)
+ int orig_point, match_point, ready;
+ struct timeval timer;
+ fd_set readfds;
+
+ rl_insert (1, invoking_key);
+ rl_redisplay ();
+ match_point =
+ find_matching_open (rl_line_buffer, rl_point - 2, invoking_key);
+
+ /* Emacs might message or ring the bell here, but I don't. */
+ if (match_point < 0)
+ return;
+
+ FD_ZERO (&readfds);
+ FD_SET (fileno (rl_instream), &readfds);
+ timer.tv_sec = 1;
+ timer.tv_usec = 500;
+
+ orig_point = rl_point;
+ rl_point = match_point;
+ rl_redisplay ();
+ ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+ rl_point = orig_point;
+#else /* !FD_SET */
+ rl_insert (count, invoking_key);
+#endif /* !FD_SET */
+ }
+}
+
+static int
+find_matching_open (string, from, closer)
+ char *string;
+ int from, closer;
+{
+ register int i;
+ int opener, level, delimiter;
+
+ switch (closer)
+ {
+ case ']': opener = '['; break;
+ case '}': opener = '{'; break;
+ case ')': opener = '('; break;
+ default:
+ return (-1);
+ }
+
+ level = 1; /* The closer passed in counts as 1. */
+ delimiter = 0; /* Delimited state unknown. */
+
+ for (i = from; i > -1; i--)
+ {
+ if (delimiter && (string[i] == delimiter))
+ delimiter = 0;
+ else if ((string[i] == '\'') || (string[i] == '"'))
+ delimiter = rl_line_buffer[i];
+ else if (!delimiter && (string[i] == closer))
+ level++;
+ else if (!delimiter && (string[i] == opener))
+ level--;
+
+ if (!level)
+ break;
+ }
+ return (i);
+}
+
+
+
diff --git a/readline/readline.c b/readline/readline.c
index a8363c5..b05a7c9 100644
--- a/readline/readline.c
+++ b/readline/readline.c
@@ -36,7 +36,13 @@ static char *xmalloc (), *xrealloc ();
#include <sys/file.h>
#include <signal.h>
-#include "sysdep.h"
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else
+#if defined (sparc) && defined (sun)
+#include <alloca.h>
+#endif
+#endif
#define NEW_TTY_DRIVER
#if defined (SYSV) || defined (hpux) || defined (Xenix)
@@ -1497,7 +1503,7 @@ update_line (old, new, current_line)
wsatend = 1; /* flag for trailing whitespace */
ols = oe - 1; /* find last same */
nls = ne - 1;
- while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
+ while ((*ols == *nls) && (ols > ofd) && (nls > nfd))
{
if (*ols != ' ')
wsatend = 0;
@@ -1833,7 +1839,8 @@ init_terminal_io (terminal_name)
return;
}
- PC = tgetstr ("pc", &buffer)? *buffer : 0;
+ BC = tgetstr ("pc", &buffer);
+ PC = buffer ? *buffer : 0;
term_backspace = tgetstr ("le", &buffer);
@@ -2204,12 +2211,12 @@ rl_deprep_terminal ()
int allow_pathname_alphabetic_chars = 0;
char *pathname_alphabetic_chars = "/-_=~.#$";
-char *rindex ();
+
int
alphabetic (c)
int c;
{
-
+ char *rindex ();
if (pure_alphabetic (c) || (numeric (c)))
return (1);
@@ -3322,7 +3329,7 @@ rl_complete_internal (what_to_do)
/* Handle simple case first. What if there is only one answer? */
if (!matches[1])
{
- char *temp;
+ char *rindex (), *temp;
if (rl_filename_completion_desired)
temp = rindex (matches[0], '/');
@@ -3345,7 +3352,7 @@ rl_complete_internal (what_to_do)
is. */
for (i = 1; matches[i]; i++)
{
- char *temp = (char *)NULL;
+ char *rindex (), *temp = (char *)NULL;
/* If we are hacking filenames, then only count the characters
after the last slash in the pathname. */
@@ -3412,7 +3419,7 @@ rl_complete_internal (what_to_do)
}
else
{
- char *temp = (char *)NULL;
+ char *rindex (), *temp = (char *)NULL;
if (rl_filename_completion_desired)
temp = rindex (matches[l], '/');
@@ -4639,7 +4646,7 @@ filename_completion_function (text, state)
/* If we don't have any state, then do some initialization. */
if (!state)
{
- char *temp;
+ char *rindex (), *temp;
if (dirname) free (dirname);
if (filename) free (filename);
@@ -5195,7 +5202,7 @@ rl_parse_and_bind (string)
char *string;
{
extern char *possible_control_prefixes[], *possible_meta_prefixes[];
- char *funname, *kname;
+ char *rindex (), *funname, *kname;
static int substring_member_of_array ();
register int c;
int key, i;
diff --git a/readline/readline.texi b/readline/readline.texi
deleted file mode 100755
index abb6351..0000000
--- a/readline/readline.texi
+++ /dev/null
@@ -1,442 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@comment %**start of header (This is for running Texinfo on a region.)
-@setfilename readline.info
-@settitle Line Editing Commands
-@comment %**end of header (This is for running Texinfo on a region.)
-@synindex fn vr
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* Readline: (readline). The GNU Readline Library.
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-
-@iftex
-@comment finalout
-@end iftex
-
-@ifinfo
-This document describes the GNU Readline Library, a utility for aiding
-in the consitency of user interface across discrete programs that need
-to provide a command line interface.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-pare preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-@setchapternewpage odd
-@titlepage
-@sp 11
-@center @titlefont{GNU Readline Library}
-@sp 2
-@center by Brian Fox
-@sp 2
-@center Version 1.0
-@sp 2
-@center February 1989
-
-@comment Include the Distribution inside the titlepage environment so
-@c that headings are turned off.
-
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1989 Free Software Foundation, Inc.
-
-@sp 2
-This document describes the GNU Readline Library, a utility for aiding
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-@sp 2
-
-Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-
-@end titlepage
-
-@node Top, , ,(DIR)
-@chapter GNU Readline Library
-
-@ifinfo
-This document describes the GNU Readline Library, a utility for aiding
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-@end ifinfo
-
-@menu
-* Command Line Editing:: GNU Readline User's Manual
-* Readline Technical:: GNU Readline Programmer's Manual
-@end menu
-@include inc-read.texi
-@node Readline Technical, , Top, Top
-@chapter Readline Programmer's Manual
-
-This manual describes the interface between the GNU Readline Library and
-user programs. If you are a programmer, and you wish to include the
-features found in GNU Readline in your own programs, such as completion,
-line editing, and interactive history manipulation, this documentation
-is for you.
-
-@menu
-* Default Behaviour:: Using the default behaviour of Readline.
-* Custom Functions:: Adding your own functions to Readline.
-* Custom Completers:: Supplanting or supplementing Readline's
- completion functions.
-* Variable Index:: Index of externally tweakable variables.
-@end menu
-
-@node Default Behaviour, Custom Functions, Readline Technical, Readline Technical
-@section Default Behaviour
-
-Many programs provide a command line interface, such as @code{mail},
-@code{ftp}, and @code{sh}. For such programs, the default behaviour of
-Readline is sufficient. This section describes how to use Readline in
-the simplest way possible, perhaps to replace calls in your code to
-@code{gets ()}.
-
-@findex readline ()
-@cindex readline, function
-The function @code{readline} prints a prompt and then reads and returns
-a single line of text from the user. The line which @code{readline ()}
-returns is allocated with @code{malloc ()}; you should @code{free ()}
-the line when you are done with it. The declaration in ANSI C is
-
-@example
-@code{char *readline (char *@var{prompt});}
-@end example
-or, preferably,
-@example
-@code{#include <readline/readline.h>}
-@end example
-
-So, one might say
-@example
-@code{char *line = readline ("Enter a line: ");}
-@end example
-in order to read a line of text from the user.
-
-The line which is returned has the final newline removed, so only the
-text of the line remains.
-
-If readline encounters an EOF while reading the line, and the line is
-empty at that point, then @code{(char *)NULL} is returned. Otherwise,
-the line is ended just as if a newline was typed.
-
-If you want the user to be able to get at the line later, (with
-@key{C-p} for example), you must call @code{add_history ()} to save the
-line away in a @dfn{history} list of such lines.
-
-@example
-@code{add_history (line)};
-@end example
-
-If you use @code{add_history ()}, you should also
-@code{#include <readline/history.h>}
-For full details on the GNU History Library, see the associated manual.
-
-It is polite to avoid saving empty lines on the history list, since
-no one has a burning need to reuse a blank line. Here is a function
-which usefully replaces the standard @code{gets ()} library function:
-
-@example
-#include <readline/readline.h>
-#include <readline/history.h>
-
-/* A static variable for holding the line. */
-static char *my_gets_line = (char *)NULL;
-
-/* Read a string, and return a pointer to it. Returns NULL on EOF. */
-char *
-my_gets ()
-@{
- /* If the buffer has already been allocated, return the memory
- to the free pool. */
- if (my_gets_line != (char *)NULL)
- free (my_gets_line);
-
- /* Get a line from the user. */
- my_gets_line = readline ("");
-
- /* If the line has any text in it, save it on the history. */
- if (my_get_line && *my_gets_line)
- add_history (my_gets_line);
-
- return (my_gets_line);
-@}
-@end example
-
-The above code gives the user the default behaviour of @key{TAB}
-completion: completion on file names. If you do not want readline to
-complete on filenames, you can change the binding of the @key{TAB} key
-with @code{rl_bind_key ()}.
-
-@findex rl_bind_key ()
-
-@example
-@code{int rl_bind_key (int @var{key}, (int (*)())@var{function});}
-@end example
-
-@code{rl_bind_key ()} takes 2 arguments; @var{key} is the character that
-you want to bind, and @var{function} is the address of the function to
-run when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert ()}
-makes @key{TAB} just insert itself.
-
-@code{rl_bind_key ()} returns non-zero if @var{key} is not a valid
-ASCII character code (between 0 and 255).
-
-@example
-@code{rl_bind_key ('\t', rl_insert);}
-@end example
-
-@node Custom Functions, Custom Completers, Default Behaviour, Readline Technical
-@section Custom Functions
-
-Readline provides a great many functions for manipulating the text of
-the line. But it isn't possible to anticipate the needs of all
-programs. This section describes the various functions and variables
-defined in within the Readline library which allow a user program to add
-customized functionality to Readline.
-
-@menu
-* The Function Type:: C declarations to make code readable.
-* Function Naming:: How to give a function you write a name.
-* Keymaps:: Making keymaps.
-* Binding Keys:: Changing Keymaps.
-* Function Writing:: Variables and calling conventions.
-* Allowing Undoing:: How to make your functions undoable.
-@end menu
-
-@node The Function Type, Function Naming, Custom Functions, Custom Functions
-For the sake of readabilty, we declare a new type of object, called
-@dfn{Function}. `Function' is a C language function which returns an
-@code{int}. The type declaration for `Function' is:
-
-@code{typedef int Function ();}
-
-The reason for declaring this new type is to make it easier to discuss
-pointers to C functions. Let us say we had a variable called @var{func}
-which was a pointer to a function. Instead of the classic C declaration
-
-@code{int (*)()func;}
-
-we have
-
-@code{Function *func;}
-
-@node Function Naming, Keymaps, The Function Type, Custom Functions
-@subsection Naming a Function
-
-The user can dynamically change the bindings of keys while using
-Readline. This is done by representing the function with a descriptive
-name. The user is able to type the descriptive name when referring to
-the function. Thus, in an init file, one might find
-
-@example
-Meta-Rubout: backward-kill-word
-@end example
-
-This binds @key{Meta-Rubout} to the function @emph{descriptively} named
-@code{backward-kill-word}. You, as a programmer, should bind the
-functions you write to descriptive names as well. Here is how to do
-that.
-
-@defun rl_add_defun (char *name, Function *function, int key)
-Add @var{name} to the list of named functions. Make @var{function} be
-the function that gets called. If @var{key} is not -1, then bind it to
-@var{function} using @code{rl_bind_key ()}.
-@end defun
-
-Using this function alone is sufficient for most applications. It is
-the recommended way to add a few functions to the default functions that
-Readline has built in already. If you need to do more or different
-things than adding a function to Readline, you may need to use the
-underlying functions described below.
-
-@node Keymaps, Binding Keys, Function Naming, Custom Functions
-@subsection Selecting a Keymap
-
-Key bindings take place on a @dfn{keymap}. The keymap is the
-association between the keys that the user types and the functions that
-get run. You can make your own keymaps, copy existing keymaps, and tell
-Readline which keymap to use.
-
-@defun rl_make_bare_keymap ()
-Returns a new, empty keymap. The space for the keymap is allocated with
-@code{malloc ()}; you should @code{free ()} it when you are done.
-@end defun
-
-@defun rl_copy_keymap (Keymap map)
-Return a new keymap which is a copy of @var{map}.
-@end defun
-
-@defun rl_make_keymap ()
-Return a new keymap with the printing characters bound to rl_insert,
-the lowercase Meta characters bound to run their equivalents, and
-the Meta digits bound to produce numeric arguments.
-@end defun
-
-@node Binding Keys, Function Writing, Keymaps, Custom Functions
-@subsection Binding Keys
-
-You associate keys with functions through the keymap. Here are
-the functions for doing that.
-
-@defun rl_bind_key (int key, Function *function)
-Binds @var{key} to @var{function} in the currently selected keymap.
-Returns non-zero in the case of an invalid @var{key}.
-@end defun
-
-@defun rl_bind_key_in_map (int key, Function *function, Keymap map)
-Bind @var{key} to @var{function} in @var{map}. Returns non-zero in the case
-of an invalid @var{key}.
-@end defun
-
-@defun rl_unbind_key (int key)
-Make @var{key} do nothing in the currently selected keymap.
-Returns non-zero in case of error.
-@end defun
-
-@defun rl_unbind_key_in_map (int key, Keymap map)
-Make @var{key} be bound to the null function in @var{map}.
-Returns non-zero in case of error.
-@end defun
-
-@node Function Writing, Allowing Undoing, Binding Keys, Custom Functions
-@subsection Writing a New Function
-
-In order to write new functions for Readline, you need to know the
-calling conventions for keyboard invoked functions, and the names of the
-variables that describe the current state of the line gathered so far.
-
-@defvar char *rl_line_buffer
-This is the line gathered so far. You are welcome to modify the
-contents of this, but see Undoing, below.
-@end defvar
-
-@defvar int rl_point
-The offset of the current cursor position in @var{rl_line_buffer}.
-@end defvar
-
-@defvar int rl_end
-The number of characters present in @code{rl_line_buffer}. When
-@code{rl_point} is at the end of the line, then @code{rl_point} and
-@code{rl_end} are equal.
-@end defvar
-
-The calling sequence for a command @code{foo} looks like
-
-@example
-@code{foo (count, key)}
-@end example
-
-where @var{count} is the numeric argument (or 1 if defaulted) and
-@var{key} is the key that invoked this function.
-
-It is completely up to the function as to what should be done with the
-numeric argument; some functions use it as a repeat count, other
-functions as a flag, and some choose to ignore it. In general, if a
-function uses the numeric argument as a repeat count, it should be able
-to do something useful with a negative argument as well as a positive
-argument. At the very least, it should be aware that it can be passed a
-negative argument.
-
-@node Allowing Undoing, , Function Writing, Custom Functions
-@subsection Allowing Undoing
-
-Supporting the undo command is a painless thing to do, and makes your
-function much more useful to the end user. It is certainly easy to try
-something if you know you can undo it. I could use an undo function for
-the stock market.
-
-If your function simply inserts text once, or deletes text once, and it
-calls @code{rl_insert_text ()} or @code{rl_delete_text ()} to do it, then
-undoing is already done for you automatically, and you can safely skip
-this section.
-
-If you do multiple insertions or multiple deletions, or any combination
-of these operations, you will want to group them together into one
-operation. This can be done with @code{rl_begin_undo_group ()} and
-@code{rl_end_undo_group ()}.
-
-@defun rl_begin_undo_group ()
-Begins saving undo information in a group construct. The undo
-information usually comes from calls to @code{rl_insert_text ()} and
-@code{rl_delete_text ()}, but they could be direct calls to
-@code{rl_add_undo ()}.
-@end defun
-
-@defun rl_end_undo_group ()
-Closes the current undo group started with @code{rl_begin_undo_group
-()}. There should be exactly one call to @code{rl_end_undo_group ()}
-for every call to @code{rl_begin_undo_group ()}.
-@end defun
-
-Finally, if you neither insert nor delete text, but directly modify the
-existing text (e.g. change its case), you call @code{rl_modifying ()}
-once, just before you modify the text. You must supply the indices of
-the text range that you are going to modify.
-
-@defun rl_modifying (int start, int end)
-Tell Readline to save the text between @var{start} and @var{end} as a
-single undo unit. It is assumed that subsequent to this call you will
-modify that range of text in some way.
-@end defun
-
-@subsection An Example
-
-Let us say that we are actually going to put an example here.
-
-@node Custom Completers, Variable Index, Custom Functions, Readline Technical
-
-Typically, a program that reads commands from the user has a way of
-disambiguating between commands and data. If your program is one of
-these, then it can provide completion for either commands, or data, or
-both commands and data. The following sections describe how your
-program and Readline cooperate to provide this service to end users.
-
-@menu
-@end menu
-
-@node Variable Index, , Custom Completers, Readline Technical
-@appendix Variable Index
-@printindex vr
-@contents
-
-@bye
-
diff --git a/readline/readline.texinfo b/readline/readline.texinfo
deleted file mode 100755
index 36fe7a9..0000000
--- a/readline/readline.texinfo
+++ /dev/null
@@ -1,434 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@comment %**start of header (This is for running Texinfo on a region.)
-@setfilename readline.info
-@settitle Line Editing Commands
-@comment %**end of header (This is for running Texinfo on a region.)
-@synindex fn vr
-
-@iftex
-@comment finalout
-@end iftex
-
-@ifinfo
-This document describes the GNU Readline Library, a utility for aiding
-in the consitency of user interface across discrete programs that need
-to provide a command line interface.
-
-Copyright (C) 1988 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-pare preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-@setchapternewpage odd
-@titlepage
-@sp 11
-@center @titlefont{GNU Readline Library}
-@sp 2
-@center by Brian Fox
-@sp 2
-@center Version 1.0
-@sp 2
-@center February 1989
-
-@comment Include the Distribution inside the titlepage environment so
-@c that headings are turned off.
-
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1989 Free Software Foundation, Inc.
-
-@sp 2
-This document describes the GNU Readline Library, a utility for aiding
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-@sp 2
-
-Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-
-@end titlepage
-
-@node Top, Readline Top, ,(DIR)
-@chapter GNU Readline Library
-
-@ifinfo
-This document describes the GNU Readline Library, a utility for aiding
-in the consistency of user interface across discrete programs that need
-to provide a command line interface.
-@end ifinfo
-
-@menu
-* Readline Top:: GNU Readline User's Manual
-* Readline Technical:: GNU Readline Programmer's Manual
-@end menu
-@include inc-readline.texinfo
-@node Readline Technical, , Top, Top
-@chapter Readline Programmer's Manual
-
-This manual describes the interface between the GNU Readline Library and
-user programs. If you are a programmer, and you wish to include the
-features found in GNU Readline in your own programs, such as completion,
-line editing, and interactive history manipulation, this documentation
-is for you.
-
-@menu
-* Default Behaviour:: Using the default behaviour of Readline.
-* Custom Functions:: Adding your own functions to Readline.
-* Custom Completers:: Supplanting or supplementing Readline's
- completion functions.
-* Variable Index:: Index of externally tweakable variables.
-@end menu
-
-@node Default Behaviour, Custom Functions, Readline Technical, Readline Technical
-@section Default Behaviour
-
-Many programs provide a command line interface, such as @code{mail},
-@code{ftp}, and @code{sh}. For such programs, the default behaviour of
-Readline is sufficient. This section describes how to use Readline in
-the simplest way possible, perhaps to replace calls in your code to
-@code{gets ()}.
-
-@findex readline ()
-@cindex readline, function
-The function @code{readline} prints a prompt and then reads and returns
-a single line of text from the user. The line which @code{readline ()}
-returns is allocated with @code{malloc ()}; you should @code{free ()}
-the line when you are done with it. The declaration in ANSI C is
-
-@example
-@code{char *readline (char *@var{prompt});}
-@end example
-or, preferably,
-@example
-@code{#include <readline/readline.h>}
-@end example
-
-So, one might say
-@example
-@code{char *line = readline ("Enter a line: ");}
-@end example
-in order to read a line of text from the user.
-
-The line which is returned has the final newline removed, so only the
-text of the line remains.
-
-If readline encounters an EOF while reading the line, and the line is
-empty at that point, then @code{(char *)NULL} is returned. Otherwise,
-the line is ended just as if a newline was typed.
-
-If you want the user to be able to get at the line later, (with
-@key{C-p} for example), you must call @code{add_history ()} to save the
-line away in a @dfn{history} list of such lines.
-
-@example
-@code{add_history (line)};
-@end example
-
-If you use @code{add_history ()}, you should also
-@code{#include <readline/history.h>}
-For full details on the GNU History Library, see the associated manual.
-
-It is polite to avoid saving empty lines on the history list, since
-no one has a burning need to reuse a blank line. Here is a function
-which usefully replaces the standard @code{gets ()} library function:
-
-@example
-#include <readline/readline.h>
-#include <readline/history.h>
-
-/* A static variable for holding the line. */
-static char *my_gets_line = (char *)NULL;
-
-/* Read a string, and return a pointer to it. Returns NULL on EOF. */
-char *
-my_gets ()
-@{
- /* If the buffer has already been allocated, return the memory
- to the free pool. */
- if (my_gets_line != (char *)NULL)
- free (my_gets_line);
-
- /* Get a line from the user. */
- my_gets_line = readline ("");
-
- /* If the line has any text in it, save it on the history. */
- if (my_get_line && *my_gets_line)
- add_history (my_gets_line);
-
- return (my_gets_line);
-@}
-@end example
-
-The above code gives the user the default behaviour of @key{TAB}
-completion: completion on file names. If you do not want readline to
-complete on filenames, you can change the binding of the @key{TAB} key
-with @code{rl_bind_key ()}.
-
-@findex rl_bind_key ()
-
-@example
-@code{int rl_bind_key (int @var{key}, (int (*)())@var{function});}
-@end example
-
-@code{rl_bind_key ()} takes 2 arguments; @var{key} is the character that
-you want to bind, and @var{function} is the address of the function to
-run when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert ()}
-makes @key{TAB} just insert itself.
-
-@code{rl_bind_key ()} returns non-zero if @var{key} is not a valid
-ASCII character code (between 0 and 255).
-
-@example
-@code{rl_bind_key ('\t', rl_insert);}
-@end example
-
-@node Custom Functions, Custom Completers, Default Behaviour, Readline Technical
-@section Custom Functions
-
-Readline provides a great many functions for manipulating the text of
-the line. But it isn't possible to anticipate the needs of all
-programs. This section describes the various functions and variables
-defined in within the Readline library which allow a user program to add
-customized functionality to Readline.
-
-@menu
-* The Function Type:: C declarations to make code readable.
-* Function Naming:: How to give a function you write a name.
-* Keymaps:: Making keymaps.
-* Binding Keys:: Changing Keymaps.
-* Function Writing:: Variables and calling conventions.
-* Allowing Undoing:: How to make your functions undoable.
-@end menu
-
-@node The Function Type, Function Naming, Custom Functions, Custom Functions
-For the sake of readabilty, we declare a new type of object, called
-@dfn{Function}. `Function' is a C language function which returns an
-@code{int}. The type declaration for `Function' is:
-
-@code{typedef int Function ();}
-
-The reason for declaring this new type is to make it easier to discuss
-pointers to C functions. Let us say we had a variable called @var{func}
-which was a pointer to a function. Instead of the classic C declaration
-
-@code{int (*)()func;}
-
-we have
-
-@code{Function *func;}
-
-@node Function Naming, Keymaps, The Function Type, Custom Functions
-@subsection Naming a Function
-
-The user can dynamically change the bindings of keys while using
-Readline. This is done by representing the function with a descriptive
-name. The user is able to type the descriptive name when referring to
-the function. Thus, in an init file, one might find
-
-@example
-Meta-Rubout: backward-kill-word
-@end example
-
-This binds @key{Meta-Rubout} to the function @emph{descriptively} named
-@code{backward-kill-word}. You, as a programmer, should bind the
-functions you write to descriptive names as well. Here is how to do
-that.
-
-@defun rl_add_defun (char *name, Function *function, int key)
-Add @var{name} to the list of named functions. Make @var{function} be
-the function that gets called. If @var{key} is not -1, then bind it to
-@var{function} using @code{rl_bind_key ()}.
-@end defun
-
-Using this function alone is sufficient for most applications. It is
-the recommended way to add a few functions to the default functions that
-Readline has built in already. If you need to do more or different
-things than adding a function to Readline, you may need to use the
-underlying functions described below.
-
-@node Keymaps, Binding Keys, Function Naming, Custom Functions
-@subsection Selecting a Keymap
-
-Key bindings take place on a @dfn{keymap}. The keymap is the
-association between the keys that the user types and the functions that
-get run. You can make your own keymaps, copy existing keymaps, and tell
-Readline which keymap to use.
-
-@defun rl_make_bare_keymap ()
-Returns a new, empty keymap. The space for the keymap is allocated with
-@code{malloc ()}; you should @code{free ()} it when you are done.
-@end defun
-
-@defun rl_copy_keymap (Keymap map)
-Return a new keymap which is a copy of @var{map}.
-@end defun
-
-@defun rl_make_keymap ()
-Return a new keymap with the printing characters bound to rl_insert,
-the lowercase Meta characters bound to run their equivalents, and
-the Meta digits bound to produce numeric arguments.
-@end defun
-
-@node Binding Keys, Function Writing, Keymaps, Custom Functions
-@subsection Binding Keys
-
-You associate keys with functions through the keymap. Here are
-the functions for doing that.
-
-@defun rl_bind_key (int key, Function *function)
-Binds @var{key} to @var{function} in the currently selected keymap.
-Returns non-zero in the case of an invalid @var{key}.
-@end defun
-
-@defun rl_bind_key_in_map (int key, Function *function, Keymap map)
-Bind @var{key} to @var{function} in @var{map}. Returns non-zero in the case
-of an invalid @var{key}.
-@end defun
-
-@defun rl_unbind_key (int key)
-Make @var{key} do nothing in the currently selected keymap.
-Returns non-zero in case of error.
-@end defun
-
-@defun rl_unbind_key_in_map (int key, Keymap map)
-Make @var{key} be bound to the null function in @var{map}.
-Returns non-zero in case of error.
-@end defun
-
-@node Function Writing, Allowing Undoing, Binding Keys, Custom Functions
-@subsection Writing a New Function
-
-In order to write new functions for Readline, you need to know the
-calling conventions for keyboard invoked functions, and the names of the
-variables that describe the current state of the line gathered so far.
-
-@defvar char *rl_line_buffer
-This is the line gathered so far. You are welcome to modify the
-contents of this, but see Undoing, below.
-@end defvar
-
-@defvar int rl_point
-The offset of the current cursor position in @var{rl_line_buffer}.
-@end defvar
-
-@defvar int rl_end
-The number of characters present in @code{rl_line_buffer}. When
-@code{rl_point} is at the end of the line, then @code{rl_point} and
-@code{rl_end} are equal.
-@end defvar
-
-The calling sequence for a command @code{foo} looks like
-
-@example
-@code{foo (count, key)}
-@end example
-
-where @var{count} is the numeric argument (or 1 if defaulted) and
-@var{key} is the key that invoked this function.
-
-It is completely up to the function as to what should be done with the
-numeric argument; some functions use it as a repeat count, other
-functions as a flag, and some choose to ignore it. In general, if a
-function uses the numeric argument as a repeat count, it should be able
-to do something useful with a negative argument as well as a positive
-argument. At the very least, it should be aware that it can be passed a
-negative argument.
-
-@node Allowing Undoing, , Function Writing, Custom Functions
-@subsection Allowing Undoing
-
-Supporting the undo command is a painless thing to do, and makes your
-function much more useful to the end user. It is certainly easy to try
-something if you know you can undo it. I could use an undo function for
-the stock market.
-
-If your function simply inserts text once, or deletes text once, and it
-calls @code{rl_insert_text ()} or @code{rl_delete_text ()} to do it, then
-undoing is already done for you automatically, and you can safely skip
-this section.
-
-If you do multiple insertions or multiple deletions, or any combination
-of these operations, you will want to group them together into one
-operation. This can be done with @code{rl_begin_undo_group ()} and
-@code{rl_end_undo_group ()}.
-
-@defun rl_begin_undo_group ()
-Begins saving undo information in a group construct. The undo
-information usually comes from calls to @code{rl_insert_text ()} and
-@code{rl_delete_text ()}, but they could be direct calls to
-@code{rl_add_undo ()}.
-@end defun
-
-@defun rl_end_undo_group ()
-Closes the current undo group started with @code{rl_begin_undo_group
-()}. There should be exactly one call to @code{rl_end_undo_group ()}
-for every call to @code{rl_begin_undo_group ()}.
-@end defun
-
-Finally, if you neither insert nor delete text, but directly modify the
-existing text (e.g. change its case), you call @code{rl_modifying ()}
-once, just before you modify the text. You must supply the indices of
-the text range that you are going to modify.
-
-@defun rl_modifying (int start, int end)
-Tell Readline to save the text between @var{start} and @var{end} as a
-single undo unit. It is assumed that subsequent to this call you will
-modify that range of text in some way.
-@end defun
-
-@subsection An Example
-
-Let us say that we are actually going to put an example here.
-
-@node Custom Completers, Variable Index, Custom Functions, Readline Technical
-
-Typically, a program that reads commands from the user has a way of
-disambiguating between commands and data. If your program is one of
-these, then it can provide completion for either commands, or data, or
-both commands and data. The following sections describe how your
-program and Readline cooperate to provide this service to end users.
-
-@menu
-@end menu
-
-@node Variable Index, , Custom Completers, Readline Technical
-@appendix Variable Index
-@printindex vr
-@contents
-
-@bye
-
diff --git a/readline/rldefs.h b/readline/rldefs.h
new file mode 100644
index 0000000..83411bc
--- /dev/null
+++ b/readline/rldefs.h
@@ -0,0 +1,250 @@
+/* rldefs.h -- an attempt to isolate some of the system-specific defines
+ for readline. This should be included after any files that define
+ system-specific constants like _POSIX_VERSION or USG. */
+
+/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
+
+ This file contains the Readline Library (the Library), a set of
+ routines for providing Emacs style line input to programs that ask
+ for it.
+
+ The Library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ The Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if !defined (_RLDEFS_H)
+#define _RLDEFS_H
+
+#if defined (__GNUC__)
+# undef alloca
+# define alloca __builtin_alloca
+#else
+# if defined (sparc) || defined (HAVE_ALLOCA_H)
+# include <alloca.h>
+# endif
+#endif
+
+#define NEW_TTY_DRIVER
+#define HAVE_BSD_SIGNALS
+/* #define USE_XON_XOFF */
+
+#ifdef __MSDOS__
+#undef NEW_TTY_DRIVER
+#undef HAVE_BSD_SIGNALS
+#endif
+
+#if defined (__linux__)
+# include <termcap.h>
+#endif /* __linux__ */
+
+/* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
+#if defined (USG) && !defined (hpux)
+# undef HAVE_BSD_SIGNALS
+#endif
+
+/* System V machines use termio. */
+#if !defined (_POSIX_VERSION)
+# if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || defined (DGUX)
+# undef NEW_TTY_DRIVER
+# define TERMIO_TTY_DRIVER
+# include <termio.h>
+# if !defined (TCOON)
+# define TCOON 1
+# endif
+# endif /* USG || hpux || Xenix || sgi || DUGX */
+#endif /* !_POSIX_VERSION */
+
+/* Posix systems use termios and the Posix signal functions. */
+#if defined (_POSIX_VERSION)
+# if !defined (TERMIOS_MISSING)
+# undef NEW_TTY_DRIVER
+# define TERMIOS_TTY_DRIVER
+# include <termios.h>
+# endif /* !TERMIOS_MISSING */
+# define HAVE_POSIX_SIGNALS
+# if !defined (O_NDELAY)
+# define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
+# endif /* O_NDELAY */
+#endif /* _POSIX_VERSION */
+
+/* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
+#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
+# if defined (USGr3)
+# if !defined (HAVE_USG_SIGHOLD)
+# define HAVE_USG_SIGHOLD
+# endif /* !HAVE_USG_SIGHOLD */
+# endif /* USGr3 */
+#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
+
+/* Other (BSD) machines use sgtty. */
+#if defined (NEW_TTY_DRIVER)
+# include <sgtty.h>
+#endif
+
+/* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
+ it is not already defined. It is used both to determine if a
+ special character is disabled and to disable certain special
+ characters. Posix systems should set to 0, USG systems to -1. */
+#if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
+# if defined (_POSIX_VERSION)
+# define _POSIX_VDISABLE 0
+# else /* !_POSIX_VERSION */
+# define _POSIX_VDISABLE -1
+# endif /* !_POSIX_VERSION */
+#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
+
+#if 1
+# define D_NAMLEN(d) strlen ((d)->d_name)
+#else /* !1 */
+
+#if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
+# if !defined (HAVE_DIRENT_H)
+# define HAVE_DIRENT_H
+# endif /* !HAVE_DIRENT_H */
+#endif /* !SHELL && (_POSIX_VERSION || USGr3) */
+
+#if defined (HAVE_DIRENT_H)
+# include <dirent.h>
+# if !defined (direct)
+# define direct dirent
+# endif /* !direct */
+# define D_NAMLEN(d) strlen ((d)->d_name)
+#else /* !HAVE_DIRENT_H */
+# define D_NAMLEN(d) ((d)->d_namlen)
+# if defined (USG)
+# if defined (Xenix)
+# include <sys/ndir.h>
+# else /* !Xenix (but USG...) */
+# include "ndir.h"
+# endif /* !Xenix */
+# else /* !USG */
+# include <sys/dir.h>
+# endif /* !USG */
+#endif /* !HAVE_DIRENT_H */
+#endif /* !1 */
+
+#if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
+# include <sys/stream.h>
+# if defined (HAVE_SYS_PTEM_H)
+# include <sys/ptem.h>
+# endif /* HAVE_SYS_PTEM_H */
+# if defined (HAVE_SYS_PTE_H)
+# include <sys/pte.h>
+# endif /* HAVE_SYS_PTE_H */
+#endif /* USG && TIOCGWINSZ && !Linux */
+
+/* Posix macro to check file in statbuf for directory-ness.
+ This requires that <sys/stat.h> be included before this test. */
+#if defined (S_IFDIR) && !defined (S_ISDIR)
+#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
+#endif
+
+/* Decide which flavor of the header file describing the C library
+ string functions to include and include it. */
+
+#if defined (USG) || defined (NeXT)
+# if !defined (HAVE_STRING_H)
+# define HAVE_STRING_H
+# endif /* !HAVE_STRING_H */
+#endif /* USG || NeXT */
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else /* !HAVE_STRING_H */
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+#if !defined (strchr) && !defined (__STDC__)
+extern char *strchr (), *strrchr ();
+#endif /* !strchr && !__STDC__ */
+
+#if defined (HAVE_VARARGS_H)
+# include <varargs.h>
+#endif /* HAVE_VARARGS_H */
+
+/* This definition is needed by readline.c, rltty.c, and signals.c. */
+/* If on, then readline handles signals in a way that doesn't screw. */
+#define HANDLE_SIGNALS
+
+#if !defined (emacs_mode)
+# define no_mode -1
+# define vi_mode 0
+# define emacs_mode 1
+#endif
+
+/* Define some macros for dealing with assorted signalling disciplines.
+
+ These macros provide a way to use signal blocking and disabling
+ without smothering your code in a pile of #ifdef's.
+
+ SIGNALS_UNBLOCK; Stop blocking all signals.
+
+ {
+ SIGNALS_DECLARE_SAVED (name); Declare a variable to save the
+ signal blocking state.
+ ...
+ SIGNALS_BLOCK (SIGSTOP, name); Block a signal, and save the previous
+ state for restoration later.
+ ...
+ SIGNALS_RESTORE (name); Restore previous signals.
+ }
+
+*/
+
+#ifdef HAVE_POSIX_SIGNALS
+ /* POSIX signals */
+
+#define SIGNALS_UNBLOCK \
+ do { sigset_t set; \
+ sigemptyset (&set); \
+ sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); \
+ } while (0)
+
+#define SIGNALS_DECLARE_SAVED(name) sigset_t name
+
+#define SIGNALS_BLOCK(SIG, saved) \
+ do { sigset_t set; \
+ sigemptyset (&set); \
+ sigaddset (&set, SIG); \
+ sigprocmask (SIG_BLOCK, &set, &saved); \
+ } while (0)
+
+#define SIGNALS_RESTORE(saved) \
+ sigprocmask (SIG_SETMASK, &saved, (sigset_t *)NULL)
+
+
+#else /* HAVE_POSIX_SIGNALS */
+#ifdef HAVE_BSD_SIGNALS
+ /* BSD signals */
+
+#define SIGNALS_UNBLOCK sigsetmask (0)
+#define SIGNALS_DECLARE_SAVED(name) int name
+#define SIGNALS_BLOCK(SIG, saved) saved = sigblock (sigmask (SIG))
+#define SIGNALS_RESTORE(saved) sigsetmask (saved)
+
+
+#else /* HAVE_BSD_SIGNALS */
+ /* None of the Above */
+
+#define SIGNALS_UNBLOCK /* nothing */
+#define SIGNALS_DECLARE_SAVED(name) /* nothing */
+#define SIGNALS_BLOCK(SIG, saved) /* nothing */
+#define SIGNALS_RESTORE(saved) /* nothing */
+
+
+#endif /* HAVE_BSD_SIGNALS */
+#endif /* HAVE_POSIX_SIGNALS */
+
+/* End of signal handling definitions. */
+#endif /* !_RLDEFS_H */
diff --git a/readline/search.c b/readline/search.c
new file mode 100644
index 0000000..ea98c6f
--- /dev/null
+++ b/readline/search.c
@@ -0,0 +1,271 @@
+/* search.c - code for non-incremental searching in emacs and vi modes. */
+
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+
+ This file is part of the Readline Library (the Library), a set of
+ routines for providing Emacs style line input to programs that ask
+ for it.
+
+ The Library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ The Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+
+#if defined (__GNUC__)
+# define alloca __builtin_alloca
+#else
+# if defined (sparc) || defined (HAVE_ALLOCA_H)
+# include <alloca.h>
+# endif
+#endif
+
+#include "readline.h"
+#include "history.h"
+
+extern char *xmalloc (), *xrealloc ();
+
+/* Variables imported from readline.c */
+extern int rl_point, rl_end, rl_line_buffer_len;
+extern Keymap _rl_keymap;
+extern char *rl_prompt;
+extern char *rl_line_buffer;
+extern HIST_ENTRY *saved_line_for_history;
+
+static char *noninc_search_string = (char *) NULL;
+static int noninc_history_pos = 0;
+
+/* Search the history list for STRING starting at absolute history position
+ POS. If STRING begins with `^', the search must match STRING at the
+ beginning of a history line, otherwise a full substring match is performed
+ for STRING. DIR < 0 means to search backwards through the history list,
+ DIR >= 0 means to search forward. */
+static int
+noninc_search_from_pos (string, pos, dir)
+ char *string;
+ int pos, dir;
+{
+ int ret, old;
+
+ old = where_history ();
+ history_set_pos (pos);
+
+ if (*string == '^')
+ ret = history_search_prefix (string + 1, dir);
+ else
+ ret = history_search (string, dir);
+
+ if (ret != -1)
+ ret = where_history ();
+
+ history_set_pos (old);
+ return (ret);
+}
+
+/* Search for a line in the history containing STRING. If DIR is < 0, the
+ search is backwards through previous entries, else through subsequent
+ entries. */
+static void
+noninc_dosearch (string, dir)
+ char *string;
+ int dir;
+{
+ int oldpos, pos;
+ HIST_ENTRY *entry;
+
+ if (string == 0 || *string == 0 || noninc_history_pos < 0)
+ {
+ ding ();
+ return;
+ }
+
+ pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir);
+ if (pos == -1)
+ {
+ /* Search failed, current history position unchanged. */
+ maybe_unsave_line ();
+ rl_clear_message ();
+ rl_point = 0;
+ ding ();
+ return;
+ }
+
+ noninc_history_pos = pos;
+
+ oldpos = where_history ();
+ history_set_pos (noninc_history_pos);
+ entry = current_history ();
+ history_set_pos (oldpos);
+
+ {
+ int line_len;
+
+ line_len = strlen (entry->line);
+ if (line_len >= rl_line_buffer_len)
+ rl_extend_line_buffer (line_len);
+ strcpy (rl_line_buffer, entry->line);
+ }
+
+ rl_undo_list = (UNDO_LIST *)entry->data;
+ rl_end = strlen (rl_line_buffer);
+ rl_point = 0;
+ rl_clear_message ();
+
+ if (saved_line_for_history)
+ free_history_entry (saved_line_for_history);
+ saved_line_for_history = (HIST_ENTRY *)NULL;
+}
+
+/* Search non-interactively through the history list. DIR < 0 means to
+ search backwards through the history of previous commands; otherwise
+ the search is for commands subsequent to the current position in the
+ history list. PCHAR is the character to use for prompting when reading
+ the search string; if not specified (0), it defaults to `:'. */
+static void
+noninc_search (dir, pchar)
+ int dir;
+ int pchar;
+{
+ int saved_point, c, pmtlen;
+ char *p;
+
+ maybe_save_line ();
+ saved_point = rl_point;
+
+ /* Use the line buffer to read the search string. */
+ rl_line_buffer[0] = 0;
+ rl_end = rl_point = 0;
+
+ pmtlen = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
+ p = (char *)alloca (2 + pmtlen);
+ if (pmtlen)
+ strcpy (p, rl_prompt);
+ p[pmtlen] = pchar ? pchar : ':';
+ p[pmtlen + 1] = '\0';
+
+ rl_message (p, 0, 0);
+
+ /* Read the search string. */
+ while (c = rl_read_key ())
+ {
+ switch (c)
+ {
+ case CTRL('H'):
+ case RUBOUT:
+ if (rl_point == 0)
+ {
+ maybe_unsave_line ();
+ rl_clear_message ();
+ rl_point = saved_point;
+ return;
+ }
+ /* FALLTHROUGH */
+
+ case CTRL('W'):
+ case CTRL('U'):
+ rl_dispatch (c, _rl_keymap);
+ break;
+
+ case RETURN:
+ case NEWLINE:
+ goto dosearch;
+ /* NOTREACHED */
+ break;
+
+ case CTRL('C'):
+ case CTRL('G'):
+ maybe_unsave_line ();
+ rl_clear_message ();
+ rl_point = saved_point;
+ ding ();
+ return;
+
+ default:
+ rl_insert (1, c);
+ break;
+ }
+ rl_redisplay ();
+ }
+
+ dosearch:
+ /* If rl_point == 0, we want to re-use the previous search string and
+ start from the saved history position. If there's no previous search
+ string, punt. */
+ if (rl_point == 0)
+ {
+ if (!noninc_search_string)
+ {
+ ding ();
+ return;
+ }
+ }
+ else
+ {
+ /* We want to start the search from the current history position. */
+ noninc_history_pos = where_history ();
+ if (noninc_search_string)
+ free (noninc_search_string);
+ noninc_search_string = savestring (rl_line_buffer);
+ }
+
+ noninc_dosearch (noninc_search_string, dir);
+}
+
+/* Search forward through the history list for a string. If the vi-mode
+ code calls this, KEY will be `?'. */
+rl_noninc_forward_search (count, key)
+ int count, key;
+{
+ if (key == '?')
+ noninc_search (1, '?');
+ else
+ noninc_search (1, 0);
+}
+
+/* Reverse search the history list for a string. If the vi-mode code
+ calls this, KEY will be `/'. */
+rl_noninc_reverse_search (count, key)
+ int count, key;
+{
+ if (key == '/')
+ noninc_search (-1, '/');
+ else
+ noninc_search (-1, 0);
+}
+
+/* Search forward through the history list for the last string searched
+ for. If there is no saved search string, abort. */
+rl_noninc_forward_search_again (count, key)
+ int count, key;
+{
+ if (!noninc_search_string)
+ {
+ ding ();
+ return (-1);
+ }
+ noninc_dosearch (noninc_search_string, 1);
+}
+
+/* Reverse search in the history list for the last string searched
+ for. If there is no saved search string, abort. */
+rl_noninc_reverse_search_again (count, key)
+ int count, key;
+{
+ if (!noninc_search_string)
+ {
+ ding ();
+ return (-1);
+ }
+ noninc_dosearch (noninc_search_string, -1);
+}
diff --git a/readline/shell.c b/readline/shell.c
new file mode 100644
index 0000000..553f3c1
--- /dev/null
+++ b/readline/shell.c
@@ -0,0 +1,138 @@
+/* shell.c -- readline utility functions that are normally provided by
+ bash when readline is linked as part of the shell. */
+
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#if defined (HAVE_UNISTD_H)
+# ifdef _MINIX
+# include <sys/types.h>
+# endif
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+extern char *xmalloc (), *xrealloc ();
+
+#if !defined (SHELL)
+
+#ifdef savestring
+#undef savestring
+#endif
+
+/* Backwards compatibility, now that savestring has been removed from
+ all `public' readline header files. */
+char *
+savestring (s)
+ char *s;
+{
+ return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
+}
+
+/* Does shell-like quoting using single quotes. */
+char *
+single_quote (string)
+ char *string;
+{
+ register int c;
+ char *result, *r, *s;
+
+ result = (char *)xmalloc (3 + (3 * strlen (string)));
+ r = result;
+ *r++ = '\'';
+
+ for (s = string; s && (c = *s); s++)
+ {
+ *r++ = c;
+
+ if (c == '\'')
+ {
+ *r++ = '\\'; /* insert escaped single quote */
+ *r++ = '\'';
+ *r++ = '\''; /* start new quoted string */
+ }
+ }
+
+ *r++ = '\'';
+ *r = '\0';
+
+ return (result);
+}
+
+/* Set the environment variables LINES and COLUMNS to lines and cols,
+ respectively. */
+void
+set_lines_and_columns (lines, cols)
+ int lines, cols;
+{
+ char *b;
+
+#if defined (HAVE_PUTENV)
+ b = xmalloc (24);
+ sprintf (b, "LINES=%d", lines);
+ putenv (b);
+ b = xmalloc (24);
+ sprintf (b, "COLUMNS=%d", cols);
+ putenv (b);
+#else /* !HAVE_PUTENV */
+# if defined (HAVE_SETENV)
+ b = xmalloc (8);
+ sprintf (b, "%d", lines);
+ setenv ("LINES", b, 1);
+ b = xmalloc (8);
+ sprintf (b, "%d", cols);
+ setenv ("COLUMNS", b, 1);
+# endif /* HAVE_SETENV */
+#endif /* !HAVE_PUTENV */
+}
+
+char *
+get_env_value (varname)
+ char *varname;
+{
+ return ((char *)getenv (varname));
+}
+
+#else /* SHELL */
+extern char *get_string_value ();
+
+char *
+get_env_value (varname)
+ char *varname;
+{
+ return get_string_value (varname);
+}
+#endif /* SHELL */
diff --git a/readline/support/install.sh b/readline/support/install.sh
new file mode 100755
index 0000000..ea88212
--- /dev/null
+++ b/readline/support/install.sh
@@ -0,0 +1,235 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/readline/support/mkdirs b/readline/support/mkdirs
new file mode 100755
index 0000000..b79d971
--- /dev/null
+++ b/readline/support/mkdirs
@@ -0,0 +1,32 @@
+#! /bin/sh
+#
+# mkdirs - a work-alike for `mkdir -p'
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+for dir
+do
+
+ test -d "$dir" && continue
+
+ tomake=$dir
+ while test -n "$dir" ; do
+ # dir=${dir%/*}
+ # dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
+ if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
+ tomake="$dir $tomake"
+ else
+ dir=
+ fi
+ done
+
+ for d in $tomake
+ do
+ test -d "$d" && continue
+ echo mkdir "$d"
+ mkdir "$d"
+ done
+done
+
+exit 0
diff --git a/readline/sysdep-aix.h b/readline/sysdep-aix.h
deleted file mode 100644
index 9d7bfc5..0000000
--- a/readline/sysdep-aix.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* System-dependent stuff for AIX 3.1 on RS/6000 */
-
-#pragma alloca
diff --git a/readline/sysdep-norm.h b/readline/sysdep-norm.h
deleted file mode 100644
index e96e431..0000000
--- a/readline/sysdep-norm.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* System-dependent stuff, for ``normal'' systems */
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#if defined (sparc) && defined (sun)
-#include <alloca.h>
-#else
-extern char *alloca ();
-#endif
-#endif
diff --git a/readline/tilde.c b/readline/tilde.c
new file mode 100644
index 0000000..22890f4
--- /dev/null
+++ b/readline/tilde.c
@@ -0,0 +1,396 @@
+/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
+
+/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
+
+ This file is part of GNU Readline, a library for reading lines
+ of text with interactive input and history editing.
+
+ Readline is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 1, or (at your option) any
+ later version.
+
+ Readline is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Readline; see the file COPYING. If not, write to the Free
+ Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if defined (__GNUC__)
+# undef alloca
+# define alloca __builtin_alloca
+#else /* !__GNUC__ */
+# if defined (_AIX)
+ #pragma alloca
+# else /* !_AIX */
+# if defined (HAVE_ALLOCA_H)
+# include <alloca.h>
+# endif /* HAVE_ALLOCA_H */
+# endif /* !AIX */
+#endif /* !__GNUC__ */
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else /* !HAVE_STRING_H */
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+#include <tilde/tilde.h>
+#include <pwd.h>
+
+#if !defined (sgi) && !defined (isc386)
+extern struct passwd *getpwnam (), *getpwuid ();
+#endif /* !sgi */
+
+#if !defined (savestring)
+extern char *xmalloc ();
+# ifndef strcpy
+extern char *strcpy ();
+# endif
+#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#endif /* !savestring */
+
+#if !defined (NULL)
+# if defined (__STDC__)
+# define NULL ((void *) 0)
+# else
+# define NULL 0x0
+# endif /* !__STDC__ */
+#endif /* !NULL */
+
+#if defined (TEST) || defined (STATIC_MALLOC)
+static char *xmalloc (), *xrealloc ();
+#else
+extern char *xmalloc (), *xrealloc ();
+#endif /* TEST || STATIC_MALLOC */
+
+/* The default value of tilde_additional_prefixes. This is set to
+ whitespace preceding a tilde so that simple programs which do not
+ perform any word separation get desired behaviour. */
+static char *default_prefixes[] =
+ { " ~", "\t~", (char *)NULL };
+
+/* The default value of tilde_additional_suffixes. This is set to
+ whitespace or newline so that simple programs which do not
+ perform any word separation get desired behaviour. */
+static char *default_suffixes[] =
+ { " ", "\n", (char *)NULL };
+
+/* If non-null, this contains the address of a function to call if the
+ standard meaning for expanding a tilde fails. The function is called
+ with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
+ which is the expansion, or a NULL pointer if there is no expansion. */
+Function *tilde_expansion_failure_hook = (Function *)NULL;
+
+/* When non-null, this is a NULL terminated array of strings which
+ are duplicates for a tilde prefix. Bash uses this to expand
+ `=~' and `:~'. */
+char **tilde_additional_prefixes = default_prefixes;
+
+/* When non-null, this is a NULL terminated array of strings which match
+ the end of a username, instead of just "/". Bash sets this to
+ `:' and `=~'. */
+char **tilde_additional_suffixes = default_suffixes;
+
+/* Find the start of a tilde expansion in STRING, and return the index of
+ the tilde which starts the expansion. Place the length of the text
+ which identified this tilde starter in LEN, excluding the tilde itself. */
+static int
+tilde_find_prefix (string, len)
+ char *string;
+ int *len;
+{
+ register int i, j, string_len;
+ register char **prefixes = tilde_additional_prefixes;
+
+ string_len = strlen (string);
+ *len = 0;
+
+ if (!*string || *string == '~')
+ return (0);
+
+ if (prefixes)
+ {
+ for (i = 0; i < string_len; i++)
+ {
+ for (j = 0; prefixes[j]; j++)
+ {
+ if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
+ {
+ *len = strlen (prefixes[j]) - 1;
+ return (i + *len);
+ }
+ }
+ }
+ }
+ return (string_len);
+}
+
+/* Find the end of a tilde expansion in STRING, and return the index of
+ the character which ends the tilde definition. */
+static int
+tilde_find_suffix (string)
+ char *string;
+{
+ register int i, j, string_len;
+ register char **suffixes = tilde_additional_suffixes;
+
+ string_len = strlen (string);
+
+ for (i = 0; i < string_len; i++)
+ {
+ if (string[i] == '/' || !string[i])
+ break;
+
+ for (j = 0; suffixes && suffixes[j]; j++)
+ {
+ if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
+ return (i);
+ }
+ }
+ return (i);
+}
+
+/* Return a new string which is the result of tilde expanding STRING. */
+char *
+tilde_expand (string)
+ char *string;
+{
+ char *result, *tilde_expand_word ();
+ int result_size, result_index;
+
+ result_size = result_index = 0;
+ result = (char *)NULL;
+
+ /* Scan through STRING expanding tildes as we come to them. */
+ while (1)
+ {
+ register int start, end;
+ char *tilde_word, *expansion;
+ int len;
+
+ /* Make START point to the tilde which starts the expansion. */
+ start = tilde_find_prefix (string, &len);
+
+ /* Copy the skipped text into the result. */
+ if ((result_index + start + 1) > result_size)
+ result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
+
+ strncpy (result + result_index, string, start);
+ result_index += start;
+
+ /* Advance STRING to the starting tilde. */
+ string += start;
+
+ /* Make END be the index of one after the last character of the
+ username. */
+ end = tilde_find_suffix (string);
+
+ /* If both START and END are zero, we are all done. */
+ if (!start && !end)
+ break;
+
+ /* Expand the entire tilde word, and copy it into RESULT. */
+ tilde_word = (char *)xmalloc (1 + end);
+ strncpy (tilde_word, string, end);
+ tilde_word[end] = '\0';
+ string += end;
+
+ expansion = tilde_expand_word (tilde_word);
+ free (tilde_word);
+
+ len = strlen (expansion);
+ if ((result_index + len + 1) > result_size)
+ result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
+
+ strcpy (result + result_index, expansion);
+ result_index += len;
+ free (expansion);
+ }
+
+ result[result_index] = '\0';
+
+ return (result);
+}
+
+/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
+ tilde. If there is no expansion, call tilde_expansion_failure_hook. */
+char *
+tilde_expand_word (filename)
+ char *filename;
+{
+ char *dirname;
+
+ dirname = filename ? savestring (filename) : (char *)NULL;
+
+ if (dirname && *dirname == '~')
+ {
+ char *temp_name;
+ if (!dirname[1] || dirname[1] == '/')
+ {
+ /* Prepend $HOME to the rest of the string. */
+ char *temp_home = (char *)getenv ("HOME");
+
+ /* If there is no HOME variable, look up the directory in
+ the password database. */
+ if (!temp_home)
+ {
+ struct passwd *entry;
+
+ entry = getpwuid (getuid ());
+ if (entry)
+ temp_home = entry->pw_dir;
+ }
+
+ temp_name = (char *)alloca (1 + strlen (&dirname[1])
+ + (temp_home ? strlen (temp_home) : 0));
+ temp_name[0] = '\0';
+ if (temp_home)
+ strcpy (temp_name, temp_home);
+ strcat (temp_name, &dirname[1]);
+ free (dirname);
+ dirname = savestring (temp_name);
+ }
+ else
+ {
+ struct passwd *user_entry;
+ char *username = (char *)alloca (257);
+ int i, c;
+
+ for (i = 1; c = dirname[i]; i++)
+ {
+ if (c == '/')
+ break;
+ else
+ username[i - 1] = c;
+ }
+ username[i - 1] = '\0';
+
+ if (!(user_entry = getpwnam (username)))
+ {
+ /* If the calling program has a special syntax for
+ expanding tildes, and we couldn't find a standard
+ expansion, then let them try. */
+ if (tilde_expansion_failure_hook)
+ {
+ char *expansion;
+
+ expansion =
+ (char *)(*tilde_expansion_failure_hook) (username);
+
+ if (expansion)
+ {
+ temp_name = (char *)alloca (1 + strlen (expansion)
+ + strlen (&dirname[i]));
+ strcpy (temp_name, expansion);
+ strcat (temp_name, &dirname[i]);
+ free (expansion);
+ goto return_name;
+ }
+ }
+ /* We shouldn't report errors. */
+ }
+ else
+ {
+ temp_name = (char *)alloca (1 + strlen (user_entry->pw_dir)
+ + strlen (&dirname[i]));
+ strcpy (temp_name, user_entry->pw_dir);
+ strcat (temp_name, &dirname[i]);
+ return_name:
+ free (dirname);
+ dirname = savestring (temp_name);
+ }
+ endpwent ();
+ }
+ }
+ return (dirname);
+}
+
+
+#if defined (TEST)
+#undef NULL
+#include <stdio.h>
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char *result, line[512];
+ int done = 0;
+
+ while (!done)
+ {
+ printf ("~expand: ");
+ fflush (stdout);
+
+ if (!gets (line))
+ strcpy (line, "done");
+
+ if ((strcmp (line, "done") == 0) ||
+ (strcmp (line, "quit") == 0) ||
+ (strcmp (line, "exit") == 0))
+ {
+ done = 1;
+ break;
+ }
+
+ result = tilde_expand (line);
+ printf (" --> %s\n", result);
+ free (result);
+ }
+ exit (0);
+}
+
+static void memory_error_and_abort ();
+
+static char *
+xmalloc (bytes)
+ int bytes;
+{
+ char *temp = (char *)malloc (bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+ return (temp);
+}
+
+static char *
+xrealloc (pointer, bytes)
+ char *pointer;
+ int bytes;
+{
+ char *temp;
+
+ if (!pointer)
+ temp = (char *)malloc (bytes);
+ else
+ temp = (char *)realloc (pointer, bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+
+ return (temp);
+}
+
+static void
+memory_error_and_abort ()
+{
+ fprintf (stderr, "readline: Out of virtual memory!\n");
+ abort ();
+}
+
+/*
+ * Local variables:
+ * compile-command: "gcc -g -DTEST -o tilde tilde.c"
+ * end:
+ */
+#endif /* TEST */
diff --git a/readline/tilde.h b/readline/tilde.h
new file mode 100644
index 0000000..4f808fe
--- /dev/null
+++ b/readline/tilde.h
@@ -0,0 +1,33 @@
+/* tilde.h: Externally available variables and function in libtilde.a. */
+
+/* Function pointers can be declared as (Function *)foo. */
+#if !defined (__FUNCTION_DEF)
+# define __FUNCTION_DEF
+typedef int Function ();
+typedef void VFunction ();
+typedef char *CPFunction ();
+typedef char **CPPFunction ();
+#endif /* _FUNCTION_DEF */
+
+/* If non-null, this contains the address of a function to call if the
+ standard meaning for expanding a tilde fails. The function is called
+ with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
+ which is the expansion, or a NULL pointer if there is no expansion. */
+extern Function *tilde_expansion_failure_hook;
+
+/* When non-null, this is a NULL terminated array of strings which
+ are duplicates for a tilde prefix. Bash uses this to expand
+ `=~' and `:~'. */
+extern char **tilde_additional_prefixes;
+
+/* When non-null, this is a NULL terminated array of strings which match
+ the end of a username, instead of just "/". Bash sets this to
+ `:' and `=~'. */
+extern char **tilde_additional_suffixes;
+
+/* Return a new string which is the result of tilde expanding STRING. */
+extern char *tilde_expand ();
+
+/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
+ tilde. If there is no expansion, call tilde_expansion_failure_hook. */
+extern char *tilde_expand_word ();
diff --git a/readline/xmalloc.c b/readline/xmalloc.c
new file mode 100644
index 0000000..0ed49dd
--- /dev/null
+++ b/readline/xmalloc.c
@@ -0,0 +1,76 @@
+/* xmalloc.c -- safe versions of malloc and realloc */
+
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+
+ This file is part of GNU Readline, a library for reading lines
+ of text with interactive input and history editing.
+
+ Readline is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 1, or (at your option) any
+ later version.
+
+ Readline is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Readline; see the file COPYING. If not, write to the Free
+ Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if defined (ALREADY_HAVE_XMALLOC)
+#else
+#include <stdio.h>
+
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
+
+static void memory_error_and_abort ();
+
+/* **************************************************************** */
+/* */
+/* Memory Allocation and Deallocation. */
+/* */
+/* **************************************************************** */
+
+/* Return a pointer to free()able block of memory large enough
+ to hold BYTES number of bytes. If the memory cannot be allocated,
+ print an error message and abort. */
+char *
+xmalloc (bytes)
+ int bytes;
+{
+ char *temp = (char *)malloc (bytes);
+
+ if (!temp)
+ memory_error_and_abort ("xmalloc");
+ return (temp);
+}
+
+char *
+xrealloc (pointer, bytes)
+ char *pointer;
+ int bytes;
+{
+ char *temp;
+
+ if (!pointer)
+ temp = (char *)malloc (bytes);
+ else
+ temp = (char *)realloc (pointer, bytes);
+
+ if (!temp)
+ memory_error_and_abort ("xrealloc");
+ return (temp);
+}
+
+static void
+memory_error_and_abort (fname)
+ char *fname;
+{
+ fprintf (stderr, "%s: Out of virtual memory!\n", fname);
+ abort ();
+}
+#endif /* !ALREADY_HAVE_XMALLOC */