Merge with previous variant

This commit is contained in:
Andrey A. Chernov 1997-06-07 12:58:06 +00:00
parent 9698361552
commit 88d4735de6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26500
9 changed files with 101 additions and 182 deletions

View File

@ -1,32 +0,0 @@
This is a description of C preprocessor defines that readline accepts.
Most are passed in from the parent `make'; e.g. from the bash source
directory.
NO_SYS_FILE <sys/file.h> is not present
HAVE_UNISTD_H <unistd.h> exists
HAVE_STDLIB_H <stdlib.h> exists
HAVE_VARARGS_H <varargs.h> exists and is usable
HAVE_STRING_H <string.h> exists
HAVE_ALLOCA_H <alloca.h> exists and is needed for alloca()
HAVE_ALLOCA alloca(3) or a define for it exists
PRAGMA_ALLOCA use of alloca() requires a #pragma, as in AIX 3.x
VOID_SIGHANDLER signal handlers are void functions
HAVE_DIRENT_H <dirent.h> exists and is usable
HAVE_SYS_PTEM_H <sys/ptem.h> exists
HAVE_SYS_PTE_H <sys/pte.h> exists
HAVE_SYS_STREAM_H <sys/stream.h> exists
HAVE_SYS_SELECT_H <sys/select.h> exists
System-specific options:
GWINSZ_IN_SYS_IOCTL need to include <sys/ioctl.h> for TIOCGWINSZ
HAVE_GETPW_DECLS the getpw* functions are declared in <pwd.h> and cannot
be redeclared without compiler errors
HAVE_STRCASECMP the strcasecmp and strncasecmp functions are available
USG Running a variant of System V
USGr3 Running System V.3
XENIX_22 Xenix 2.2
Linux Linux
CRAY running a recent version of Cray UNICOS
SunOS4 Running SunOS 4.x

View File

@ -25,7 +25,6 @@
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
@ -42,6 +41,8 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h>
#include <errno.h>
#if !defined (errno)
extern int errno;
@ -137,7 +138,7 @@ int rl_visible_stats = 0;
static int completion_changed_buffer;
/* Pointer to the generator function for completion_matches ().
NULL means to use filename_entry_function (), the default filename
NULL means to use filename_completion_function (), the default filename
completer. */
Function *rl_completion_entry_function = (Function *)NULL;
@ -761,12 +762,13 @@ insert_text (text, start, end)
}
static char *
make_quoted_replacement (match, mtype, quote_char)
make_quoted_replacement (match, mtype, qc)
char *match;
int mtype, quote_char;
int mtype;
char *qc; /* Pointer to quoting character, if any */
{
int should_quote, do_replace;
char *replacement, qc;
char *replacement;
/* If we are doing completion on quoted substrings, and any matches
contain any of the completer_word_break_characters, then auto-
@ -784,10 +786,10 @@ make_quoted_replacement (match, mtype, quote_char)
if (should_quote)
#if defined (SHELL)
should_quote = should_quote && (!quote_char || quote_char == '"' || quote_char == '\'');
#else
should_quote = should_quote && !quote_char;
#endif
should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\'');
#else /* !SHELL */
should_quote = should_quote && (!qc || !*qc);
#endif /* !SHELL */
if (should_quote)
{
@ -797,37 +799,37 @@ make_quoted_replacement (match, mtype, quote_char)
should_quote = rl_strpbrk (match, rl_filename_quote_characters) != 0;
do_replace = should_quote ? mtype : NO_MATCH;
if (do_replace != NO_MATCH)
{
/* Quote the replacement, since we found an embedded
word break character in a potential match. */
if (rl_filename_quoting_function)
{
qc = quote_char; /* must pass a (char *) to quoting function */
replacement = (*rl_filename_quoting_function)
(match, do_replace, &qc);
quote_char = qc;
}
}
/* Quote the replacement, since we found an embedded
word break character in a potential match. */
if (do_replace != NO_MATCH && rl_filename_quoting_function)
replacement = (*rl_filename_quoting_function) (match, do_replace, qc);
}
return (replacement);
}
static void
insert_match (match, start, mtype, quote_char)
insert_match (match, start, mtype, qc)
char *match;
int start, mtype, quote_char;
int start, mtype;
char *qc;
{
char *replacement;
char oqc;
replacement = make_quoted_replacement (match, mtype, quote_char);
oqc = qc ? *qc : '\0';
replacement = make_quoted_replacement (match, mtype, qc);
/* Now insert the match. */
if (replacement)
{
/* Don't double an opening quote character. */
if (quote_char && start && rl_line_buffer[start - 1] == quote_char &&
replacement[0] == quote_char)
if (qc && *qc && start && rl_line_buffer[start - 1] == *qc &&
replacement[0] == *qc)
start--;
/* If make_quoted_replacement changed the quoting character, remove
the opening quote and insert the (fully-quoted) replacement. */
else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
replacement[0] != oqc)
start--;
insert_text (replacement, start, rl_point - 1);
if (replacement != match)
@ -882,9 +884,10 @@ append_to_match (text, delimiter, quote_char)
}
static void
insert_all_matches (matches, point, quote_char)
insert_all_matches (matches, point, qc)
char **matches;
int point, quote_char;
int point;
char *qc;
{
int i;
char *rp;
@ -892,7 +895,7 @@ insert_all_matches (matches, point, quote_char)
rl_begin_undo_group ();
/* remove any opening quote character; make_quoted_replacement will add
it back. */
if (quote_char && point && rl_line_buffer[point - 1] == quote_char)
if (qc && *qc && point && rl_line_buffer[point - 1] == *qc)
point--;
rl_delete_text (point, rl_point);
rl_point = point;
@ -901,7 +904,7 @@ insert_all_matches (matches, point, quote_char)
{
for (i = 1; matches[i]; i++)
{
rp = make_quoted_replacement (matches[i], SINGLE_MATCH, quote_char);
rp = make_quoted_replacement (matches[i], SINGLE_MATCH, qc);
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[i])
@ -910,7 +913,7 @@ insert_all_matches (matches, point, quote_char)
}
else
{
rp = make_quoted_replacement (matches[0], SINGLE_MATCH, quote_char);
rp = make_quoted_replacement (matches[0], SINGLE_MATCH, qc);
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[0])
@ -964,12 +967,12 @@ rl_complete_internal (what_to_do)
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
free (text);
if (matches == 0)
{
ding ();
FREE (saved_line_buffer);
free (text);
return 0;
}
@ -998,6 +1001,7 @@ rl_complete_internal (what_to_do)
FREE (matches);
ding ();
FREE (saved_line_buffer);
FREE (text);
return 0;
}
else
@ -1013,6 +1017,7 @@ rl_complete_internal (what_to_do)
}
}
}
free (text);
switch (what_to_do)
{
@ -1020,7 +1025,7 @@ rl_complete_internal (what_to_do)
case '!':
/* Insert the first match with proper quoting. */
if (*matches[0])
insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, quote_char);
insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
/* If there are more matches, ring the bell to indicate.
If we are in vi mode, Posix.2 says to not ring the bell.
@ -1046,7 +1051,7 @@ rl_complete_internal (what_to_do)
break;
case '*':
insert_all_matches (matches, start, quote_char);
insert_all_matches (matches, start, &quote_char);
break;
case '?':
@ -1102,10 +1107,14 @@ stat_char (filename)
character = 0;
if (S_ISDIR (finfo.st_mode))
character = '/';
#if defined (S_ISCHR)
else if (S_ISCHR (finfo.st_mode))
character = '%';
#endif /* S_ISCHR */
#if defined (S_ISBLK)
else if (S_ISBLK (finfo.st_mode))
character = '#';
#endif /* S_ISBLK */
#if defined (S_ISLNK)
else if (S_ISLNK (finfo.st_mode))
character = '@';
@ -1321,7 +1330,7 @@ filename_completion_function (text, state)
int state;
char *text;
{
static DIR *directory;
static DIR *directory = (DIR *)NULL;
static char *filename = (char *)NULL;
static char *dirname = (char *)NULL;
static char *users_dirname = (char *)NULL;
@ -1333,6 +1342,13 @@ filename_completion_function (text, state)
/* If we don't have any state, then do some initialization. */
if (state == 0)
{
/* If we were interrupted before closing the directory or reading
all of its contents, close it. */
if (directory)
{
closedir (directory);
directory = (DIR *)NULL;
}
FREE (dirname);
FREE (filename);
FREE (users_dirname);

View File

@ -1,69 +0,0 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
TEXI2DVI = texi2dvi
RM = rm -f
INSTALL_DATA = cp
infodir = /usr/local/info
RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
DVIOBJ = readline.dvi history.dvi
INFOOBJ = readline.info history.info
PSOBJ = readline.ps history.ps
HTMLOBJ = readline.html history.html
all: info dvi html
readline.dvi: $(RLSRC)
$(TEXI2DVI) rlman.texinfo
mv rlman.dvi readline.dvi
readline.info: $(RLSRC)
makeinfo --no-split -o $@ rlman.texinfo
history.dvi: ${HISTSRC}
$(TEXI2DVI) hist.texinfo
mv hist.dvi history.dvi
history.info: ${HISTSRC}
makeinfo --no-split -o $@ hist.texinfo
readline.ps: readline.dvi
dvips -D 300 -o $@ readline.dvi
history.ps: history.dvi
dvips -D 300 -o $@ history.dvi
readline.html: ${RLSRC}
texi2html 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 -f rlman.html rlman_toc.html
history.html: ${HISTSRC}
texi2html 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 -f hist.html hist_toc.html
info: $(INFOOBJ)
dvi: $(DVIOBJ)
ps: $(PSOBJ)
html: $(HTMLOBJ)
clean:
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.fns *.kys *.tps *.vrs *.o core
distclean: clean
mostlyclean: clean
maintainer-clean: clean
$(RM) *.dvi *.info *.info-* *.ps *.html
install: info
${INSTALL_DATA} readline.info $(infodir)/readline.info
${INSTALL_DATA} history.info $(infodir)/history.info

View File

@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Mon Jul 8 13:07:48 EDT 1996
.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
.TH READLINE 3 "1996 July 8" GNU
.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@ -22,7 +22,6 @@ readline \- get a line from a user with editing
.LP
.nf
.ft B
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
.ft
@ -683,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new
argument. M\-\- starts a negative argument.
.TP
.B 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
.B 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.
first time makes the argument count four, a second time makes the
argument count sixteen, and so on.
.PD
.SS Completing
.PP

View File

@ -1,19 +0,0 @@
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
#
EXECUTABLES = fileman rltest
CFLAGS = -g -I../.. -I..
LDFLAGS = -g -L..
.c.o:
$(CC) $(CFLAGS) -c $<
all: $(EXECUTABLES)
fileman: fileman.o
$(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
rltest: rltest.o
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
fileman.o: fileman.c
rltest.o: rltest.c

View File

@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Mon Jul 8 13:07:48 EDT 1996
.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
.TH READLINE 3 "1996 July 8" GNU
.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@ -22,7 +22,6 @@ readline \- get a line from a user with editing
.LP
.nf
.ft B
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
.ft
@ -683,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new
argument. M\-\- starts a negative argument.
.TP
.B 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
.B 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.
first time makes the argument count four, a second time makes the
argument count sixteen, and so on.
.PD
.SS Completing
.PP

View File

@ -102,7 +102,7 @@ extern int
rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
extern int rl_vi_check (), rl_vi_textmod_command ();
extern int rl_vi_check ();
extern int
rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (),
rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
@ -236,6 +236,10 @@ extern char *rl_library_version;
whatever was in argv[0]. It is used when parsing conditionals. */
extern char *rl_readline_name;
/* The prompt readline uses. This is set from the argument to
readline (), and should not be assigned to directly. */
extern char *rl_prompt;
/* The line buffer that is in use. */
extern char *rl_line_buffer;
@ -248,6 +252,11 @@ extern int rl_done;
extern int rl_pending_input;
/* 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;
/* The name of the terminal to use. */
extern char *rl_terminal_name;
@ -370,6 +379,14 @@ extern int rl_completion_type;
default is a space. Nothing is added if this is '\0'. */
extern int rl_completion_append_character;
/* Up to this many items will be displayed in response to a
possible-completions call. After that, we ask the user if she
is sure she wants to see them all. The default value is 100. */
extern int rl_completion_query_items;
/* If non-zero, then disallow duplicates in the matches. */
extern int rl_ignore_completion_duplicates;
/* If this is non-zero, completion is (temporarily) inhibited, and the
completion character will be inserted as any other. */
extern int rl_inhibit_completion;

View File

@ -47,7 +47,7 @@ extern char *xmalloc (), *xrealloc ();
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
char *
savestring (s)
rl_savestring (s)
char *s;
{
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));

View File

@ -25,11 +25,9 @@
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <setjmp.h>
#include <ctype.h>
#include "posixjmp.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
@ -41,6 +39,9 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h>
#include <ctype.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@ -55,7 +56,7 @@
/* Pseudo-globals imported from readline.c */
extern int readline_echoing_p;
extern jmp_buf readline_top_level;
extern procenv_t readline_top_level;
extern int rl_line_buffer_len;
extern Function *rl_last_func;
@ -243,17 +244,6 @@ _rl_qsort_string_compare (s1, s2)
#endif
}
#if !defined (SHELL)
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
char *
rl_savestring (s)
char *s;
{
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
}
#endif /* !SHELL */
/* Function equivalents for the macros defined in chartypes.h. */
#undef _rl_uppercase_p
int