This commit was generated by cvs2svn to compensate for changes in r26497,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
3c8cfbe0c3
176
contrib/libreadline/INSTALL
Normal file
176
contrib/libreadline/INSTALL
Normal file
@ -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.
|
||||
|
83
contrib/libreadline/MANIFEST
Normal file
83
contrib/libreadline/MANIFEST
Normal file
@ -0,0 +1,83 @@
|
||||
#
|
||||
# Master distribution manifest for the standalone readline distribution
|
||||
#
|
||||
doc d
|
||||
examples d
|
||||
support d
|
||||
COPYING f
|
||||
README f
|
||||
MANIFEST f
|
||||
INSTALL f
|
||||
aclocal.m4 f
|
||||
acconfig.h f
|
||||
config.h.in f
|
||||
configure f
|
||||
configure.in f
|
||||
Makefile.in f
|
||||
ChangeLog f
|
||||
ansi_stdlib.h f
|
||||
chardefs.h f
|
||||
history.h f
|
||||
histlib.h f
|
||||
keymaps.h f
|
||||
posixdir.h f
|
||||
posixjmp.h f
|
||||
posixstat.h f
|
||||
readline.h f
|
||||
rlconf.h f
|
||||
rldefs.h f
|
||||
rltty.h f
|
||||
tcap.h f
|
||||
tilde.h f
|
||||
bind.c f
|
||||
complete.c f
|
||||
display.c f
|
||||
emacs_keymap.c f
|
||||
funmap.c f
|
||||
input.c f
|
||||
isearch.c f
|
||||
keymaps.c f
|
||||
kill.c f
|
||||
macro.c f
|
||||
nls.c f
|
||||
parens.c f
|
||||
readline.c f
|
||||
rltty.c f
|
||||
search.c f
|
||||
shell.c f
|
||||
signals.c f
|
||||
terminal.c f
|
||||
tilde.c f
|
||||
undo.c f
|
||||
util.c f
|
||||
vi_keymap.c f
|
||||
vi_mode.c f
|
||||
callback.c f
|
||||
xmalloc.c f
|
||||
history.c f
|
||||
histexpand.c f
|
||||
histfile.c f
|
||||
histsearch.c f
|
||||
support/config.guess f
|
||||
support/config.sub f
|
||||
support/install.sh f
|
||||
support/mkdirs f
|
||||
support/mkdist f
|
||||
doc/Makefile.in f
|
||||
doc/texinfo.tex f
|
||||
doc/rlman.texinfo f
|
||||
doc/rltech.texinfo f
|
||||
doc/rluser.texinfo f
|
||||
doc/hist.texinfo f
|
||||
doc/hstech.texinfo f
|
||||
doc/hsuser.texinfo f
|
||||
doc/readline.3 f
|
||||
doc/texi2dvi f
|
||||
doc/texi2html f
|
||||
examples/Makefile.in f
|
||||
examples/fileman.c f
|
||||
examples/manexamp.c f
|
||||
examples/rltest.c f
|
||||
examples/rl.c f
|
||||
examples/histexamp.c f
|
||||
examples/Inputrc f
|
@ -1,45 +1,96 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Readline and History Libraries. #
|
||||
# #
|
||||
####################################################################
|
||||
## -*- text -*- ##
|
||||
# Master Makefile for the GNU readline library.
|
||||
# Copyright (C) 1994 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 2, 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.
|
||||
RL_LIBRARY_VERSION = @LIBVERSION@
|
||||
RL_LIBRARY_NAME = readline
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
top_srcdir = @top_srcdir@
|
||||
BUILD_DIR = .
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
LD = ld # needed when building shared libraries
|
||||
RANLIB = @RANLIB@
|
||||
AR = @AR@
|
||||
AR = ar
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
# See the file STANDALONE for the -D defines that readline understands
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
|
||||
infodir = @infodir@
|
||||
|
||||
man3dir = $(mandir)/man3
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -tw
|
||||
CTAGS = ctags -tw
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@
|
||||
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
|
||||
# For libraries which include headers from other libraries.
|
||||
INCLUDES = -I. -I$(srcdir) -I$(includedir)
|
||||
|
||||
CCFLAGS = $(DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
# these two options need tweaking for compiler/OS versions other than gcc
|
||||
# and SunOS4
|
||||
PICFLAG= -fpic # -pic for some versions of cc
|
||||
SHLIB_OPTS= -assert pure-text -ldl # -Bshareable for some versions of gcc
|
||||
|
||||
MAJOR= 3
|
||||
# shared library systems like SVR4's do not use minor versions
|
||||
MINOR= .0
|
||||
|
||||
.SUFFIXES: .so
|
||||
|
||||
# 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.
|
||||
.c.o:
|
||||
$(CC) -c $(CCFLAGS) $<
|
||||
|
||||
.c.so:
|
||||
-mv $*.o z$*.o
|
||||
$(CC) -c $(PICFLAG) $(CCFLAGS) $<
|
||||
mv $*.o $@
|
||||
-mv z$*.o $*.o
|
||||
|
||||
# The name of the main library target.
|
||||
LIBRARY_NAME = libreadline.a
|
||||
SHARED_READLINE = libreadline.so.$(MAJOR)$(MINOR)
|
||||
SHARED_HISTORY = libhistory.so.$(MAJOR)$(MINOR)
|
||||
SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY)
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
|
||||
@ -50,20 +101,27 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
|
||||
$(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
|
||||
$(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
|
||||
$(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
|
||||
$(srcdir)/histfile.c $(srcdir)/nls.c \
|
||||
$(srcdir)/tilde.c \
|
||||
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
|
||||
$(srcdir)/shell.c $(srcdir)/tilde.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
|
||||
posixstat.h tilde.h rlconf.h tcap.h
|
||||
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
|
||||
ansi_stdlib.h tcap.h
|
||||
|
||||
HISTOBJ = history.o histexpand.o histfile.o histsearch.o
|
||||
TILDEOBJ= tilde.o
|
||||
HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
|
||||
TILDEOBJ = tilde.o
|
||||
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
|
||||
rltty.o complete.o bind.o isearch.o display.o signals.o \
|
||||
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
|
||||
nls.o xmalloc.o \
|
||||
$(HISTOBJ) $(TILDEOBJ)
|
||||
nls.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
|
||||
|
||||
SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
|
||||
SHARED_TILDEOBJ = tilde.so
|
||||
SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
|
||||
rltty.so complete.so bind.so isearch.so display.so signals.so \
|
||||
util.so kill.so undo.so macro.so input.so callback.so terminal.so \
|
||||
nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ)
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
|
||||
@ -71,122 +129,320 @@ DOCOBJECT = doc/readline.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile
|
||||
|
||||
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
|
||||
|
||||
##########################################################################
|
||||
|
||||
all: libreadline.a libhistory.a
|
||||
shared: $(SHARED_LIBS)
|
||||
|
||||
libreadline.a: $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(RM) $@
|
||||
$(AR) cr $@ $(OBJECTS)
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
libhistory.a: $(HISTOBJ) xmalloc.o
|
||||
$(RM) -f $@
|
||||
$(RM) $@
|
||||
$(AR) cr $@ $(HISTOBJ) xmalloc.o
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
$(SHARED_READLINE): $(SHARED_OBJ)
|
||||
$(RM) $@
|
||||
$(LD) ${SHLIB_OPTS} -o $@ $(SHARED_OBJ)
|
||||
|
||||
$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so
|
||||
$(RM) $@
|
||||
$(LD) ${SHLIB_OPTS} -o $@ $(SHARED_HISTOBJ) xmalloc.so
|
||||
|
||||
readline: $(OBJECTS) readline.h rldefs.h chardefs.h
|
||||
$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
|
||||
|
||||
Makefile makefile: config.status $(srcdir)/Makefile.in
|
||||
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
Makefiles makefiles: config.status $(srcdir)/Makefile.in
|
||||
@for mf in $(CREATED_MAKEFILES); do \
|
||||
CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \
|
||||
done
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
config.h: stamp-h
|
||||
|
||||
stamp-h: config.status $(srcdir)/config.h.in
|
||||
CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
|
||||
echo > $@
|
||||
|
||||
$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
|
||||
cd $(srcdir) && autoconf ## Comment-me-out in distribution
|
||||
|
||||
documentation: force
|
||||
test -d doc || mkdir doc
|
||||
-test -d doc || mkdir doc
|
||||
-( cd doc && $(MAKE) $(MFLAGS) )
|
||||
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install: installdirs libreadline.a
|
||||
for file in $(INSTALLED_HEADERS) ; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file $(includedir)/readline ; \
|
||||
for f in ${INSTALLED_HEADERS}; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
|
||||
done
|
||||
-${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
|
||||
${INSTALL_DATA} libreadline.a $(libdir)/libreadline.a
|
||||
-test -n "$(RANLIB)" && $(RANLIB) -t $(bindir)/libreadline.a
|
||||
-$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
|
||||
$(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
|
||||
-test -n "$(RANLIB)" && -$(RANLIB) -t $(libdir)/libreadline.a
|
||||
-( if test -d doc ; then \
|
||||
cd doc && \
|
||||
${MAKE} ${MFLAGS} infodir=$(infodir) INSTALL_DATA=$(INSTALL_DATA) $@; \
|
||||
fi )
|
||||
|
||||
installdirs: $(topdir)/support/mkdirs
|
||||
$(SHELL) $(topdir)/support/mkdirs $(includedir) \
|
||||
installdirs: $(srcdir)/support/mkdirs
|
||||
-$(SHELL) $(srcdir)/support/mkdirs $(includedir) \
|
||||
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
|
||||
|
||||
uninstall:
|
||||
cd $(includedir)/readline && ${RM} -f ${INSTALLED_HEADERS}
|
||||
cd $(libdir) && ${RM} -f libreadline.a libreadline.old
|
||||
|
||||
tags: force
|
||||
etags $(CSOURCES) $(HSOURCES)
|
||||
-test -n "$(includedir)" && cd $(includedir)/readline && \
|
||||
${RM} ${INSTALLED_HEADERS}
|
||||
-test -n "$(libdir)" && cd $(libdir) && \
|
||||
${RM} libreadline.a libreadline.old $(SHARED_LIBS)
|
||||
|
||||
TAGS: force
|
||||
ctags -x $(CSOURCES) $(HSOURCES) > $@
|
||||
$(ETAGS) $(CSOURCES) $(HSOURCES)
|
||||
|
||||
readline: readline.h rldefs.h chardefs.h
|
||||
readline: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
|
||||
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
|
||||
keymaps.o -ltermcap
|
||||
tags: force
|
||||
$(CTAGS) $(CSOURCES) $(HSOURCES)
|
||||
|
||||
clean: force
|
||||
$(RM) $(OBJECTS) *.a
|
||||
$(RM) $(SHARED_OBJ) $(SHARED_LIBS)
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
distclean realclean maintainer-clean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
$(RM) Makefile
|
||||
|
||||
mostlyclean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
# Dependencies
|
||||
readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h tcap.h
|
||||
readline.o: keymaps.h history.h
|
||||
vi_mode.o: rldefs.h rlconf.h readline.h history.h
|
||||
funmap.o: funmap.c readline.h rlconf.h
|
||||
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
|
||||
history.o: history.h histlib.h
|
||||
histexpand.o: history.h histlib.h
|
||||
histsearch.o: history.h histlib.h
|
||||
histfile.o: history.h histlib.h
|
||||
isearch.o: readline.h history.h
|
||||
search.o: readline.h history.h
|
||||
display.o: readline.h history.h rldefs.h rlconf.h tcap.h
|
||||
complete.o: readline.h rldefs.h rlconf.h posixdir.h posixstat.h
|
||||
rltty.o: rldefs.h rlconf.h readline.h rltty.h
|
||||
bind.o: rldefs.h rlconf.h readline.h history.h
|
||||
signals.o: rldefs.h rlconf.h readline.h history.h
|
||||
parens.o: readline.h
|
||||
kill.o: rldefs.h rlconf.h readline.h history.h
|
||||
macro.o: rldefs.h rlconf.h readline.h history.h
|
||||
undo.o: rldefs.h rlconf.h readline.h history.h
|
||||
input.o: rldefs.h rlconf.h readline.h history.h
|
||||
callback.o: rlconf.h rldefs.h readline.h
|
||||
terminal.o: rlconf.h rldefs.h readline.h tcap.h history.h
|
||||
distclean maintainer-clean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
$(RM) Makefile
|
||||
$(RM) config.status config.h config.cache config.log
|
||||
$(RM) stamp-config stamp-h
|
||||
$(RM) TAGS tags
|
||||
|
||||
bind.o: $(BUILD_DIR)/config.h
|
||||
callback.o: $(BUILD_DIR)/config.h
|
||||
complete.o: $(BUILD_DIR)/config.h
|
||||
display.o: $(BUILD_DIR)/config.h
|
||||
funmap.o: $(BUILD_DIR)/config.h
|
||||
histexpand.o: $(BUILD_DIR)/config.h
|
||||
histfile.o: $(BUILD_DIR)/config.h
|
||||
history.o: $(BUILD_DIR)/config.h
|
||||
histsearch.o: $(BUILD_DIR)/config.h
|
||||
input.o: $(BUILD_DIR)/config.h
|
||||
isearch.o: $(BUILD_DIR)/config.h
|
||||
keymaps.o: $(BUILD_DIR)/config.h
|
||||
kill.o: $(BUILD_DIR)/config.h
|
||||
macro.o: $(BUILD_DIR)/config.h
|
||||
parens.o: $(BUILD_DIR)/config.h
|
||||
readline.o: $(BUILD_DIR)/config.h
|
||||
rltty.o: $(BUILD_DIR)/config.h
|
||||
search.o: $(BUILD_DIR)/config.h
|
||||
signals.o: $(BUILD_DIR)/config.h
|
||||
tilde.o: $(BUILD_DIR)/config.h
|
||||
undo.o: $(BUILD_DIR)/config.h
|
||||
util.o: $(BUILD_DIR)/config.h
|
||||
vi_mode.o: $(BUILD_DIR)/config.h
|
||||
xmalloc.o: $(BUILD_DIR)/config.h
|
||||
info dvi:
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
install-info:
|
||||
check:
|
||||
installcheck:
|
||||
|
||||
dist: force
|
||||
@echo Readline distributions are created using $(srcdir)/support/mkdist.
|
||||
@echo Here is a sample of the necessary commands:
|
||||
@echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION)
|
||||
@echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
|
||||
@echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Dependencies
|
||||
bind.o: ansi_stdlib.h posixstat.h
|
||||
bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
bind.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
bind.o: history.h
|
||||
callback.o: rlconf.h
|
||||
callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
callback.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
complete.o: ansi_stdlib.h posixdir.h posixstat.h
|
||||
complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
complete.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
display.o: ansi_stdlib.h posixstat.h
|
||||
display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
display.o: tcap.h
|
||||
display.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
display.o: history.h
|
||||
funmap.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
funmap.o: rlconf.h ansi_stdlib.h
|
||||
funmap.o: ${BUILD_DIR}/config.h
|
||||
histexpand.o: ansi_stdlib.h
|
||||
histexpand.o: history.h histlib.h
|
||||
histexpand.o: ${BUILD_DIR}/config.h
|
||||
histfile.o: ansi_stdlib.h
|
||||
histfile.o: history.h histlib.h
|
||||
histfile.o: ${BUILD_DIR}/config.h
|
||||
history.o: ansi_stdlib.h
|
||||
history.o: history.h histlib.h
|
||||
history.o: ${BUILD_DIR}/config.h
|
||||
histsearch.o: ansi_stdlib.h
|
||||
histsearch.o: history.h histlib.h
|
||||
histsearch.o: ${BUILD_DIR}/config.h
|
||||
input.o: ansi_stdlib.h
|
||||
input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
input.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
isearch.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
isearch.o: ansi_stdlib.h history.h
|
||||
keymaps.o: emacs_keymap.c vi_keymap.c
|
||||
keymaps.o: keymaps.h chardefs.h rlconf.h ansi_stdlib.h
|
||||
keymaps.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
keymaps.o: ${BUILD_DIR}/config.h
|
||||
kill.o: ansi_stdlib.h
|
||||
kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
kill.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
kill.o: history.h
|
||||
macro.o: ansi_stdlib.h
|
||||
macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
macro.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
macro.o: history.h
|
||||
nls.o: ansi_stdlib.h
|
||||
nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
parens.o: rlconf.h
|
||||
parens.o: ${BUILD_DIR}/config.h
|
||||
parens.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
readline.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
readline.o: history.h
|
||||
readline.o: posixstat.h ansi_stdlib.h posixjmp.h
|
||||
rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
rltty.o: rltty.h
|
||||
rltty.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
search.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
search.o: ansi_stdlib.h history.h
|
||||
signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
signals.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
signals.o: history.h
|
||||
terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
terminal.o: tcap.h
|
||||
terminal.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
terminal.o: history.h
|
||||
tilde.o: ansi_stdlib.h
|
||||
tilde.o: ${BUILD_DIR}/config.h
|
||||
tilde.o: tilde.h
|
||||
undo.o: ansi_stdlib.h
|
||||
undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
undo.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
undo.o: history.h
|
||||
util.o: posixjmp.h ansi_stdlib.h
|
||||
util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
util.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
vi_mode.o: readline.h keymaps.h chardefs.h tilde.h
|
||||
vi_mode.o: history.h ansi_stdlib.h
|
||||
xmalloc.o: ${BUILD_DIR}/config.h
|
||||
xmalloc.o: ansi_stdlib.h
|
||||
|
||||
bind.so: ansi_stdlib.h posixstat.h
|
||||
bind.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
bind.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
bind.so: history.h
|
||||
callback.so: rlconf.h
|
||||
callback.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
callback.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
complete.so: ansi_stdlib.h posixdir.h posixstat.h
|
||||
complete.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
complete.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
display.so: ansi_stdlib.h posixstat.h
|
||||
display.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
display.so: tcap.h
|
||||
display.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
display.so: history.h
|
||||
funmap.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
funmap.so: rlconf.h ansi_stdlib.h
|
||||
funmap.so: ${BUILD_DIR}/config.h
|
||||
histexpand.so: ansi_stdlib.h
|
||||
histexpand.so: history.h histlib.h
|
||||
histexpand.so: ${BUILD_DIR}/config.h
|
||||
histfile.so: ansi_stdlib.h
|
||||
histfile.so: history.h histlib.h
|
||||
histfile.so: ${BUILD_DIR}/config.h
|
||||
history.so: ansi_stdlib.h
|
||||
history.so: history.h histlib.h
|
||||
history.so: ${BUILD_DIR}/config.h
|
||||
histsearch.so: ansi_stdlib.h
|
||||
histsearch.so: history.h histlib.h
|
||||
histsearch.so: ${BUILD_DIR}/config.h
|
||||
input.so: ansi_stdlib.h
|
||||
input.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
input.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
isearch.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
isearch.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
isearch.so: ansi_stdlib.h history.h
|
||||
keymaps.so: emacs_keymap.c vi_keymap.c
|
||||
keymaps.so: keymaps.h chardefs.h rlconf.h ansi_stdlib.h
|
||||
keymaps.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
keymaps.so: ${BUILD_DIR}/config.h
|
||||
kill.so: ansi_stdlib.h
|
||||
kill.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
kill.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
kill.so: history.h
|
||||
macro.so: ansi_stdlib.h
|
||||
macro.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
macro.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
macro.so: history.h
|
||||
nls.so: ansi_stdlib.h
|
||||
nls.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
parens.so: rlconf.h
|
||||
parens.so: ${BUILD_DIR}/config.h
|
||||
parens.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
readline.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
readline.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
readline.so: history.h
|
||||
readline.so: posixstat.h ansi_stdlib.h posixjmp.h
|
||||
rltty.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
rltty.so: rltty.h
|
||||
rltty.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
search.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
search.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
search.so: ansi_stdlib.h history.h
|
||||
signals.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
signals.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
signals.so: history.h
|
||||
terminal.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
terminal.so: tcap.h
|
||||
terminal.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
terminal.so: history.h
|
||||
tilde.so: ansi_stdlib.h
|
||||
tilde.so: ${BUILD_DIR}/config.h
|
||||
tilde.so: tilde.h
|
||||
undo.so: ansi_stdlib.h
|
||||
undo.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
undo.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
undo.so: history.h
|
||||
util.so: posixjmp.h ansi_stdlib.h
|
||||
util.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
util.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
vi_mode.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
vi_mode.so: readline.h keymaps.h chardefs.h tilde.h
|
||||
vi_mode.so: history.h ansi_stdlib.h
|
||||
xmalloc.so: ${BUILD_DIR}/config.h
|
||||
xmalloc.so: ansi_stdlib.h
|
||||
|
||||
readline.so: $(srcdir)/readline.c
|
||||
vi_mode.so: $(srcdir)/vi_mode.c
|
||||
funmap.so: $(srcdir)/funmap.c
|
||||
keymaps.so: $(srcdir)/keymaps.c
|
||||
parens.so: $(srcdir)/parens.c
|
||||
search.so: $(srcdir)/search.c
|
||||
rltty.so: $(srcdir)/rltty.c
|
||||
complete.so: $(srcdir)/complete.c
|
||||
bind.so: $(srcdir)/bind.c
|
||||
isearch.so: $(srcdir)/isearch.c
|
||||
display.so: $(srcdir)/display.c
|
||||
signals.so: $(srcdir)/signals.c
|
||||
util.so: $(srcdir)/util.c
|
||||
kill.so: $(srcdir)/kill.c
|
||||
undo.so: $(srcdir)/undo.c
|
||||
macro.so: $(srcdir)/macro.c
|
||||
input.so: $(srcdir)/input.c
|
||||
callback.so: $(srcdir)/callback.c
|
||||
terminal.so: $(srcdir)/terminal.c
|
||||
nls.so: $(srcdir)/nls.c
|
||||
xmalloc.so: $(srcdir)/xmalloc.c
|
||||
history.so: $(srcdir)/history.c
|
||||
histexpand.so: $(srcdir)/histexpand.c
|
||||
histfile.so: $(srcdir)/histfile.c
|
||||
histsearch.so: $(srcdir)/histsearch.c
|
||||
shell.so: $(srcdir)/shell.c
|
||||
tilde.so: $(srcdir)/tilde.c
|
||||
|
@ -1,6 +1,112 @@
|
||||
This is the distribution of the Gnu Readline library. See the file
|
||||
STANDALONE for a description of the #defines that can be passed via
|
||||
the makefile to build readline on different systems.
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is the Gnu Readline library, version 2.1.
|
||||
|
||||
The Readline library provides a set of functions for use by applications
|
||||
that allow users to edit command lines as they are typed in. Both
|
||||
Emacs and vi editing modes are available. The Readline library includes
|
||||
additional functions to maintain a list of previously-entered command
|
||||
lines, to recall and perhaps reedit those lines, and perform csh-like
|
||||
history expansion on previous commands.
|
||||
|
||||
The history facilites are also placed into a separate library, the
|
||||
History library, as part of the build process. The History library
|
||||
may be used without Readline in applications which desire its
|
||||
capabilities.
|
||||
|
||||
The Readline library is free software, distributed under the terms of
|
||||
the GNU Public License, version 2. For more information, see the file
|
||||
COPYING.
|
||||
|
||||
To build the library, try typing `./configure', then `make'. The
|
||||
configuration process is automated, so no further intervention should
|
||||
be necessary. Readline builds with `gcc' by default if it is
|
||||
available. If you want to use `cc' instead, type
|
||||
|
||||
CC=cc ./configure
|
||||
|
||||
if you are using a Bourne-style shell. If you are not, the following
|
||||
may work:
|
||||
|
||||
env CC=cc ./configure
|
||||
|
||||
Read the file INSTALL in this directory for more information about how
|
||||
to customize and control the build process.
|
||||
|
||||
The file rlconf.h contains defines that enable and disable certain
|
||||
readline features.
|
||||
Readline features.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
There are several example programs that use Readline features in the
|
||||
examples directory. The `rl' program is of particular interest. It
|
||||
is a command-line interface to Readline, suitable for use in shell
|
||||
scripts in place of `read'.
|
||||
|
||||
Shared Libraries
|
||||
================
|
||||
|
||||
There is skeletal support for building shared versions of the
|
||||
Readline and History libraries.
|
||||
|
||||
Typing `make shared' will cause shared versions of the Readline and
|
||||
History libraries to be built on SunOS 4.1.x. For versions of Unix
|
||||
other than SunOS, you will have to make some changes to Makefile.in.
|
||||
The relevant variables are:
|
||||
|
||||
PICFLAG Options to give to the compiler to produce position-independent
|
||||
code. The value `-fpic' works for most versions of gcc.
|
||||
SHLIB_OPTS Options to give to the linker to produce a shared library.
|
||||
The value `-assert pure-text -ldl' works on SunOS 4.1.x.
|
||||
The value `-Bshareable' works for some versions of GNU ld.
|
||||
|
||||
MAJOR The major version number of the shared library. You should
|
||||
not need to change this.
|
||||
MINOR The minor version number of the shared library. Some systems,
|
||||
such as SVR4 and its descendents (e.g., Solaris, Unixware),
|
||||
do not use minor version numbers. For those systems, this
|
||||
variable should be left unset.
|
||||
|
||||
LD The linker. The value of `ld' is correct for SunOS 4.1.x.
|
||||
You may need to change it to `gcc'; make sure to change
|
||||
SHLIB_OPTS if you do so.
|
||||
|
||||
Once you have edited Makefile.in, type `make Makefile' to rebuild the
|
||||
Makefile, then `make shared' to build the shared libraries.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
The documentation for the Readline and History libraries appears in the
|
||||
`doc' subdirectory. There are two texinfo files and a Unix-style manual
|
||||
page describing the programming facilities available in the Readline
|
||||
library. The texinfo files include both user and programmer's manuals.
|
||||
|
||||
Reporting Bugs
|
||||
==============
|
||||
|
||||
Bug reports for Readline should be sent to:
|
||||
|
||||
bug-readline@prep.ai.mit.edu
|
||||
|
||||
When reporting a bug, please include the following information:
|
||||
|
||||
* the version number and release status of Readline (e.g., 2.1-release)
|
||||
* the machine and OS that it is running on
|
||||
* a list of the compilation flags or the contents of `config.h', if
|
||||
appropriate
|
||||
* a description of the bug
|
||||
* a recipe for recreating the bug reliably
|
||||
* a fix for the bug if you have one!
|
||||
|
||||
If you would like to contact the Readline maintainer directly, send mail
|
||||
to bash-maintainers@prep.ai.mit.edu.
|
||||
|
||||
Since Readline is developed along with bash, the bug-bash@prep.ai.mit.edu
|
||||
mailing list (mirrored to the Usenet newsgroup gnu.bash.bug) often contains
|
||||
Readline bug reports and fixes.
|
||||
|
||||
Chet Ramey
|
||||
chet@po.cwru.edu
|
||||
|
30
contrib/libreadline/acconfig.h
Normal file
30
contrib/libreadline/acconfig.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* Definitions pulled in from aclocal.m4. */
|
||||
#undef VOID_SIGHANDLER
|
||||
|
||||
#undef TIOCGWINSZ_IN_SYS_IOCTL
|
||||
|
||||
#undef TIOCSTAT_IN_SYS_IOCTL
|
||||
|
||||
#undef HAVE_GETPW_DECLS
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
1096
contrib/libreadline/aclocal.m4
vendored
Normal file
1096
contrib/libreadline/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -89,11 +89,16 @@ extern Keymap _rl_keymap;
|
||||
|
||||
extern char *possible_control_prefixes[], *possible_meta_prefixes[];
|
||||
|
||||
/* Functions imported from funmap.c */
|
||||
extern char **rl_funmap_names ();
|
||||
extern int rl_add_funmap_entry ();
|
||||
|
||||
/* Functions imported from util.c */
|
||||
extern char *_rl_strindex ();
|
||||
|
||||
/* Functions imported from shell.c */
|
||||
extern char *get_env_value ();
|
||||
|
||||
/* Variables exported by this file. */
|
||||
Keymap rl_binding_keymap;
|
||||
|
||||
@ -202,7 +207,7 @@ rl_set_key (keyseq, function, map)
|
||||
Function *function;
|
||||
Keymap map;
|
||||
{
|
||||
return (rl_generic_bind (ISFUNC, keyseq, function, map));
|
||||
return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
|
||||
}
|
||||
|
||||
/* Bind the key sequence represented by the string KEYSEQ to
|
||||
@ -381,7 +386,7 @@ rl_untranslate_keyseq (seq)
|
||||
kseq[i++] = '\\';
|
||||
kseq[i++] = 'C';
|
||||
kseq[i++] = '-';
|
||||
c = UNCTRL (c);
|
||||
c = _rl_to_lower (UNCTRL (c));
|
||||
}
|
||||
else if (c == RUBOUT)
|
||||
{
|
||||
@ -394,7 +399,7 @@ rl_untranslate_keyseq (seq)
|
||||
if (c == ESC)
|
||||
{
|
||||
kseq[i++] = '\\';
|
||||
kseq[i++] = 'e';
|
||||
c = 'e';
|
||||
}
|
||||
else if (c == '\\' || c == '"')
|
||||
{
|
||||
@ -406,6 +411,53 @@ rl_untranslate_keyseq (seq)
|
||||
return kseq;
|
||||
}
|
||||
|
||||
static char *
|
||||
_rl_untranslate_macro_value (seq)
|
||||
char *seq;
|
||||
{
|
||||
char *ret, *r, *s;
|
||||
int c;
|
||||
|
||||
r = ret = xmalloc (7 * strlen (seq) + 1);
|
||||
for (s = seq; *s; s++)
|
||||
{
|
||||
c = *s;
|
||||
if (META_CHAR (c))
|
||||
{
|
||||
*r++ = '\\';
|
||||
*r++ = 'M';
|
||||
*r++ = '-';
|
||||
c = UNMETA (c);
|
||||
}
|
||||
else if (CTRL_CHAR (c) && c != ESC)
|
||||
{
|
||||
*r++ = '\\';
|
||||
*r++ = 'C';
|
||||
*r++ = '-';
|
||||
c = _rl_to_lower (UNCTRL (c));
|
||||
}
|
||||
else if (c == RUBOUT)
|
||||
{
|
||||
*r++ = '\\';
|
||||
*r++ = 'C';
|
||||
*r++ = '-';
|
||||
c = '?';
|
||||
}
|
||||
|
||||
if (c == ESC)
|
||||
{
|
||||
*r++ = '\\';
|
||||
c = 'e';
|
||||
}
|
||||
else if (c == '\\' || c == '"')
|
||||
*r++ = '\\';
|
||||
|
||||
*r++ = (unsigned char)c;
|
||||
}
|
||||
*r = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Return a pointer to the function that STRING represents.
|
||||
If STRING doesn't have a matching function, then a NULL pointer
|
||||
is returned. */
|
||||
@ -523,7 +575,7 @@ rl_read_init_file (filename)
|
||||
{
|
||||
filename = last_readline_init_file;
|
||||
if (filename == 0)
|
||||
filename = getenv ("INPUTRC");
|
||||
filename = get_env_value ("INPUTRC");
|
||||
if (filename == 0)
|
||||
filename = DEFAULT_INPUTRC;
|
||||
}
|
||||
@ -990,14 +1042,14 @@ rl_parse_and_bind (string)
|
||||
/* Temporary. Handle old-style keyname with macro-binding. */
|
||||
if (*funname == '\'' || *funname == '"')
|
||||
{
|
||||
char seq[2];
|
||||
unsigned char useq[2];
|
||||
int fl = strlen (funname);
|
||||
|
||||
seq[0] = key; seq[1] = '\0';
|
||||
useq[0] = key; useq[1] = '\0';
|
||||
if (fl && funname[fl - 1] == *funname)
|
||||
funname[fl - 1] = '\0';
|
||||
|
||||
rl_macro_bind (seq, &funname[1], _rl_keymap);
|
||||
rl_macro_bind (useq, &funname[1], _rl_keymap);
|
||||
}
|
||||
#if defined (PREFIX_META_HACK)
|
||||
/* Ugly, but working hack to keep prefix-meta around. */
|
||||
@ -1528,6 +1580,8 @@ int
|
||||
rl_dump_functions (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_dispatching)
|
||||
fprintf (rl_outstream, "\r\n");
|
||||
rl_function_dumper (rl_explicit_arg);
|
||||
rl_on_new_line ();
|
||||
return (0);
|
||||
@ -1549,7 +1603,11 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
|
||||
{
|
||||
case ISMACR:
|
||||
keyname = _rl_get_keyname (key);
|
||||
#if 0
|
||||
out = (char *)map[key].function;
|
||||
#else
|
||||
out = _rl_untranslate_macro_value ((char *)map[key].function);
|
||||
#endif
|
||||
if (print_readably)
|
||||
fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
|
||||
keyname,
|
||||
@ -1559,6 +1617,9 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
|
||||
keyname,
|
||||
out ? out : "");
|
||||
free (keyname);
|
||||
#if 1
|
||||
free (out);
|
||||
#endif
|
||||
break;
|
||||
case ISFUNC:
|
||||
break;
|
||||
@ -1604,6 +1665,8 @@ int
|
||||
rl_dump_macros (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_dispatching)
|
||||
fprintf (rl_outstream, "\r\n");
|
||||
rl_macro_dumper (rl_explicit_arg);
|
||||
rl_on_new_line ();
|
||||
return (0);
|
||||
@ -1674,6 +1737,8 @@ int
|
||||
rl_dump_variables (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_dispatching)
|
||||
fprintf (rl_outstream, "\r\n");
|
||||
rl_variable_dumper (rl_explicit_arg);
|
||||
rl_on_new_line ();
|
||||
return (0);
|
||||
|
@ -39,6 +39,7 @@
|
||||
extern void readline_internal_startup ();
|
||||
extern char *readline_internal_teardown ();
|
||||
extern int readline_internal_char ();
|
||||
extern void _rl_init_line_state ();
|
||||
|
||||
extern int _rl_meta_flag;
|
||||
extern char *rl_prompt;
|
||||
@ -120,6 +121,10 @@ rl_callback_read_char ()
|
||||
in_handler = 0;
|
||||
(*rl_linefunc) (line);
|
||||
|
||||
/* If the user did not clear out the line, do it for him. */
|
||||
if (rl_line_buffer[0])
|
||||
_rl_init_line_state ();
|
||||
|
||||
/* Redisplay the prompt if readline_handler_{install,remove} not called. */
|
||||
if (in_handler == 0 && rl_linefunc)
|
||||
_rl_callback_newline ();
|
||||
|
138
contrib/libreadline/config.h.in
Normal file
138
contrib/libreadline/config.h.in
Normal file
@ -0,0 +1,138 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* 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 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
|
2458
contrib/libreadline/configure
vendored
Executable file
2458
contrib/libreadline/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
82
contrib/libreadline/configure.in
Normal file
82
contrib/libreadline/configure.in
Normal file
@ -0,0 +1,82 @@
|
||||
dnl
|
||||
dnl Configure script for readline library
|
||||
dnl
|
||||
dnl report bugs to chet@po.cwru.edu
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([for Readline 2.1, version 2.04, from autoconf version] AC_ACVERSION)
|
||||
LIBVERSION=2.1
|
||||
|
||||
AC_INIT(readline.h)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl make sure we are using a recent autoconf version
|
||||
AC_PREREQ(2.10)
|
||||
|
||||
AC_CONFIG_AUX_DIR(./support)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
# We want these before the checks, so the checks can modify their values.
|
||||
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
|
||||
test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
|
||||
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_RETSIGTYPE
|
||||
|
||||
AC_HEADER_STAT
|
||||
AC_HEADER_DIRENT
|
||||
|
||||
AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
|
||||
|
||||
AC_FUNC_STRCOLL
|
||||
|
||||
AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h \
|
||||
sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
|
||||
termcap.h termios.h termio.h sys/file.h locale.h)
|
||||
|
||||
BASH_SIGNAL_CHECK
|
||||
BASH_REINSTALL_SIGHANDLERS
|
||||
|
||||
BASH_FUNC_POSIX_SETJMP
|
||||
BASH_FUNC_LSTAT
|
||||
BASH_CHECK_GETPW_FUNCS
|
||||
BASH_FUNC_STRCOLL
|
||||
|
||||
BASH_TYPE_SIGHANDLER
|
||||
BASH_HAVE_TIOCGWINSZ
|
||||
BASH_HAVE_TIOCSTAT
|
||||
BASH_HAVE_FIONREAD
|
||||
BASH_MISC_SPEED_T
|
||||
BASH_STRUCT_DIRENT_D_INO
|
||||
BASH_STRUCT_DIRENT_D_FILENO
|
||||
|
||||
case "$host_cpu" in
|
||||
*cray*) LOCAL_CFLAGS=-DCRAY ;;
|
||||
esac
|
||||
|
||||
case "$host_os" in
|
||||
isc*) LOCAL_CFLAGS=-Disc386 ;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(LOCAL_CFLAGS)
|
||||
AC_SUBST(LOCAL_DEFS)
|
||||
|
||||
AC_SUBST(host_cpu)
|
||||
AC_SUBST(host_os)
|
||||
|
||||
AC_SUBST(LIBVERSION)
|
||||
|
||||
AC_OUTPUT([Makefile doc/Makefile examples/Makefile],
|
||||
[
|
||||
# Makefile uses this timestamp file to record whether config.h is up to date.
|
||||
echo > stamp-h
|
||||
])
|
@ -25,20 +25,26 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include "posixstat.h"
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include "posixstat.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (__GO32__)
|
||||
# include <go32.h>
|
||||
# include <pc.h>
|
||||
#endif /* __GO32__ */
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
@ -69,7 +75,8 @@ extern void _rl_output_some_chars ();
|
||||
extern int _rl_output_character_function ();
|
||||
extern int _rl_backspace ();
|
||||
|
||||
extern char *term_clreol, *term_im, *term_ic, *term_ei, *term_DC;
|
||||
extern char *term_clreol, *term_clrpag;
|
||||
extern char *term_im, *term_ic, *term_ei, *term_DC;
|
||||
extern char *term_up, *term_dc, *term_cr, *term_IC;
|
||||
extern int screenheight, screenwidth, screenchars;
|
||||
extern int terminal_can_insert, _rl_term_autowrap;
|
||||
@ -78,8 +85,9 @@ extern int terminal_can_insert, _rl_term_autowrap;
|
||||
by this file. */
|
||||
void _rl_move_cursor_relative (), _rl_output_some_chars ();
|
||||
void _rl_move_vert ();
|
||||
void _rl_clear_to_eol (), _rl_clear_screen ();
|
||||
|
||||
static void update_line (), clear_to_eol (), space_to_eol ();
|
||||
static void update_line (), space_to_eol ();
|
||||
static void delete_chars (), insert_some_chars ();
|
||||
static void cr ();
|
||||
|
||||
@ -302,7 +310,7 @@ rl_redisplay ()
|
||||
register int in, out, c, linenum, cursor_linenum;
|
||||
register char *line;
|
||||
int c_pos, inv_botlin, lb_botlin, lb_linenum;
|
||||
int newlines, lpos;
|
||||
int newlines, lpos, temp;
|
||||
char *prompt_this_line;
|
||||
|
||||
if (!readline_echoing_p)
|
||||
@ -405,8 +413,19 @@ rl_redisplay ()
|
||||
|
||||
/* inv_lbreaks[i] is where line i starts in the buffer. */
|
||||
inv_lbreaks[newlines = 0] = 0;
|
||||
lpos = out - wrap_offset;
|
||||
|
||||
for (in = 0, lpos = out - wrap_offset; in < rl_end; in++)
|
||||
/* XXX - what if lpos is already >= screenwidth before we start drawing the
|
||||
contents of the command line? */
|
||||
while (lpos >= screenwidth)
|
||||
{
|
||||
temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
|
||||
inv_lbreaks[++newlines] = temp;
|
||||
lpos -= screenwidth;
|
||||
}
|
||||
|
||||
lb_linenum = 0;
|
||||
for (in = 0; in < rl_end; in++)
|
||||
{
|
||||
c = (unsigned char)rl_line_buffer[in];
|
||||
|
||||
@ -432,8 +451,6 @@ rl_redisplay ()
|
||||
|
||||
if (lpos + 4 >= screenwidth)
|
||||
{
|
||||
register int temp;
|
||||
|
||||
temp = screenwidth - lpos;
|
||||
inv_lbreaks[++newlines] = out + temp;
|
||||
lpos = 4 - temp;
|
||||
@ -557,7 +574,7 @@ rl_redisplay ()
|
||||
{
|
||||
nleft = screenwidth + wrap_offset - _rl_last_c_pos;
|
||||
if (nleft)
|
||||
clear_to_eol (nleft);
|
||||
_rl_clear_to_eol (nleft);
|
||||
}
|
||||
|
||||
/* Since the new first line is now visible, save its length. */
|
||||
@ -575,7 +592,7 @@ rl_redisplay ()
|
||||
tt = VIS_CHARS (linenum);
|
||||
_rl_move_vert (linenum);
|
||||
_rl_move_cursor_relative (0, tt);
|
||||
clear_to_eol
|
||||
_rl_clear_to_eol
|
||||
((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth);
|
||||
}
|
||||
}
|
||||
@ -710,7 +727,7 @@ rl_redisplay ()
|
||||
t < visible_first_line_len)
|
||||
{
|
||||
nleft = screenwidth - t;
|
||||
clear_to_eol (nleft);
|
||||
_rl_clear_to_eol (nleft);
|
||||
}
|
||||
visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
|
||||
if (visible_first_line_len > screenwidth)
|
||||
@ -962,7 +979,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
if (_rl_term_autowrap && current_line < inv_botlin)
|
||||
space_to_eol (lendiff);
|
||||
else
|
||||
clear_to_eol (lendiff);
|
||||
_rl_clear_to_eol (lendiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1293,16 +1310,14 @@ _rl_erase_at_end_of_line (l)
|
||||
|
||||
/* Clear to the end of the line. COUNT is the minimum
|
||||
number of character spaces to clear, */
|
||||
static void
|
||||
clear_to_eol (count)
|
||||
void
|
||||
_rl_clear_to_eol (count)
|
||||
int count;
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
if (term_clreol)
|
||||
{
|
||||
tputs (term_clreol, 1, _rl_output_character_function);
|
||||
}
|
||||
else
|
||||
tputs (term_clreol, 1, _rl_output_character_function);
|
||||
else if (count)
|
||||
#endif /* !__GO32__ */
|
||||
space_to_eol (count);
|
||||
}
|
||||
@ -1321,6 +1336,17 @@ space_to_eol (count)
|
||||
_rl_last_c_pos += count;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_clear_screen ()
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
if (term_clrpag)
|
||||
tputs (term_clrpag, 1, _rl_output_character_function);
|
||||
else
|
||||
#endif /* !__GO32__ */
|
||||
crlf ();
|
||||
}
|
||||
|
||||
/* Insert COUNT characters from STRING to the output stream. */
|
||||
static void
|
||||
insert_some_chars (string, count)
|
||||
@ -1420,7 +1446,7 @@ _rl_update_final ()
|
||||
/* If the cursor is the only thing on an otherwise-blank last line,
|
||||
compensate so we don't print an extra CRLF. */
|
||||
if (_rl_vis_botlin && _rl_last_c_pos == 0 &&
|
||||
visible_line[inv_lbreaks[_rl_vis_botlin]+1] == 0)
|
||||
visible_line[vis_lbreaks[_rl_vis_botlin]] == 0)
|
||||
{
|
||||
_rl_vis_botlin--;
|
||||
full_lines = 1;
|
||||
@ -1432,7 +1458,7 @@ _rl_update_final ()
|
||||
char *last_line;
|
||||
last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
|
||||
_rl_move_cursor_relative (screenwidth - 1, last_line);
|
||||
clear_to_eol (0);
|
||||
_rl_clear_to_eol (0);
|
||||
putc (last_line[screenwidth - 1], rl_outstream);
|
||||
}
|
||||
_rl_vis_botlin = 0;
|
||||
|
123
contrib/libreadline/doc/Makefile.in
Normal file
123
contrib/libreadline/doc/Makefile.in
Normal file
@ -0,0 +1,123 @@
|
||||
# This makefile for Readline library documentation is in -*- text -*- mode.
|
||||
# Emacs likes it that way.
|
||||
top_srcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
infodir = @infodir@
|
||||
|
||||
mandir = @mandir@
|
||||
man3dir = $(mandir)/man3
|
||||
|
||||
RM = rm -f
|
||||
|
||||
TEXINPUTDIR = $(srcdir)
|
||||
|
||||
MAKEINFO = makeinfo
|
||||
TEXI2DVI = $(srcdir)/texi2dvi
|
||||
TEXI2HTML = $(srcdir)/texi2html
|
||||
QUIETPS = #set this to -q to shut up dvips
|
||||
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
|
||||
$(srcdir)/rltech.texinfo
|
||||
HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
|
||||
$(srcdir)/hstech.texinfo
|
||||
|
||||
# This should be a program that converts troff to an ascii-readable format
|
||||
NROFF = groff -Tascii
|
||||
|
||||
# This should be a program that converts troff to postscript
|
||||
GROFF = groff
|
||||
|
||||
DVIOBJ = readline.dvi history.dvi
|
||||
INFOOBJ = readline.info history.info
|
||||
PSOBJ = readline.ps history.ps
|
||||
HTMLOBJ = readline.html history.html
|
||||
TEXTOBJ = readline.0
|
||||
|
||||
CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ)
|
||||
|
||||
.SUFFIXES: .0 .3 .ps .txt .dvi
|
||||
|
||||
.3.0:
|
||||
$(RM) $@
|
||||
-${NROFF} -man $< > $@
|
||||
|
||||
all: info dvi html ps text
|
||||
nodvi: info html text
|
||||
|
||||
readline.dvi: $(RLSRC)
|
||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texinfo
|
||||
mv rlman.dvi readline.dvi
|
||||
|
||||
readline.info: $(RLSRC)
|
||||
$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
|
||||
|
||||
history.dvi: ${HISTSRC}
|
||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
|
||||
mv hist.dvi history.dvi
|
||||
|
||||
history.info: ${HISTSRC}
|
||||
$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/hist.texinfo
|
||||
|
||||
readline.ps: readline.dvi
|
||||
$(RM) $@
|
||||
$(DVIPS) readline.dvi
|
||||
|
||||
history.ps: history.dvi
|
||||
$(RM) $@
|
||||
$(DVIPS) history.dvi
|
||||
|
||||
readline.html: ${RLSRC}
|
||||
$(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
|
||||
$(RM) rlman.html rlman_toc.html
|
||||
|
||||
history.html: ${HISTSRC}
|
||||
$(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
|
||||
$(RM) hist.html hist_toc.html
|
||||
|
||||
info: $(INFOOBJ)
|
||||
dvi: $(DVIOBJ)
|
||||
ps: $(PSOBJ)
|
||||
html: $(HTMLOBJ)
|
||||
text: $(TEXTOBJ)
|
||||
|
||||
readline.0: $(srcdir)/readline.3
|
||||
|
||||
clean:
|
||||
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
|
||||
*.fns *.kys *.tps *.vrs *.o core
|
||||
|
||||
distclean: clean
|
||||
$(RM) $(CREATED_DOCS)
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
maintainer-clean: clean
|
||||
$(RM) $(CREATED_DOCS)
|
||||
|
||||
installdirs: $(top_srcdir)/support/mkdirs
|
||||
-$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
|
||||
|
||||
install: installdirs info
|
||||
${INSTALL_DATA} readline.info $(infodir)/readline.info
|
||||
${INSTALL_DATA} history.info $(infodir)/history.info
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
install-info --dir-file=$(infodir)/dir $(infodir)/readline.info ; \
|
||||
install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \
|
||||
else true; fi
|
||||
-${INSTALL_DATA} $(srcdir)/readline.3 $(man3dir)/readline.3
|
||||
|
||||
uninstall:
|
||||
$(RM) $(infodir)/readline.info
|
||||
$(RM) $(infodir)/history.info
|
||||
$(RM) $(man3dir)/readline.3
|
@ -415,6 +415,17 @@ If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {Function *} history_inhibit_expansion_function
|
||||
This should be set to the address of a function that takes two arguments:
|
||||
a @code{char *} (@var{string}) and an integer index into that string (@var{i}).
|
||||
It should return a non-zero value if the history expansion starting at
|
||||
@var{string[i]} should not be performed; zero if the expansion should
|
||||
be done.
|
||||
It is intended for use by applications like Bash that use the history
|
||||
expansion character for additional purposes.
|
||||
By default, this variable is set to NULL.
|
||||
@end deftypevar
|
||||
|
||||
@node History Programming Example
|
||||
@section History Programming Example
|
||||
|
||||
|
@ -312,7 +312,7 @@ to get a character from the input stream. By default, it is set to
|
||||
(@pxref{Utility Functions}).
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {Function *} rl_redisplay_function
|
||||
@deftypevar {VFunction *} rl_redisplay_function
|
||||
If non-zero, @code{readline} will call indirectly through this pointer
|
||||
to update the display with the current contents of the editing buffer.
|
||||
By default, it is set to @code{rl_redisplay}, the default @code{readline}
|
||||
@ -417,6 +417,11 @@ Return the keymap matching @var{name}. @var{name} is one which would
|
||||
be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char *} rl_get_keymap_name (Keymap keymap)
|
||||
Return the name matching @var{keymap}. @var{name} is one which would
|
||||
be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
|
||||
@end deftypefun
|
||||
|
||||
@node Binding Keys
|
||||
@subsection Binding Keys
|
||||
|
||||
@ -576,7 +581,7 @@ that text.
|
||||
@node Redisplay
|
||||
@subsection Redisplay
|
||||
|
||||
@deftypefun int rl_redisplay ()
|
||||
@deftypefun void rl_redisplay ()
|
||||
Change what's displayed on the screen to reflect the current contents
|
||||
of @code{rl_line_buffer}.
|
||||
@end deftypefun
|
||||
@ -650,6 +655,11 @@ before Readline attempts to read characters from the terminal with
|
||||
@code{rl_read_key ()}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun rl_extend_line_buffer (int len)
|
||||
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
|
||||
characters, possibly reallocating it if necessary.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_initialize ()
|
||||
Initialize or re-initialize Readline's internal state.
|
||||
@end deftypefun
|
||||
@ -870,7 +880,7 @@ that does the initial simple matching selection algorithm (see
|
||||
This is a pointer to the generator function for @code{completion_matches
|
||||
()}. If the value of @code{rl_completion_entry_function} is
|
||||
@code{(Function *)NULL} then the default filename generator function,
|
||||
@code{filename_entry_function ()}, is used.
|
||||
@code{filename_completion_function ()}, is used.
|
||||
@end deftypevar
|
||||
|
||||
@node Completion Functions
|
||||
@ -1069,7 +1079,7 @@ by @code{rl_filename_quoting_function}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int rl_inhibit_completion
|
||||
If this variable is non-zero, completion is inhibited. The completion
|
||||
If this variable is non-zero, completion is inhibit<ed. The completion
|
||||
character will be inserted as any other bound to @code{self-insert}.
|
||||
@end deftypevar
|
||||
|
||||
|
@ -605,31 +605,31 @@ Meta-Control-h: backward-kill-word Text after the function name is ignored
|
||||
#
|
||||
# Arrow keys in keypad mode
|
||||
#
|
||||
#"\M-OD" backward-char
|
||||
#"\M-OC" forward-char
|
||||
#"\M-OA" previous-history
|
||||
#"\M-OB" next-history
|
||||
#"\M-OD": backward-char
|
||||
#"\M-OC": forward-char
|
||||
#"\M-OA": previous-history
|
||||
#"\M-OB": next-history
|
||||
#
|
||||
# Arrow keys in ANSI mode
|
||||
#
|
||||
"\M-[D" backward-char
|
||||
"\M-[C" forward-char
|
||||
"\M-[A" previous-history
|
||||
"\M-[B" next-history
|
||||
"\M-[D": backward-char
|
||||
"\M-[C": forward-char
|
||||
"\M-[A": previous-history
|
||||
"\M-[B": next-history
|
||||
#
|
||||
# Arrow keys in 8 bit keypad mode
|
||||
#
|
||||
#"\M-\C-OD" backward-char
|
||||
#"\M-\C-OC" forward-char
|
||||
#"\M-\C-OA" previous-history
|
||||
#"\M-\C-OB" next-history
|
||||
#"\M-\C-OD": backward-char
|
||||
#"\M-\C-OC": forward-char
|
||||
#"\M-\C-OA": previous-history
|
||||
#"\M-\C-OB": next-history
|
||||
#
|
||||
# Arrow keys in 8 bit ANSI mode
|
||||
#
|
||||
#"\M-\C-[D" backward-char
|
||||
#"\M-\C-[C" forward-char
|
||||
#"\M-\C-[A" previous-history
|
||||
#"\M-\C-[B" next-history
|
||||
#"\M-\C-[D": backward-char
|
||||
#"\M-\C-[C": forward-char
|
||||
#"\M-\C-[A": previous-history
|
||||
#"\M-\C-[B": next-history
|
||||
|
||||
C-q: quoted-insert
|
||||
|
||||
@ -921,10 +921,18 @@ Add this digit to the argument already accumulating, or start a new
|
||||
argument. @key{M--} starts a negative argument.
|
||||
|
||||
@item universal-argument ()
|
||||
Each time this is executed, the argument count is multiplied by four.
|
||||
This is another way to specify an argument.
|
||||
If this command is followed by one or more digits, optionally with a
|
||||
leading minus sign, those digits define the argument.
|
||||
If the command is followed by digits, executing @code{universal-argument}
|
||||
again ends the numeric argument, but is otherwise ignored.
|
||||
As a special case, if this command is immediately followed by a
|
||||
character that is neither a digit or minus sign, the argument count
|
||||
for the next command is multiplied by four.
|
||||
The argument count is initially one, so executing this function the
|
||||
first time makes the argument count four. By default, this is not
|
||||
bound to a key.
|
||||
first time makes the argument count four, a second time makes the
|
||||
argument count sixteen, and so on.
|
||||
By default, this is not bound to a key.
|
||||
@end ftable
|
||||
|
||||
@node Commands For Completion
|
||||
@ -1122,6 +1130,12 @@ word expansions.
|
||||
@item history-expand-line (M-^)
|
||||
Perform history expansion on the current line.
|
||||
|
||||
@item alias-expand-line
|
||||
Perform alias expansion on the current line (@pxref{Aliases}).
|
||||
|
||||
@item history-and-alias-expand-line
|
||||
Perform history and alias expansion on the current line.
|
||||
|
||||
@item insert-last-argument (M-., M-_)
|
||||
A synonym for @code{yank-last-arg}.
|
||||
|
||||
|
37
contrib/libreadline/examples/Makefile.in
Normal file
37
contrib/libreadline/examples/Makefile.in
Normal file
@ -0,0 +1,37 @@
|
||||
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
|
||||
#
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
BUILD_DIR = .
|
||||
|
||||
DEFS = @DEFS@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I $(srcdir) -I $(top_srcdir) -I..
|
||||
|
||||
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
|
||||
LDFLAGS = -g -L..
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CCFLAGS) -c $<
|
||||
|
||||
EXECUTABLES = fileman rltest rl
|
||||
|
||||
all: $(EXECUTABLES)
|
||||
|
||||
rl: rl.o
|
||||
$(CC) $(LDFLAGS) -o $@ rl.o -lreadline -ltermcap
|
||||
|
||||
fileman: fileman.o
|
||||
$(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
|
||||
|
||||
rltest: rltest.o
|
||||
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
|
||||
|
||||
fileman.o: $(srcdir)/fileman.c
|
||||
rltest.o: $(srcdir)/rltest.c
|
||||
rl.o: $(srcdir)/rl.c
|
@ -1,15 +1,38 @@
|
||||
/* fileman.c -- A tiny application which demonstrates how to use the
|
||||
GNU Readline library. This application interactively allows users
|
||||
to manipulate files and their modes. */
|
||||
/*
|
||||
* Remove the next line if you're compiling this against an installed
|
||||
* libreadline.a
|
||||
*/
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "readline.h"
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
extern char *getwd ();
|
||||
extern char *xmalloc ();
|
||||
@ -54,7 +77,7 @@ int done;
|
||||
|
||||
char *
|
||||
dupstr (s)
|
||||
int s;
|
||||
char *s;
|
||||
{
|
||||
char *r;
|
||||
|
||||
@ -304,7 +327,8 @@ com_stat (arg)
|
||||
|
||||
printf ("Statistics for `%s':\n", arg);
|
||||
|
||||
printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
|
||||
printf ("%s has %d link%s, and is %d byte%s in length.\n",
|
||||
arg,
|
||||
finfo.st_nlink,
|
||||
(finfo.st_nlink == 1) ? "" : "s",
|
||||
finfo.st_size,
|
||||
|
115
contrib/libreadline/examples/rl.c
Normal file
115
contrib/libreadline/examples/rl.c
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* rl - command-line interface to read a line from the standard input
|
||||
* (or another fd) using readline.
|
||||
*
|
||||
* usage: rl [-p prompt] [-u unit] [-d default]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Remove the next line if you're compiling this against an installed
|
||||
* libreadline.a
|
||||
*/
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "posixstat.h"
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
extern char *strrchr();
|
||||
|
||||
static char *progname;
|
||||
static char *deftext;
|
||||
|
||||
static int
|
||||
set_deftext ()
|
||||
{
|
||||
if (deftext)
|
||||
{
|
||||
rl_insert_text (deftext);
|
||||
deftext = (char *)NULL;
|
||||
rl_startup_hook = (Function *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
|
||||
progname, progname);
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *temp, *prompt;
|
||||
struct stat sb;
|
||||
int done, opt, fd;
|
||||
FILE *ifp;
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
if (progname == 0)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
/* defaults */
|
||||
prompt = "readline$ ";
|
||||
fd = 0;
|
||||
deftext = (char *)0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'p':
|
||||
prompt = optarg;
|
||||
break;
|
||||
case 'u':
|
||||
fd = atoi(optarg);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg);
|
||||
exit (2);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
deftext = optarg;
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
exit (2);
|
||||
}
|
||||
}
|
||||
|
||||
if (fd != 0)
|
||||
{
|
||||
if (fstat (fd, &sb) < 0)
|
||||
{
|
||||
fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd);
|
||||
exit (1);
|
||||
}
|
||||
ifp = fdopen (fd, "r");
|
||||
rl_instream = ifp;
|
||||
}
|
||||
|
||||
if (deftext && *deftext)
|
||||
rl_startup_hook = set_deftext;
|
||||
|
||||
temp = readline (prompt);
|
||||
|
||||
/* Test for EOF. */
|
||||
if (temp == 0)
|
||||
exit (1);
|
||||
|
||||
puts (temp);
|
||||
exit (0);
|
||||
}
|
@ -4,10 +4,20 @@
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/*
|
||||
* Remove the next line if you're compiling this against an installed
|
||||
* libreadline.a
|
||||
*/
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "../readline.h"
|
||||
#include "../history.h"
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
main ()
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ static FUNMAP default_funmap[] = {
|
||||
{ "do-lowercase-version", rl_do_lowercase_version },
|
||||
{ "downcase-word", rl_downcase_word },
|
||||
{ "dump-functions", rl_dump_functions },
|
||||
{ "dump-macros", rl_dump_macros },
|
||||
{ "dump-variables", rl_dump_variables },
|
||||
{ "emacs-editing-mode", rl_emacs_editing_mode },
|
||||
{ "end-kbd-macro", rl_end_kbd_macro },
|
||||
|
@ -59,11 +59,7 @@ static char *history_find_word ();
|
||||
|
||||
extern int history_offset;
|
||||
|
||||
#if defined (SHELL)
|
||||
extern char *single_quote ();
|
||||
#else
|
||||
static char *single_quote ();
|
||||
#endif /* !SHELL */
|
||||
static char *quote_breaks ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
@ -91,6 +87,10 @@ char *history_no_expand_chars = " \t\n\r=";
|
||||
The default is 0. */
|
||||
int history_quotes_inhibit_expansion = 0;
|
||||
|
||||
/* If set, this points to a function that is called to verify that a
|
||||
particular history expansion should be performed. */
|
||||
Function *history_inhibit_expansion_function;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* History Expansion */
|
||||
@ -289,38 +289,6 @@ hist_string_extract_single_quoted (string, sindex)
|
||||
*sindex = i;
|
||||
}
|
||||
|
||||
#if !defined (SHELL)
|
||||
/* Does shell-like quoting using single quotes. */
|
||||
static 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);
|
||||
}
|
||||
#endif /* !SHELL */
|
||||
|
||||
static char *
|
||||
quote_breaks (s)
|
||||
char *s;
|
||||
@ -888,19 +856,14 @@ history_expand (hstring, output)
|
||||
{
|
||||
if (!cc || member (cc, history_no_expand_chars))
|
||||
continue;
|
||||
#if defined (SHELL)
|
||||
/* The shell uses ! as a pattern negation character
|
||||
in globbing [...] expressions, so let those pass
|
||||
without expansion. */
|
||||
else if (i > 0 && (string[i - 1] == '[') &&
|
||||
member (']', string + i + 1))
|
||||
/* If the calling application has set
|
||||
history_inhibit_expansion_function to a function that checks
|
||||
for special cases that should not be history expanded,
|
||||
call the function and skip the expansion if it returns a
|
||||
non-zero value. */
|
||||
else if (history_inhibit_expansion_function &&
|
||||
(*history_inhibit_expansion_function) (string, i))
|
||||
continue;
|
||||
/* The shell uses ! as the indirect expansion character, so
|
||||
let those expansions pass as well. */
|
||||
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
|
||||
member ('}', string + i + 1))
|
||||
continue;
|
||||
#endif /* SHELL */
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -52,6 +52,16 @@
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (__EMX__)
|
||||
# ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
# endif
|
||||
#else /* !__EMX__ */
|
||||
/* If we're not compiling for __EMX__, we don't want this at all. Ever. */
|
||||
# undef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif /* !__EMX__ */
|
||||
|
||||
#include <errno.h>
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
@ -60,6 +70,9 @@ extern int errno;
|
||||
#include "history.h"
|
||||
#include "histlib.h"
|
||||
|
||||
/* Functions imported from shell.c */
|
||||
extern char *get_env_value ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* Return the string that should be used in the place of this
|
||||
@ -77,7 +90,7 @@ history_filename (filename)
|
||||
if (return_val)
|
||||
return (return_val);
|
||||
|
||||
home = getenv ("HOME");
|
||||
home = get_env_value ("HOME");
|
||||
|
||||
if (home == 0)
|
||||
{
|
||||
@ -121,7 +134,7 @@ read_history_range (filename, from, to)
|
||||
struct stat finfo;
|
||||
|
||||
input = history_filename (filename);
|
||||
file = open (input, O_RDONLY, 0666);
|
||||
file = open (input, O_RDONLY|O_BINARY, 0666);
|
||||
|
||||
if ((file < 0) || (fstat (file, &finfo) == -1))
|
||||
goto error_and_exit;
|
||||
@ -194,11 +207,12 @@ history_truncate_file (fname, lines)
|
||||
{
|
||||
register int i;
|
||||
int file, chars_read;
|
||||
char *buffer = (char *)NULL, *filename;
|
||||
char *buffer, *filename;
|
||||
struct stat finfo;
|
||||
|
||||
buffer = (char *)NULL;
|
||||
filename = history_filename (fname);
|
||||
file = open (filename, O_RDONLY, 0666);
|
||||
file = open (filename, O_RDONLY|O_BINARY, 0666);
|
||||
|
||||
if (file == -1 || fstat (file, &finfo) == -1)
|
||||
goto truncate_exit;
|
||||
@ -232,7 +246,7 @@ history_truncate_file (fname, lines)
|
||||
|
||||
/* Write only if there are more lines in the file than we want to
|
||||
truncate to. */
|
||||
if (i && ((file = open (filename, O_WRONLY|O_TRUNC, 0666)) != -1))
|
||||
if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0666)) != -1))
|
||||
{
|
||||
write (file, buffer + i, finfo.st_size - i);
|
||||
close (file);
|
||||
@ -255,10 +269,11 @@ history_do_write (filename, nelements, overwrite)
|
||||
int nelements, overwrite;
|
||||
{
|
||||
register int i;
|
||||
char *output = history_filename (filename);
|
||||
char *output;
|
||||
int file, mode;
|
||||
|
||||
mode = overwrite ? O_WRONLY | O_CREAT | O_TRUNC : O_WRONLY | O_APPEND;
|
||||
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
|
||||
output = history_filename (filename);
|
||||
|
||||
if ((file = open (output, mode, 0666)) == -1)
|
||||
{
|
||||
|
@ -22,6 +22,14 @@
|
||||
#ifndef _HISTORY_H_
|
||||
#define _HISTORY_H_
|
||||
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif
|
||||
|
||||
/* The structure used to store a history entry. */
|
||||
typedef struct _hist_entry {
|
||||
char *line;
|
||||
@ -207,4 +215,9 @@ extern char *history_no_expand_chars;
|
||||
extern char *history_search_delimiter_chars;
|
||||
extern int history_quotes_inhibit_expansion;
|
||||
|
||||
/* If set, this function is called to decide whether or not a particular
|
||||
history expansion should be treated as a special case for the calling
|
||||
application and not expanded. */
|
||||
extern Function *history_inhibit_expansion_function;
|
||||
|
||||
#endif /* !_HISTORY_H_ */
|
||||
|
@ -30,13 +30,19 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif
|
||||
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
@ -287,7 +293,8 @@ rl_search_history (direction, invoking_key)
|
||||
rl_end = strlen (rl_line_buffer);
|
||||
_rl_restore_prompt();
|
||||
rl_clear_message ();
|
||||
free (allocated_line);
|
||||
if (allocated_line)
|
||||
free (allocated_line);
|
||||
free (lines);
|
||||
return 0;
|
||||
|
||||
@ -403,7 +410,8 @@ rl_search_history (direction, invoking_key)
|
||||
rl_point = line_index;
|
||||
rl_clear_message ();
|
||||
|
||||
free (allocated_line);
|
||||
if (allocated_line)
|
||||
free (allocated_line);
|
||||
free (lines);
|
||||
|
||||
return 0;
|
||||
|
@ -53,6 +53,7 @@ extern Function *rl_last_func;
|
||||
|
||||
extern void _rl_init_argument ();
|
||||
extern int _rl_set_mark_at_pos ();
|
||||
extern void _rl_fix_point ();
|
||||
extern void _rl_abort_internal ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
@ -384,7 +385,11 @@ int
|
||||
rl_kill_region (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
return (region_kill_internal (1));
|
||||
int r;
|
||||
|
||||
r = region_kill_internal (1);
|
||||
_rl_fix_point (1);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy COUNT words to the kill ring. DIR says which direction we look
|
||||
@ -521,7 +526,7 @@ rl_yank_nth_arg (count, ignore)
|
||||
inserts it right *after* rl_point. */
|
||||
if (rl_editing_mode == vi_mode)
|
||||
{
|
||||
rl_vi_append_mode ();
|
||||
rl_vi_append_mode (1, ignore);
|
||||
rl_insert_text (" ");
|
||||
}
|
||||
#endif /* VI_MODE */
|
||||
|
@ -25,6 +25,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
@ -46,7 +48,11 @@
|
||||
extern int _rl_convert_meta_chars_to_ascii;
|
||||
extern int _rl_output_meta_chars;
|
||||
extern int _rl_meta_flag;
|
||||
|
||||
|
||||
/* Functions imported from shell.c */
|
||||
extern char *get_env_value ();
|
||||
|
||||
#if !defined (HAVE_SETLOCALE)
|
||||
/* A list of legal values for the LANG or LC_CTYPE environment variables.
|
||||
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
|
||||
or LANG environment variable (using the first of those with a value),
|
||||
@ -69,6 +75,7 @@ static char *legal_lang_values[] =
|
||||
|
||||
static char *normalize_codeset ();
|
||||
static char *find_codeset ();
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
||||
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
|
||||
to decide the defaults for 8-bit character input and output. Returns
|
||||
@ -76,12 +83,33 @@ static char *find_codeset ();
|
||||
int
|
||||
_rl_init_eightbit ()
|
||||
{
|
||||
/* If we have setlocale(3), just check the current LC_CTYPE category
|
||||
value, and go into eight-bit mode if it's not C or POSIX. */
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
char *t;
|
||||
|
||||
/* Set the LC_CTYPE locale category from environment variables. */
|
||||
t = setlocale (LC_CTYPE, "");
|
||||
if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
|
||||
{
|
||||
_rl_meta_flag = 1;
|
||||
_rl_convert_meta_chars_to_ascii = 0;
|
||||
_rl_output_meta_chars = 1;
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
|
||||
#else /* !HAVE_SETLOCALE */
|
||||
char *lspec, *t;
|
||||
int i;
|
||||
|
||||
lspec = getenv ("LC_ALL");
|
||||
if (lspec == 0) lspec = getenv ("LC_CTYPE");
|
||||
if (lspec == 0) lspec = getenv ("LANG");
|
||||
/* We don't have setlocale. Finesse it. Check the environment for the
|
||||
appropriate variables and set eight-bit mode if they have the right
|
||||
values. */
|
||||
lspec = get_env_value ("LC_ALL");
|
||||
if (lspec == 0) lspec = get_env_value ("LC_CTYPE");
|
||||
if (lspec == 0) lspec = get_env_value ("LANG");
|
||||
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
|
||||
return (0);
|
||||
for (i = 0; t && legal_lang_values[i]; i++)
|
||||
@ -90,15 +118,15 @@ _rl_init_eightbit ()
|
||||
_rl_meta_flag = 1;
|
||||
_rl_convert_meta_chars_to_ascii = 0;
|
||||
_rl_output_meta_chars = 1;
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_CTYPE, lspec);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
free (t);
|
||||
return (legal_lang_values[i] ? 1 : 0);
|
||||
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
}
|
||||
|
||||
#if !defined (HAVE_SETLOCALE)
|
||||
static char *
|
||||
normalize_codeset (codeset)
|
||||
char *codeset;
|
||||
@ -196,3 +224,4 @@ find_codeset (name, lenp)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
@ -42,7 +42,7 @@
|
||||
# define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#endif /* !HAVE_DIRENT_H */
|
||||
|
||||
#if defined (STRUCT_DIRENT_HAS_D_INO)
|
||||
#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
|
||||
# define d_fileno d_ino
|
||||
#endif
|
||||
|
||||
|
20
contrib/libreadline/posixjmp.h
Normal file
20
contrib/libreadline/posixjmp.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
|
||||
|
||||
#ifndef _POSIXJMP_H_
|
||||
#define _POSIXJMP_H_
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/* This *must* be included *after* config.h */
|
||||
|
||||
#if defined (HAVE_POSIX_SIGSETJMP)
|
||||
# define procenv_t sigjmp_buf
|
||||
# undef setjmp
|
||||
# define setjmp(x) sigsetjmp((x), 1)
|
||||
# undef longjmp
|
||||
# define longjmp(x, n) siglongjmp((x), (n))
|
||||
#else
|
||||
# define procenv_t jmp_buf
|
||||
#endif
|
||||
|
||||
#endif /* _POSIXJMP_H_ */
|
@ -49,17 +49,25 @@
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include "posixjmp.h"
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#include "tcap.h"
|
||||
#if defined (__EMX__)
|
||||
# define INCL_DOSPROCESS
|
||||
# include <os2.h>
|
||||
#endif /* __EMX__ */
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#ifndef RL_LIBRARY_VERSION
|
||||
# define RL_LIBRARY_VERSION "2.1-bash"
|
||||
#endif
|
||||
|
||||
/* Evaluates its arguments multiple times. */
|
||||
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
|
||||
|
||||
/* NOTE: Functions and variables prefixed with `_rl_' are
|
||||
@ -75,7 +83,6 @@ extern void _rl_get_screen_size ();
|
||||
|
||||
extern int _rl_enable_meta;
|
||||
extern int _rl_term_autowrap;
|
||||
extern char *term_backspace, *term_clreol, *term_clrpag;
|
||||
extern int screenwidth, screenheight, screenchars;
|
||||
|
||||
/* Variables and functions imported from rltty.c. */
|
||||
@ -99,9 +106,17 @@ extern int rl_read_key ();
|
||||
/* Functions imported from nls.c */
|
||||
extern int _rl_init_eightbit ();
|
||||
|
||||
/* Functions imported from shell.c */
|
||||
extern char *get_env_value ();
|
||||
|
||||
/* External redisplay functions and variables from display.c */
|
||||
extern void _rl_move_vert ();
|
||||
extern void _rl_update_final ();
|
||||
extern void _rl_clear_to_eol ();
|
||||
extern void _rl_clear_screen ();
|
||||
|
||||
extern void _rl_save_prompt ();
|
||||
extern void _rl_restore_prompt ();
|
||||
|
||||
extern void _rl_erase_at_end_of_line ();
|
||||
extern void _rl_move_cursor_relative ();
|
||||
@ -153,6 +168,7 @@ static void readline_default_bindings ();
|
||||
#endif /* !__GO32__ */
|
||||
|
||||
#if defined (__GO32__)
|
||||
# include <go32.h>
|
||||
# include <pc.h>
|
||||
# undef HANDLE_SIGNALS
|
||||
#endif /* __GO32__ */
|
||||
@ -165,7 +181,7 @@ extern char *xmalloc (), *xrealloc ();
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *rl_library_version = "2.1";
|
||||
char *rl_library_version = RL_LIBRARY_VERSION;
|
||||
|
||||
/* A pointer to the keymap that is currently in use.
|
||||
By default, it is the standard emacs keymap. */
|
||||
@ -174,6 +190,11 @@ Keymap _rl_keymap = emacs_standard_keymap;
|
||||
/* The current style of editing. */
|
||||
int rl_editing_mode = emacs_mode;
|
||||
|
||||
/* Non-zero if we called this function from _rl_dispatch(). It's present
|
||||
so functions can find out whether they were called from a key binding
|
||||
or directly from an application. */
|
||||
int rl_dispatching;
|
||||
|
||||
/* Non-zero if the previous command was a kill command. */
|
||||
int _rl_last_command_was_kill = 0;
|
||||
|
||||
@ -208,7 +229,7 @@ int rl_done;
|
||||
Function *rl_last_func = (Function *)NULL;
|
||||
|
||||
/* Top level environment for readline_internal (). */
|
||||
jmp_buf readline_top_level;
|
||||
procenv_t readline_top_level;
|
||||
|
||||
/* The streams we interact with. */
|
||||
FILE *_rl_in_stream, *_rl_out_stream;
|
||||
@ -360,7 +381,7 @@ readline_internal_setup ()
|
||||
(*rl_redisplay_function) ();
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_vi_insertion_mode ();
|
||||
rl_vi_insertion_mode (1, 0);
|
||||
#endif /* VI_MODE */
|
||||
}
|
||||
}
|
||||
@ -497,6 +518,14 @@ readline_internal ()
|
||||
return (readline_internal_teardown (eof));
|
||||
}
|
||||
|
||||
void
|
||||
_rl_init_line_state ()
|
||||
{
|
||||
rl_point = rl_end = 0;
|
||||
the_line = rl_line_buffer;
|
||||
the_line[0] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_set_the_line ()
|
||||
{
|
||||
@ -551,12 +580,14 @@ _rl_dispatch (key, map)
|
||||
_rl_suppress_redisplay = (map[key].function == rl_insert) && _rl_input_available ();
|
||||
#endif
|
||||
|
||||
rl_dispatching = 1;
|
||||
r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
|
||||
rl_dispatching = 0;
|
||||
|
||||
/* If we have input pending, then the last command was a prefix
|
||||
command. Don't change the state of rl_last_func. Otherwise,
|
||||
remember the last command executed in this variable. */
|
||||
if (!rl_pending_input)
|
||||
if (!rl_pending_input && map[key].function != rl_digit_argument)
|
||||
rl_last_func = map[key].function;
|
||||
}
|
||||
else
|
||||
@ -603,7 +634,7 @@ _rl_dispatch (key, map)
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Initliaze readline (and terminal if not already). */
|
||||
/* Initialize readline (and terminal if not already). */
|
||||
int
|
||||
rl_initialize ()
|
||||
{
|
||||
@ -616,9 +647,7 @@ rl_initialize ()
|
||||
}
|
||||
|
||||
/* Initalize the current line information. */
|
||||
rl_point = rl_end = 0;
|
||||
the_line = rl_line_buffer;
|
||||
the_line[0] = 0;
|
||||
_rl_init_line_state ();
|
||||
|
||||
/* We aren't done yet. We haven't even gotten started yet! */
|
||||
rl_done = 0;
|
||||
@ -643,12 +672,41 @@ rl_initialize ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (__EMX__)
|
||||
static void
|
||||
_emx_build_environ ()
|
||||
{
|
||||
TIB *tibp;
|
||||
PIB *pibp;
|
||||
char *t, **tp;
|
||||
int c;
|
||||
|
||||
DosGetInfoBlocks (&tibp, &pibp);
|
||||
t = pibp->pib_pchenv;
|
||||
for (c = 1; *t; c++)
|
||||
t += strlen (t) + 1;
|
||||
tp = environ = (char **)xmalloc ((c + 1) * sizeof (char *));
|
||||
t = pibp->pib_pchenv;
|
||||
while (*t)
|
||||
{
|
||||
*tp++ = t;
|
||||
t += strlen (t) + 1;
|
||||
}
|
||||
*tp = 0;
|
||||
}
|
||||
#endif /* __EMX__ */
|
||||
|
||||
/* Initialize the entire state of the world. */
|
||||
static void
|
||||
readline_initialize_everything ()
|
||||
{
|
||||
#if defined (__EMX__)
|
||||
if (environ == 0)
|
||||
_emx_build_environ ();
|
||||
#endif
|
||||
|
||||
/* Find out if we are running in Emacs. */
|
||||
running_in_emacs = getenv ("EMACS") != (char *)0;
|
||||
running_in_emacs = get_env_value ("EMACS") != (char *)0;
|
||||
|
||||
/* Set up input and output if they are not already set up. */
|
||||
if (!rl_instream)
|
||||
@ -664,7 +722,7 @@ readline_initialize_everything ()
|
||||
_rl_out_stream = rl_outstream;
|
||||
|
||||
/* Allocate data structures. */
|
||||
if (!rl_line_buffer)
|
||||
if (rl_line_buffer == 0)
|
||||
rl_line_buffer = xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
|
||||
|
||||
/* Initialize the terminal interface. */
|
||||
@ -773,45 +831,56 @@ bind_arrow_keys ()
|
||||
static int
|
||||
rl_digit_loop ()
|
||||
{
|
||||
int key, c, sawminus;
|
||||
int key, c, sawminus, sawdigits;
|
||||
|
||||
_rl_save_prompt ();
|
||||
|
||||
sawminus = 0;
|
||||
sawminus = sawdigits = 0;
|
||||
while (1)
|
||||
{
|
||||
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
|
||||
key = c = rl_read_key ();
|
||||
|
||||
/* If we see a key bound to `universal-argument' after seeing digits,
|
||||
it ends the argument but is otherwise ignored. */
|
||||
if (_rl_keymap[c].type == ISFUNC &&
|
||||
_rl_keymap[c].function == rl_universal_argument)
|
||||
{
|
||||
rl_numeric_arg *= 4;
|
||||
continue;
|
||||
}
|
||||
c = UNMETA (c);
|
||||
if (_rl_digit_p (c))
|
||||
{
|
||||
rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
|
||||
rl_explicit_arg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c == '-' && rl_explicit_arg == 0)
|
||||
if (sawdigits == 0)
|
||||
{
|
||||
rl_numeric_arg = sawminus = 1;
|
||||
rl_arg_sign = -1;
|
||||
rl_numeric_arg *= 4;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make M-- command equivalent to M--1 command. */
|
||||
if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
|
||||
rl_explicit_arg = 1;
|
||||
key = rl_read_key ();
|
||||
_rl_restore_prompt ();
|
||||
rl_clear_message ();
|
||||
return (_rl_dispatch (key, _rl_keymap));
|
||||
}
|
||||
}
|
||||
|
||||
c = UNMETA (c);
|
||||
|
||||
if (_rl_digit_p (c))
|
||||
{
|
||||
rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
|
||||
sawdigits = rl_explicit_arg = 1;
|
||||
}
|
||||
else if (c == '-' && rl_explicit_arg == 0)
|
||||
{
|
||||
rl_numeric_arg = sawminus = 1;
|
||||
rl_arg_sign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make M-- command equivalent to M--1 command. */
|
||||
if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
|
||||
rl_explicit_arg = 1;
|
||||
_rl_restore_prompt ();
|
||||
rl_clear_message ();
|
||||
return (_rl_dispatch (key, _rl_keymap));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -936,6 +1005,28 @@ rl_delete_text (from, to)
|
||||
return (diff);
|
||||
}
|
||||
|
||||
/* Fix up point so that it is within the line boundaries after killing
|
||||
text. If FIX_MARK_TOO is non-zero, the mark is forced within line
|
||||
boundaries also. */
|
||||
|
||||
#define _RL_FIX_POINT(x) \
|
||||
do { \
|
||||
if (x > rl_end) \
|
||||
x = rl_end; \
|
||||
else if (x < 0) \
|
||||
x = 0; \
|
||||
} while (0)
|
||||
|
||||
void
|
||||
_rl_fix_point (fix_mark_too)
|
||||
int fix_mark_too;
|
||||
{
|
||||
_RL_FIX_POINT (rl_point);
|
||||
if (fix_mark_too)
|
||||
_RL_FIX_POINT (rl_mark);
|
||||
}
|
||||
#undef _RL_FIX_POINT
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Readline character functions */
|
||||
@ -1153,8 +1244,7 @@ rl_refresh_line ()
|
||||
memset (row_start + col, 0, (width - col) * 2);
|
||||
}
|
||||
#else /* !__GO32__ */
|
||||
if (term_clreol)
|
||||
tputs (term_clreol, 1, _rl_output_character_function);
|
||||
_rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
|
||||
#endif /* !__GO32__ */
|
||||
|
||||
rl_forced_update_display ();
|
||||
@ -1176,13 +1266,7 @@ rl_clear_screen (count, key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined (__GO32__)
|
||||
if (term_clrpag)
|
||||
tputs (term_clrpag, 1, _rl_output_character_function);
|
||||
else
|
||||
#endif /* !__GO32__ */
|
||||
crlf ();
|
||||
|
||||
_rl_clear_screen (); /* calls termcap function to clear screen */
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
@ -1321,8 +1405,11 @@ rl_newline (count, key)
|
||||
rl_done = 1;
|
||||
|
||||
#if defined (VI_MODE)
|
||||
_rl_vi_done_inserting ();
|
||||
_rl_vi_reset_last ();
|
||||
if (rl_editing_mode == vi_mode)
|
||||
{
|
||||
_rl_vi_done_inserting ();
|
||||
_rl_vi_reset_last ();
|
||||
}
|
||||
#endif /* VI_MODE */
|
||||
|
||||
if (readline_echoing_p)
|
||||
@ -1632,10 +1719,7 @@ rl_transpose_chars (count, key)
|
||||
rl_delete_text (rl_point, rl_point + 1);
|
||||
|
||||
rl_point += count;
|
||||
if (rl_point > rl_end)
|
||||
rl_point = rl_end;
|
||||
else if (rl_point < 0)
|
||||
rl_point = 0;
|
||||
_rl_fix_point (0);
|
||||
rl_insert_text (dummy);
|
||||
|
||||
rl_end_undo_group ();
|
||||
@ -1988,7 +2072,7 @@ rl_vi_editing_mode (count, key)
|
||||
{
|
||||
#if defined (VI_MODE)
|
||||
rl_editing_mode = vi_mode;
|
||||
rl_vi_insertion_mode ();
|
||||
rl_vi_insertion_mode (1, key);
|
||||
#endif /* VI_MODE */
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,17 +40,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SYS_STREAM_H)
|
||||
# include <sys/stream.h>
|
||||
#endif /* HAVE_SYS_STREAM_H */
|
||||
#if defined (HAVE_SYS_PTEM_H)
|
||||
# include <sys/ptem.h>
|
||||
# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
|
||||
#endif /* HAVE_SYS_PTEM_H */
|
||||
#if defined (HAVE_SYS_PTE_H)
|
||||
# include <sys/pte.h>
|
||||
#endif /* HAVE_SYS_PTE_H */
|
||||
|
||||
/* 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)
|
||||
|
@ -53,6 +53,8 @@ extern int _rl_eof_char;
|
||||
|
||||
extern int _rl_enable_keypad, _rl_enable_meta;
|
||||
|
||||
extern void _rl_control_keypad ();
|
||||
|
||||
#if defined (__GO32__)
|
||||
# include <pc.h>
|
||||
# undef HANDLE_SIGNALS
|
||||
|
@ -42,6 +42,18 @@
|
||||
# include <sgtty.h>
|
||||
#endif
|
||||
|
||||
/* Stuff for `struct winsize' on various systems. */
|
||||
#if defined (HAVE_SYS_STREAM_H)
|
||||
# include <sys/stream.h>
|
||||
#endif /* HAVE_SYS_STREAM_H */
|
||||
#if defined (HAVE_SYS_PTEM_H)
|
||||
# include <sys/ptem.h>
|
||||
# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
|
||||
#endif /* HAVE_SYS_PTEM_H */
|
||||
#if defined (HAVE_SYS_PTE_H)
|
||||
# include <sys/pte.h>
|
||||
#endif /* HAVE_SYS_PTE_H */
|
||||
|
||||
/* 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
|
||||
|
@ -33,11 +33,20 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif
|
||||
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#define abs(x) (((x) > 0) ? (x) : -(x))
|
||||
#ifdef abs
|
||||
# undef abs
|
||||
#endif
|
||||
#define abs(x) (((x) >= 0) ? (x) : -(x))
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
|
129
contrib/libreadline/shell.c
Normal file
129
contrib/libreadline/shell.c
Normal file
@ -0,0 +1,129 @@
|
||||
/* 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)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_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 */
|
@ -87,6 +87,14 @@ static SigHandler *rl_set_sighandler ();
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* If we're not being compiled as part of bash, initialize handlers for
|
||||
and catch the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) and
|
||||
SIGTERM. */
|
||||
#if !defined (SHELL)
|
||||
# define HANDLE_JOB_SIGNALS
|
||||
# define HANDLE_SIGTERM
|
||||
#endif /* !SHELL */
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
typedef struct sigaction sighandler_cxt;
|
||||
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
|
||||
@ -97,9 +105,13 @@ typedef struct { SigHandler *sa_handler; } sighandler_cxt;
|
||||
|
||||
static sighandler_cxt old_int, old_alrm;
|
||||
|
||||
#if !defined (SHELL)
|
||||
static sighandler_cxt old_tstp, old_ttou, old_ttin, old_term;
|
||||
#endif /* !SHELL */
|
||||
#if defined (HANDLE_JOB_SIGNALS)
|
||||
static sighandler_cxt old_tstp, old_ttou, old_ttin;
|
||||
#endif /* HANDLE_JOB_SIGNALS */
|
||||
|
||||
#if defined (HANDLE_SIGTERM)
|
||||
static sighandler_cxt old_term;
|
||||
#endif
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
static sighandler_cxt old_winch;
|
||||
@ -116,14 +128,16 @@ rl_signal_handler (sig)
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
long omask;
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
# else /* !HAVE_BSD_SIGNALS */
|
||||
sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
|
||||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
|
||||
/* Since the signal will not be blocked while we are in the signal
|
||||
handler, ignore it until rl_clear_signals resets the catcher. */
|
||||
if (sig == SIGINT || sig == SIGALRM)
|
||||
rl_set_sighandler (sig, SIG_IGN, (sighandler_cxt *)NULL);
|
||||
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
|
||||
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
|
||||
|
||||
switch (sig)
|
||||
@ -188,6 +202,16 @@ rl_handle_sigwinch (sig)
|
||||
{
|
||||
SigHandler *oh;
|
||||
|
||||
#if defined (MUST_REINSTALL_SIGHANDLERS)
|
||||
sighandler_cxt dummy_winch;
|
||||
|
||||
/* We don't want to change old_winch -- it holds the state of SIGWINCH
|
||||
disposition set by the calling application. We need this state
|
||||
because we call the application's SIGWINCH handler after updating
|
||||
our own idea of the screen size. */
|
||||
rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &dummy_winch);
|
||||
#endif
|
||||
|
||||
if (readline_echoing_p)
|
||||
{
|
||||
_rl_get_screen_size (fileno (rl_instream), 1);
|
||||
@ -265,7 +289,7 @@ rl_set_signals ()
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#endif /* HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if !defined (SHELL)
|
||||
#if defined (HANDLE_JOB_SIGNALS)
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
|
||||
@ -286,9 +310,12 @@ rl_set_signals ()
|
||||
}
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
#endif /* HANDLE_JOB_SIGNALS */
|
||||
|
||||
#if defined (HANDLE_SIGTERM)
|
||||
/* Handle SIGTERM if we're not being compiled as part of bash. */
|
||||
rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
|
||||
#endif /* !SHELL */
|
||||
#endif /* HANDLE_SIGTERM */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
|
||||
@ -309,7 +336,7 @@ rl_clear_signals ()
|
||||
rl_sigaction (SIGINT, &old_int, &dummy);
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
|
||||
#if !defined (SHELL)
|
||||
#if defined (HANDLE_JOB_SIGNALS)
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
||||
@ -320,9 +347,11 @@ rl_clear_signals ()
|
||||
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
rl_sigaction (SIGTERM, &old_term, &dummy);
|
||||
#endif /* HANDLE_JOB_SIGNALS */
|
||||
|
||||
#endif /* !SHELL */
|
||||
#if defined (HANDLE_SIGTERM)
|
||||
rl_sigaction (SIGTERM, &old_term, &dummy);
|
||||
#endif /* HANDLE_SIGTERM */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
|
927
contrib/libreadline/support/config.guess
vendored
Executable file
927
contrib/libreadline/support/config.guess
vendored
Executable file
@ -0,0 +1,927 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/usr/5bin
|
||||
fi
|
||||
|
||||
UNAME=`(uname) 2>/dev/null` || UNAME=unknown
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
|
||||
case "$RELEASE" in
|
||||
"") RELEASE=0 ;;
|
||||
*) RELEASE=`expr "$RELEASE" + 0` ;;
|
||||
esac
|
||||
REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
|
||||
REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
|
||||
# is contrary to all other versions of uname
|
||||
if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
|
||||
UNAME=UNIX_SV
|
||||
fi
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# Begin cases added for Bash
|
||||
alpha:NetBSD:*:*)
|
||||
echo alpha-dec-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OpenBSD:*:*)
|
||||
echo alpha-dec-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i?86:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i?86:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
sparc:NetBSD:*:*)
|
||||
echo sparc-unknown-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sparc:OpenBSD:*:*)
|
||||
echo sparc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
vax:NetBSD:*:*)
|
||||
echo vax-dec-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
vax:OpenBSD:*:*)
|
||||
echo vax-dec-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:machten:*:*)
|
||||
echo mac68k-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
concurrent*:*:*:*)
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo concurrent-concurrent-sysv3
|
||||
else
|
||||
echo concurrent-concurrent-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
ppc*:SunOS:5.*:*)
|
||||
echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sparc:UNIX_SV:4.*:*)
|
||||
echo sparc-unknown-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:UNIX_SV:4.*:*)
|
||||
echo mips-mips-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:OSF*1:*:*)
|
||||
echo mips-mips-osf1
|
||||
exit 0 ;;
|
||||
mips:4.4BSD:*:*)
|
||||
echo mips-mips-bsd4.4
|
||||
exit 0 ;;
|
||||
MIServer-S:SMP_DC.OSx:*:dcosx)
|
||||
echo mips-pyramid-sysv4
|
||||
exit 0 ;;
|
||||
news*:NEWS*:*:*)
|
||||
echo mips-sony-newsos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:NEXTSTEP:*:*)
|
||||
echo i386-next-nextstep${RELEASE}
|
||||
exit 0 ;;
|
||||
*680?0:NEXTSTEP:*:*)
|
||||
echo m68k-next-nextstep${RELEASE}
|
||||
exit 0 ;;
|
||||
*370:AIX:*:*)
|
||||
echo ibm370-ibm-aix
|
||||
exit 0 ;;
|
||||
ksr1:OSF*1:*:*)
|
||||
echo ksr1-ksr-osf1
|
||||
exit 0 ;;
|
||||
esa:OSF*1:*:* | ESA:OSF*:*:*)
|
||||
echo esa-ibm-osf1
|
||||
exit 0 ;;
|
||||
DNP*:DNIX:*:*)
|
||||
echo m68k-dnix-sysv
|
||||
exit 0 ;;
|
||||
*3b2*:*:*:*)
|
||||
echo we32k-att-sysv3
|
||||
exit 0 ;;
|
||||
*:QNX:*:42*)
|
||||
echo i386-qssl-qnx`echo ${UNAME_VERSION}`
|
||||
exit 0 ;;
|
||||
# end cases added for Bash
|
||||
alpha:OSF1:*:*)
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-cbm-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-atari-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-sun-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-apple-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerux
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1
|
||||
elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1.1
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-pc-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:OpenBSD:*:*)
|
||||
echo m68k-hp-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
|
||||
echo "powerpc-unknown-linux-gnu" ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
echo alpha-unknown-linux-gnu ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "sparc" ; then
|
||||
echo sparc-unknown-linux-gnu ; exit 0
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
|
||||
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
test ! -d /usr/lib/ldscripts/. \
|
||||
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
printf ("%s-pc-linux-gnu\n", argv[1]);
|
||||
#else
|
||||
printf ("%s-pc-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i[34]86:UNIX_SV:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-pc-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:LynxOS:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp9000) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
/* Begin cases added for Bash */
|
||||
#if defined (tahoe)
|
||||
printf ("tahoe-cci-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (nec_ews)
|
||||
# if defined (SYSTYPE_SYSV)
|
||||
printf ("ews4800-nec-sysv4\n"); exit 0;
|
||||
# else
|
||||
printf ("ews4800-nec-bsd\n"); exit (0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (sony)
|
||||
# if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-sony-sysv4\n"); exit 0;
|
||||
# else
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (ardent)
|
||||
printf ("titan-ardent-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (stardent)
|
||||
printf ("stardent-stardent-sysv\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (ibm032)
|
||||
printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent) && defined (i386)
|
||||
printf ("i386-sequent-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (qnx) && defined (i386)
|
||||
printf ("i386-pc-qnx\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (gould)
|
||||
printf ("gould-gould-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (unixpc)
|
||||
printf ("unixpc-att-sysv\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (att386)
|
||||
printf ("i386-att-sysv3\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (__m88k) && defined (__UMAXV__)
|
||||
printf ("m88k-encore-sysv3\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (drs6000)
|
||||
printf ("drs6000-icl-sysv4.2\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (clipper)
|
||||
printf ("clipper-orion-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (is68k)
|
||||
printf ("m68k-isi-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (luna88k)
|
||||
printf ("luna88k-omron-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (butterfly) && defined (BFLY1)
|
||||
printf ("butterfly-bbn-mach\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (tower32)
|
||||
printf ("tower32-ncr-sysv4\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MagicStation)
|
||||
printf ("magicstation-unknown-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (scs)
|
||||
printf ("symmetric-scs-bsd4.2\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (tandem)
|
||||
printf ("tandem-tandem-sysv\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (cadmus)
|
||||
printf ("cadmus-pcs-sysv\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (masscomp)
|
||||
printf ("masscomp-masscomp-sysv3\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hbullx20)
|
||||
printf ("hbullx20-bull-sysv3\n"); exit (0);
|
||||
#endif
|
||||
|
||||
/* End cases added for Bash */
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Begin cases added for Bash
|
||||
case "$UNAME" in
|
||||
uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
|
||||
esac
|
||||
|
||||
if [ -d /usr/amiga ]; then
|
||||
echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
|
||||
fi
|
||||
|
||||
if [ -f /bin/fxc.info ]; then
|
||||
echo fxc-alliant-concentrix
|
||||
exit 0
|
||||
fi
|
||||
# end cases added for Bash
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
944
contrib/libreadline/support/config.sub
vendored
Executable file
944
contrib/libreadline/support/config.sub
vendored
Executable file
@ -0,0 +1,944 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file 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., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# 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.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* | f301-* \
|
||||
| butterfly-bbn* \
|
||||
| cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
|
||||
| tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
|
||||
| concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
|
||||
| *-convex)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigados
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
hbullx20-bull)
|
||||
basic_machine=m68k-bull
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax | multimax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
ibm032-*)
|
||||
basic_machine=ibmrt-ibm
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
luna88k-omron* | m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magicstation*)
|
||||
basic_machine=magicstation-unknown
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
basic_machine=mips-mips
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-unixware* | svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -linux-gnu* | -uxpv* | -qnx* | -powerux)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigados
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-lynxos*)
|
||||
vendor=lynx
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
235
contrib/libreadline/support/install.sh
Executable file
235
contrib/libreadline/support/install.sh
Executable file
@ -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
|
32
contrib/libreadline/support/mkdirs
Executable file
32
contrib/libreadline/support/mkdirs
Executable file
@ -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
|
100
contrib/libreadline/support/mkdist
Executable file
100
contrib/libreadline/support/mkdist
Executable file
@ -0,0 +1,100 @@
|
||||
#! /bin/bash -
|
||||
#
|
||||
# mkdist - make a distribution directory from a master manifest file
|
||||
#
|
||||
# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version
|
||||
#
|
||||
# SRCDIR defaults to src
|
||||
# MANIFEST defaults to $SRCDIR/MANIFEST
|
||||
#
|
||||
|
||||
SRCDIR=src
|
||||
ROOTNAME=bash
|
||||
|
||||
usage()
|
||||
{
|
||||
echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
vmsg()
|
||||
{
|
||||
if [ -n "$verbose" ]; then
|
||||
echo mkdist: "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
while getopts m:s:r:v name
|
||||
do
|
||||
case $name in
|
||||
m) MANIFEST=$OPTARG ;;
|
||||
s) SRCDIR=$OPTARG ;;
|
||||
r) ROOTNAME=$OPTARG ;;
|
||||
v) verbose=yes ;;
|
||||
?) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
: ${MANIFEST:=$SRCDIR/MANIFEST}
|
||||
|
||||
vmsg using $MANIFEST
|
||||
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
version=$1
|
||||
newdir=${ROOTNAME}-$version
|
||||
|
||||
vmsg creating distribution for version $version in $newdir
|
||||
|
||||
if [ ! -d $newdir ]; then
|
||||
mkdir $newdir || { echo $0: cannot make directory $newdir 1>&2 ; exit 1; }
|
||||
fi
|
||||
|
||||
dirmode=755
|
||||
filmode=644
|
||||
|
||||
while read fname type mode
|
||||
do
|
||||
[ -z "$fname" ] && continue
|
||||
|
||||
case "$fname" in
|
||||
\#*) continue ;;
|
||||
esac
|
||||
|
||||
case "$type" in
|
||||
d) mkdir $newdir/$fname ;;
|
||||
f) cp -p $SRCDIR/$fname $newdir/$fname ;;
|
||||
*) echo "unknown file type $type" 1>&2 ;;
|
||||
esac
|
||||
|
||||
if [ -n "$mode" ]; then
|
||||
chmod $mode $newdir/$fname
|
||||
fi
|
||||
|
||||
done < $MANIFEST
|
||||
|
||||
# cut off the `-alpha' in something like `2.0-alpha', leaving just the
|
||||
# numeric version
|
||||
#version=${version%%-*}
|
||||
|
||||
#case "$version" in
|
||||
#*.*.*) vers=${version%.*} ;;
|
||||
#*.*) vers=${version} ;;
|
||||
#esac
|
||||
|
||||
#echo $vers > $newdir/.distribution
|
||||
|
||||
#case "$version" in
|
||||
#*.*.*) plevel=${version##*.} ;;
|
||||
#*) plevel=0 ;;
|
||||
#esac
|
||||
#[ -z "$plevel" ] && plevel=0
|
||||
#echo ${plevel} > $newdir/.patchlevel
|
||||
|
||||
vmsg $newdir created
|
||||
|
||||
exit 0
|
@ -29,6 +29,9 @@
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_TERMCAP_H)
|
||||
# if defined (__linux__) && !defined (SPEED_T_IN_SYS_TYPES)
|
||||
# include "rltty.h"
|
||||
# endif
|
||||
# include <termcap.h>
|
||||
#else
|
||||
|
||||
|
@ -53,11 +53,12 @@
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#include "tcap.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
|
||||
|
||||
#include "rltty.h"
|
||||
#include "tcap.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
@ -69,6 +70,13 @@ extern int readline_echoing_p;
|
||||
extern int _rl_bell_preference;
|
||||
extern Keymap _rl_keymap;
|
||||
|
||||
/* Functions imported from bind.c */
|
||||
extern void _rl_bind_if_unbound ();
|
||||
|
||||
/* Functions imported from shell.c */
|
||||
extern void set_lines_and_columns ();
|
||||
extern char *get_env_value ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Terminal and Termcap */
|
||||
@ -84,8 +92,10 @@ static int tcap_initialized;
|
||||
static int dumb_term;
|
||||
|
||||
#if !defined (__linux__)
|
||||
/* If this causes problems, add back the `extern'. */
|
||||
/*extern*/ char PC, *BC, *UP;
|
||||
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
|
||||
extern
|
||||
# endif /* __EMX__ || NEED_EXTERN_PC */
|
||||
char PC, *BC, *UP;
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* Some strings to control terminal actions. These are output by tputs (). */
|
||||
@ -139,45 +149,6 @@ int _rl_enable_keypad;
|
||||
/* Non-zero means the user wants to enable a meta key. */
|
||||
int _rl_enable_meta = 1;
|
||||
|
||||
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
|
||||
has changed. */
|
||||
int
|
||||
rl_reset_terminal (terminal_name)
|
||||
char *terminal_name;
|
||||
{
|
||||
_rl_init_terminal_io (terminal_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined (SHELL)
|
||||
static 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 */
|
||||
}
|
||||
#else /* SHELL */
|
||||
extern void set_lines_and_columns ();
|
||||
#endif /* SHELL */
|
||||
|
||||
/* Get readline's idea of the screen size. TTY is a file descriptor open
|
||||
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
|
||||
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
|
||||
@ -190,6 +161,9 @@ _rl_get_screen_size (tty, ignore_env)
|
||||
#if defined (TIOCGWINSZ)
|
||||
struct winsize window_size;
|
||||
#endif /* TIOCGWINSZ */
|
||||
#if defined (__EMX__)
|
||||
int sz[2];
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGWINSZ)
|
||||
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
|
||||
@ -199,11 +173,17 @@ _rl_get_screen_size (tty, ignore_env)
|
||||
}
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
#if defined (__EMX__)
|
||||
_scrsize (sz);
|
||||
screenwidth = sz[0];
|
||||
screenheight = sz[1];
|
||||
#endif
|
||||
|
||||
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
|
||||
is unset. */
|
||||
if (screenwidth <= 0)
|
||||
{
|
||||
if (ignore_env == 0 && (ss = getenv ("COLUMNS")))
|
||||
if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
|
||||
screenwidth = atoi (ss);
|
||||
|
||||
if (screenwidth <= 0 && term_string_buffer)
|
||||
@ -214,7 +194,7 @@ _rl_get_screen_size (tty, ignore_env)
|
||||
is unset. */
|
||||
if (screenheight <= 0)
|
||||
{
|
||||
if (ignore_env == 0 && (ss = getenv ("LINES")))
|
||||
if (ignore_env == 0 && (ss = get_env_value ("LINES")))
|
||||
screenheight = atoi (ss);
|
||||
|
||||
if (screenheight <= 0 && term_string_buffer)
|
||||
@ -334,7 +314,7 @@ _rl_init_terminal_io (terminal_name)
|
||||
int tty;
|
||||
Keymap xkeymap;
|
||||
|
||||
term = terminal_name ? terminal_name : getenv ("TERM");
|
||||
term = terminal_name ? terminal_name : get_env_value ("TERM");
|
||||
|
||||
if (term_string_buffer == 0)
|
||||
term_string_buffer = xmalloc (2032);
|
||||
@ -443,6 +423,16 @@ rl_get_termcap (cap)
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
|
||||
has changed. */
|
||||
int
|
||||
rl_reset_terminal (terminal_name)
|
||||
char *terminal_name;
|
||||
{
|
||||
_rl_init_terminal_io (terminal_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* A function for the use of tputs () */
|
||||
int
|
||||
_rl_output_character_function (c)
|
||||
@ -536,7 +526,7 @@ outchar (c)
|
||||
return putc (c, rl_outstream);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
_rl_enable_meta_key ()
|
||||
{
|
||||
if (term_has_meta && term_mm)
|
||||
|
@ -23,6 +23,10 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
@ -40,6 +44,10 @@
|
||||
|
||||
#include "tilde.h"
|
||||
|
||||
#ifdef SHELL
|
||||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid (), *getpwnam ();
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
@ -78,6 +86,12 @@ static char *default_prefixes[] =
|
||||
static char *default_suffixes[] =
|
||||
{ " ", "\n", (char *)NULL };
|
||||
|
||||
/* If non-null, this contains the address of a function that the application
|
||||
wants called before trying the standard tilde expansions. The function
|
||||
is called with the text sans tilde, and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if the expansion fails. */
|
||||
CPFunction *tilde_expansion_preexpansion_hook = (CPFunction *)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
|
||||
@ -108,7 +122,7 @@ tilde_find_prefix (string, len)
|
||||
string_len = strlen (string);
|
||||
*len = 0;
|
||||
|
||||
if (!*string || *string == '~')
|
||||
if (*string == '\0' || *string == '~')
|
||||
return (0);
|
||||
|
||||
if (prefixes)
|
||||
@ -135,13 +149,14 @@ tilde_find_suffix (string)
|
||||
char *string;
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **suffixes = tilde_additional_suffixes;
|
||||
register char **suffixes;
|
||||
|
||||
suffixes = tilde_additional_suffixes;
|
||||
string_len = strlen (string);
|
||||
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
if (string[i] == '/' || !string[i])
|
||||
if (string[i] == '/' /* || !string[i] */)
|
||||
break;
|
||||
|
||||
for (j = 0; suffixes && suffixes[j]; j++)
|
||||
@ -153,16 +168,28 @@ tilde_find_suffix (string)
|
||||
return (i);
|
||||
}
|
||||
|
||||
#if !defined (SHELL)
|
||||
static char *
|
||||
get_string_value (varname)
|
||||
char *varname;
|
||||
{
|
||||
return ((char *)getenv (varname));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
char *
|
||||
tilde_expand (string)
|
||||
char *string;
|
||||
{
|
||||
char *result, *tilde_expand_word ();
|
||||
char *result;
|
||||
int result_size, result_index;
|
||||
|
||||
result_size = result_index = 0;
|
||||
result = (char *)NULL;
|
||||
result_index = result_size = 0;
|
||||
if (result = strchr (string, '~'))
|
||||
result = xmalloc (result_size = (strlen (string) + 16));
|
||||
else
|
||||
result = xmalloc (result_size = strlen (string));
|
||||
|
||||
/* Scan through STRING expanding tildes as we come to them. */
|
||||
while (1)
|
||||
@ -215,97 +242,143 @@ tilde_expand (string)
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Take FNAME and return the tilde prefix we want expanded. If LENP is
|
||||
non-null, the index of the end of the prefix into FNAME is returned in
|
||||
the location it points to. */
|
||||
static char *
|
||||
isolate_tilde_prefix (fname, lenp)
|
||||
char *fname;
|
||||
int *lenp;
|
||||
{
|
||||
char *ret;
|
||||
int i;
|
||||
|
||||
ret = xmalloc (strlen (fname));
|
||||
for (i = 1; fname[i] && fname[i] != '/'; i++)
|
||||
ret[i - 1] = fname[i];
|
||||
ret[i - 1] = '\0';
|
||||
if (lenp)
|
||||
*lenp = i;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Return a string that is PREFIX concatenated with SUFFIX starting at
|
||||
SUFFIND. */
|
||||
static char *
|
||||
glue_prefix_and_suffix (prefix, suffix, suffind)
|
||||
char *prefix, *suffix;
|
||||
int suffind;
|
||||
{
|
||||
char *ret;
|
||||
int plen, slen;
|
||||
|
||||
plen = (prefix && *prefix) ? strlen (prefix) : 0;
|
||||
slen = strlen (suffix + suffind);
|
||||
ret = xmalloc (plen + slen + 1);
|
||||
if (prefix && *prefix)
|
||||
strcpy (ret, prefix);
|
||||
strcpy (ret + plen, suffix + suffind);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_home_dir ()
|
||||
{
|
||||
char *home_dir;
|
||||
|
||||
#ifdef SHELL
|
||||
home_dir = (char *)NULL;
|
||||
if (current_user.home_dir == 0)
|
||||
get_current_user_info ();
|
||||
home_dir = current_user.home_dir;
|
||||
#else
|
||||
struct passwd *entry;
|
||||
|
||||
home_dir = (char *)NULL;
|
||||
entry = getpwuid (getuid ());
|
||||
if (entry)
|
||||
home_dir = entry->pw_dir;
|
||||
#endif
|
||||
return (home_dir);
|
||||
}
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook.
|
||||
This always returns a newly-allocated string, never static storage. */
|
||||
char *
|
||||
tilde_expand_word (filename)
|
||||
char *filename;
|
||||
{
|
||||
char *dirname;
|
||||
char *temp_name;
|
||||
char *dirname, *expansion, *username;
|
||||
int user_len;
|
||||
struct passwd *user_entry;
|
||||
|
||||
if (filename == (char *)0)
|
||||
if (filename == 0)
|
||||
return ((char *)NULL);
|
||||
|
||||
dirname = savestring (filename);
|
||||
if (*filename != '~')
|
||||
return (savestring (filename));
|
||||
|
||||
if (*dirname != '~')
|
||||
return (dirname);
|
||||
|
||||
if (!dirname[1] || dirname[1] == '/')
|
||||
/* A leading `~/' or a bare `~' is *always* translated to the value of
|
||||
$HOME or the home directory of the current user, regardless of any
|
||||
preexpansion hook. */
|
||||
if (filename[1] == '\0' || filename[1] == '/')
|
||||
{
|
||||
/* Prepend $HOME to the rest of the string. */
|
||||
char *temp_home = (char *)getenv ("HOME");
|
||||
int home_len;
|
||||
/* Prefix $HOME to the rest of the string. */
|
||||
expansion = get_string_value ("HOME");
|
||||
|
||||
/* If there is no HOME variable, look up the directory in
|
||||
the password database. */
|
||||
if (!temp_home)
|
||||
if (expansion == 0)
|
||||
expansion = get_home_dir ();
|
||||
|
||||
return (glue_prefix_and_suffix (expansion, filename, 1));
|
||||
}
|
||||
|
||||
username = isolate_tilde_prefix (filename, &user_len);
|
||||
|
||||
if (tilde_expansion_preexpansion_hook)
|
||||
{
|
||||
expansion = (*tilde_expansion_preexpansion_hook) (username);
|
||||
if (expansion)
|
||||
{
|
||||
struct passwd *entry;
|
||||
|
||||
entry = getpwuid (getuid ());
|
||||
if (entry)
|
||||
temp_home = entry->pw_dir;
|
||||
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
|
||||
free (username);
|
||||
free (expansion);
|
||||
return (dirname);
|
||||
}
|
||||
}
|
||||
|
||||
home_len = temp_home ? strlen (temp_home) : 0;
|
||||
temp_name = xmalloc (1 + strlen (dirname + 1) + home_len);
|
||||
|
||||
if (temp_home)
|
||||
strcpy (temp_name, temp_home);
|
||||
strcpy (temp_name + home_len, dirname + 1);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
/* No preexpansion hook, or the preexpansion hook failed. Look in the
|
||||
password database. */
|
||||
dirname = (char *)NULL;
|
||||
user_entry = getpwnam (username);
|
||||
if (user_entry == 0)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
expansion = (*tilde_expansion_failure_hook) (username);
|
||||
if (expansion)
|
||||
{
|
||||
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
|
||||
free (expansion);
|
||||
}
|
||||
}
|
||||
free (username);
|
||||
/* If we don't have a failure hook, or if the failure hook did not
|
||||
expand the tilde, return a copy of what we were passed. */
|
||||
if (dirname == 0)
|
||||
dirname = savestring (filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *username;
|
||||
struct passwd *user_entry;
|
||||
int i, len;
|
||||
|
||||
username = xmalloc (strlen (dirname));
|
||||
for (i = 1; dirname[i] && dirname[i] != '/'; i++)
|
||||
username[i - 1] = dirname[i];
|
||||
username[i - 1] = '\0';
|
||||
|
||||
if ((user_entry = getpwnam (username)) == (struct passwd *)0)
|
||||
{
|
||||
/* 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 = (*tilde_expansion_failure_hook) (username);
|
||||
|
||||
if (expansion)
|
||||
{
|
||||
len = strlen (expansion);
|
||||
temp_name = xmalloc (1 + len + strlen (dirname + i));
|
||||
strcpy (temp_name, expansion);
|
||||
strcpy (temp_name + len, dirname + i);
|
||||
free (expansion);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
}
|
||||
}
|
||||
/* We shouldn't report errors. */
|
||||
}
|
||||
else
|
||||
{
|
||||
len = strlen (user_entry->pw_dir);
|
||||
temp_name = xmalloc (1 + len + strlen (dirname + i));
|
||||
strcpy (temp_name, user_entry->pw_dir);
|
||||
strcpy (temp_name + len, dirname + i);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
}
|
||||
endpwent ();
|
||||
free (username);
|
||||
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
|
||||
}
|
||||
|
||||
endpwent ();
|
||||
return (dirname);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,12 @@ typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
/* If non-null, this contains the address of a function that the application
|
||||
wants called before trying the standard tilde expansions. The function
|
||||
is called with the text sans tilde, and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if the expansion fails. */
|
||||
extern CPFunction *tilde_expansion_preexpansion_hook;
|
||||
|
||||
/* 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
|
||||
|
@ -38,7 +38,6 @@
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
|
Loading…
Reference in New Issue
Block a user