Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7cf58d1f
Commit
7cf58d1f
authored
Jul 18, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade bundled readline to version 5.0.
parent
086c3206
Changes
46
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
1834 additions
and
721 deletions
+1834
-721
cmd-line-utils/readline/INSTALL
cmd-line-utils/readline/INSTALL
+1
-1
cmd-line-utils/readline/Makefile.am
cmd-line-utils/readline/Makefile.am
+2
-1
cmd-line-utils/readline/README
cmd-line-utils/readline/README
+1
-1
cmd-line-utils/readline/bind.c
cmd-line-utils/readline/bind.c
+115
-41
cmd-line-utils/readline/callback.c
cmd-line-utils/readline/callback.c
+4
-2
cmd-line-utils/readline/chardefs.h
cmd-line-utils/readline/chardefs.h
+5
-1
cmd-line-utils/readline/compat.c
cmd-line-utils/readline/compat.c
+113
-0
cmd-line-utils/readline/complete.c
cmd-line-utils/readline/complete.c
+246
-58
cmd-line-utils/readline/configure.in
cmd-line-utils/readline/configure.in
+12
-3
cmd-line-utils/readline/display.c
cmd-line-utils/readline/display.c
+162
-76
cmd-line-utils/readline/funmap.c
cmd-line-utils/readline/funmap.c
+4
-1
cmd-line-utils/readline/histexpand.c
cmd-line-utils/readline/histexpand.c
+221
-119
cmd-line-utils/readline/histfile.c
cmd-line-utils/readline/histfile.c
+101
-36
cmd-line-utils/readline/history.c
cmd-line-utils/readline/history.c
+79
-15
cmd-line-utils/readline/history.h
cmd-line-utils/readline/history.h
+24
-4
cmd-line-utils/readline/histsearch.c
cmd-line-utils/readline/histsearch.c
+6
-4
cmd-line-utils/readline/input.c
cmd-line-utils/readline/input.c
+26
-4
cmd-line-utils/readline/isearch.c
cmd-line-utils/readline/isearch.c
+7
-5
cmd-line-utils/readline/keymaps.c
cmd-line-utils/readline/keymaps.c
+9
-8
cmd-line-utils/readline/kill.c
cmd-line-utils/readline/kill.c
+52
-9
cmd-line-utils/readline/macro.c
cmd-line-utils/readline/macro.c
+6
-4
cmd-line-utils/readline/mbutil.c
cmd-line-utils/readline/mbutil.c
+35
-22
cmd-line-utils/readline/misc.c
cmd-line-utils/readline/misc.c
+26
-12
cmd-line-utils/readline/nls.c
cmd-line-utils/readline/nls.c
+35
-6
cmd-line-utils/readline/parens.c
cmd-line-utils/readline/parens.c
+7
-1
cmd-line-utils/readline/posixdir.h
cmd-line-utils/readline/posixdir.h
+7
-3
cmd-line-utils/readline/readline.c
cmd-line-utils/readline/readline.c
+50
-23
cmd-line-utils/readline/readline.h
cmd-line-utils/readline/readline.h
+50
-13
cmd-line-utils/readline/rldefs.h
cmd-line-utils/readline/rldefs.h
+1
-5
cmd-line-utils/readline/rlmbutil.h
cmd-line-utils/readline/rlmbutil.h
+16
-3
cmd-line-utils/readline/rlprivate.h
cmd-line-utils/readline/rlprivate.h
+18
-14
cmd-line-utils/readline/rlstdc.h
cmd-line-utils/readline/rlstdc.h
+1
-1
cmd-line-utils/readline/rltty.c
cmd-line-utils/readline/rltty.c
+109
-48
cmd-line-utils/readline/rltty.h
cmd-line-utils/readline/rltty.h
+16
-16
cmd-line-utils/readline/rltypedefs.h
cmd-line-utils/readline/rltypedefs.h
+7
-1
cmd-line-utils/readline/savestring.c
cmd-line-utils/readline/savestring.c
+37
-0
cmd-line-utils/readline/search.c
cmd-line-utils/readline/search.c
+18
-6
cmd-line-utils/readline/shell.c
cmd-line-utils/readline/shell.c
+7
-1
cmd-line-utils/readline/signals.c
cmd-line-utils/readline/signals.c
+10
-2
cmd-line-utils/readline/terminal.c
cmd-line-utils/readline/terminal.c
+47
-50
cmd-line-utils/readline/text.c
cmd-line-utils/readline/text.c
+40
-31
cmd-line-utils/readline/tilde.c
cmd-line-utils/readline/tilde.c
+6
-2
cmd-line-utils/readline/undo.c
cmd-line-utils/readline/undo.c
+6
-5
cmd-line-utils/readline/util.c
cmd-line-utils/readline/util.c
+7
-5
cmd-line-utils/readline/vi_mode.c
cmd-line-utils/readline/vi_mode.c
+79
-57
cmd-line-utils/readline/xmalloc.c
cmd-line-utils/readline/xmalloc.c
+3
-1
No files found.
cmd-line-utils/readline/INSTALL
View file @
7cf58d1f
Basic Installation
==================
These are installation instructions for Readline-
4.3
.
These are installation instructions for Readline-
5.0
.
The simplest way to compile readline is:
...
...
cmd-line-utils/readline/Makefile.am
View file @
7cf58d1f
...
...
@@ -17,7 +17,8 @@ libreadline_a_SOURCES = readline.c funmap.c keymaps.c \
callback.c terminal.c xmalloc.c
\
history.c histsearch.c histexpand.c
\
histfile.c nls.c search.c
\
shell.c tilde.c misc.c text.c mbutil.c
shell.c tilde.c misc.c text.c mbutil.c
\
compat.c savestring.c
pkginclude_HEADERS
=
readline.h chardefs.h keymaps.h
\
history.h tilde.h rlmbutil.h rltypedefs.h rlprivate.h
\
...
...
cmd-line-utils/readline/README
View file @
7cf58d1f
Introduction
============
This is the Gnu Readline library, version
4.3
.
This is the Gnu Readline library, version
5.0
.
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
...
...
cmd-line-utils/readline/bind.c
View file @
7cf58d1f
...
...
@@ -19,9 +19,16 @@
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,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (__TANDEM)
# include <floss.h>
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
...
...
@@ -146,6 +153,34 @@ rl_bind_key_in_map (key, function, map)
return
(
result
);
}
/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
now, this is always used to attempt to bind the arrow keys, hence the
check for rl_vi_movement_mode. */
int
rl_bind_key_if_unbound_in_map
(
key
,
default_func
,
kmap
)
int
key
;
rl_command_func_t
*
default_func
;
Keymap
kmap
;
{
char
keyseq
[
2
];
keyseq
[
0
]
=
(
unsigned
char
)
key
;
keyseq
[
1
]
=
'\0'
;
return
(
rl_bind_keyseq_if_unbound_in_map
(
keyseq
,
default_func
,
kmap
));
}
int
rl_bind_key_if_unbound
(
key
,
default_func
)
int
key
;
rl_command_func_t
*
default_func
;
{
char
keyseq
[
2
];
keyseq
[
0
]
=
(
unsigned
char
)
key
;
keyseq
[
1
]
=
'\0'
;
return
(
rl_bind_keyseq_if_unbound_in_map
(
keyseq
,
default_func
,
_rl_keymap
));
}
/* Make KEY do nothing in the currently selected keymap.
Returns non-zero in case of error. */
int
...
...
@@ -197,10 +232,31 @@ rl_unbind_command_in_map (command, map)
return
(
rl_unbind_function_in_map
(
func
,
map
));
}
/* Bind the key sequence represented by the string KEYSEQ to
FUNCTION, starting in the current keymap. This makes new
keymaps as necessary. */
int
rl_bind_keyseq
(
keyseq
,
function
)
const
char
*
keyseq
;
rl_command_func_t
*
function
;
{
return
(
rl_generic_bind
(
ISFUNC
,
keyseq
,
(
char
*
)
function
,
_rl_keymap
));
}
/* Bind the key sequence represented by the string KEYSEQ to
FUNCTION. This makes new keymaps as necessary. The initial
place to do bindings is in MAP. */
int
rl_bind_keyseq_in_map
(
keyseq
,
function
,
map
)
const
char
*
keyseq
;
rl_command_func_t
*
function
;
Keymap
map
;
{
return
(
rl_generic_bind
(
ISFUNC
,
keyseq
,
(
char
*
)
function
,
map
));
}
/* Backwards compatibility; equivalent to rl_bind_keyseq_in_map() */
int
rl_set_key
(
keyseq
,
function
,
map
)
const
char
*
keyseq
;
rl_command_func_t
*
function
;
...
...
@@ -209,6 +265,40 @@ rl_set_key (keyseq, function, map)
return
(
rl_generic_bind
(
ISFUNC
,
keyseq
,
(
char
*
)
function
,
map
));
}
/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
now, this is always used to attempt to bind the arrow keys, hence the
check for rl_vi_movement_mode. */
int
rl_bind_keyseq_if_unbound_in_map
(
keyseq
,
default_func
,
kmap
)
const
char
*
keyseq
;
rl_command_func_t
*
default_func
;
Keymap
kmap
;
{
rl_command_func_t
*
func
;
if
(
keyseq
)
{
func
=
rl_function_of_keyseq
(
keyseq
,
kmap
,
(
int
*
)
NULL
);
#if defined (VI_MODE)
if
(
!
func
||
func
==
rl_do_lowercase_version
||
func
==
rl_vi_movement_mode
)
#else
if
(
!
func
||
func
==
rl_do_lowercase_version
)
#endif
return
(
rl_bind_keyseq_in_map
(
keyseq
,
default_func
,
kmap
));
else
return
1
;
}
return
0
;
}
int
rl_bind_keyseq_if_unbound
(
keyseq
,
default_func
)
const
char
*
keyseq
;
rl_command_func_t
*
default_func
;
{
return
(
rl_bind_keyseq_if_unbound_in_map
(
keyseq
,
default_func
,
_rl_keymap
));
}
/* Bind the key sequence represented by the string KEYSEQ to
the string of characters MACRO. This makes new keymaps as
necessary. The initial place to do bindings is in MAP. */
...
...
@@ -346,7 +436,7 @@ rl_translate_keyseq (seq, array, len)
{
register
int
i
,
c
,
l
,
temp
;
for
(
i
=
l
=
0
;
(
c
=
seq
[
i
])
;
i
++
)
for
(
i
=
l
=
0
;
c
=
seq
[
i
]
;
i
++
)
{
if
(
c
==
'\\'
)
{
...
...
@@ -678,7 +768,7 @@ _rl_read_file (filename, sizep)
/* Re-read the current keybindings file. */
int
rl_re_read_init_file
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
int
r
;
r
=
rl_read_init_file
((
const
char
*
)
NULL
);
...
...
@@ -900,7 +990,7 @@ parser_if (args)
/* Invert the current parser state if there is anything on the stack. */
static
int
parser_else
(
args
)
char
*
args
__attribute__
((
unused
))
;
char
*
args
;
{
register
int
i
;
...
...
@@ -910,9 +1000,15 @@ parser_else (args)
return
0
;
}
#if 0
/* Check the previous (n - 1) levels of the stack to make sure that
we haven't previously turned off parsing. */
for (i = 0; i < if_stack_depth - 1; i++)
#else
/* Check the previous (n) levels of the stack to make sure that
we haven't previously turned off parsing. */
for
(
i
=
0
;
i
<
if_stack_depth
;
i
++
)
#endif
if
(
if_stack
[
i
]
==
1
)
return
0
;
...
...
@@ -925,7 +1021,7 @@ parser_else (args)
_rl_parsing_conditionalized_out from the stack. */
static
int
parser_endif
(
args
)
char
*
args
__attribute__
((
unused
))
;
char
*
args
;
{
if
(
if_stack_depth
)
_rl_parsing_conditionalized_out
=
if_stack
[
--
if_stack_depth
];
...
...
@@ -1048,7 +1144,7 @@ rl_parse_and_bind (string)
{
int
passc
=
0
;
for
(
i
=
1
;
(
c
=
string
[
i
])
;
i
++
)
for
(
i
=
1
;
c
=
string
[
i
]
;
i
++
)
{
if
(
passc
)
{
...
...
@@ -1124,7 +1220,7 @@ rl_parse_and_bind (string)
{
int
delimiter
=
string
[
i
++
],
passc
;
for
(
passc
=
0
;
(
c
=
string
[
i
])
;
i
++
)
for
(
passc
=
0
;
c
=
string
[
i
]
;
i
++
)
{
if
(
passc
)
{
...
...
@@ -1159,7 +1255,7 @@ rl_parse_and_bind (string)
}
/* If this is a new-style key-binding, then do the binding with
rl_
set_key
(). Otherwise, let the older code deal with it. */
rl_
bind_keyseq
(). Otherwise, let the older code deal with it. */
if
(
*
string
==
'"'
)
{
char
*
seq
;
...
...
@@ -1198,7 +1294,7 @@ rl_parse_and_bind (string)
rl_macro_bind
(
seq
,
&
funname
[
1
],
_rl_keymap
);
}
else
rl_
set_key
(
seq
,
rl_named_function
(
funname
),
_rl_keymap
);
rl_
bind_keyseq
(
seq
,
rl_named_function
(
funname
)
);
free
(
seq
);
return
0
;
...
...
@@ -1279,10 +1375,11 @@ static struct {
{
"prefer-visible-bell"
,
&
_rl_prefer_visible_bell
,
V_SPECIAL
},
{
"print-completions-horizontally"
,
&
_rl_print_completions_horizontally
,
0
},
{
"show-all-if-ambiguous"
,
&
_rl_complete_show_all
,
0
},
{
"show-all-if-unmodified"
,
&
_rl_complete_show_unmodified
,
0
},
#if defined (VISIBLE_STATS)
{
"visible-stats"
,
&
rl_visible_stats
,
0
},
#endif
/* VISIBLE_STATS */
{
(
char
*
)
NULL
,
(
int
*
)
NULL
,
0
}
{
(
char
*
)
NULL
,
(
int
*
)
NULL
}
};
static
int
...
...
@@ -1351,7 +1448,7 @@ static struct {
{
"editing-mode"
,
V_STRING
,
sv_editmode
},
{
"isearch-terminators"
,
V_STRING
,
sv_isrchterm
},
{
"keymap"
,
V_STRING
,
sv_keymap
},
{
(
char
*
)
NULL
,
0
,
0
}
{
(
char
*
)
NULL
,
0
}
};
static
int
...
...
@@ -1626,8 +1723,7 @@ rl_set_keymap_from_edit_mode ()
#endif
/* VI_MODE */
}
const
char
*
char
*
rl_get_keymap_name_from_edit_mode
()
{
if
(
rl_editing_mode
==
emacs_mode
)
...
...
@@ -1637,7 +1733,7 @@ rl_get_keymap_name_from_edit_mode ()
return
"vi"
;
#endif
/* VI_MODE */
else
return
"no
p
e"
;
return
"no
n
e"
;
}
/* **************************************************************** */
...
...
@@ -1649,7 +1745,7 @@ rl_get_keymap_name_from_edit_mode ()
/* Each of the following functions produces information about the
state of keybindings and functions known to Readline. The info
is always printed to rl_outstream, and in such a way that it can
be read back in (i.e., passed to rl_parse_and_bind (). */
be read back in (i.e., passed to rl_parse_and_bind ()
)
. */
/* Print the names of functions known to Readline. */
void
...
...
@@ -1872,7 +1968,7 @@ rl_function_dumper (print_readably)
fprintf
(
rl_outstream
,
"
\n
"
);
for
(
i
=
0
;
(
name
=
names
[
i
])
;
i
++
)
for
(
i
=
0
;
name
=
names
[
i
]
;
i
++
)
{
rl_command_func_t
*
function
;
char
**
invokers
;
...
...
@@ -1932,7 +2028,7 @@ rl_function_dumper (print_readably)
the output in such a way that it can be read back in. */
int
rl_dump_functions
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_dispatching
)
fprintf
(
rl_outstream
,
"
\r\n
"
);
...
...
@@ -2012,7 +2108,7 @@ rl_macro_dumper (print_readably)
int
rl_dump_macros
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_dispatching
)
fprintf
(
rl_outstream
,
"
\r\n
"
);
...
...
@@ -2102,7 +2198,7 @@ rl_variable_dumper (print_readably)
the output in such a way that it can be read back in. */
int
rl_dump_variables
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_dispatching
)
fprintf
(
rl_outstream
,
"
\r\n
"
);
...
...
@@ -2111,28 +2207,6 @@ rl_dump_variables (count, key)
return
(
0
);
}
/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
now, this is always used to attempt to bind the arrow keys, hence the
check for rl_vi_movement_mode. */
void
_rl_bind_if_unbound
(
keyseq
,
default_func
)
const
char
*
keyseq
;
rl_command_func_t
*
default_func
;
{
rl_command_func_t
*
func
;
if
(
keyseq
)
{
func
=
rl_function_of_keyseq
(
keyseq
,
_rl_keymap
,
(
int
*
)
NULL
);
#if defined (VI_MODE)
if
(
!
func
||
func
==
rl_do_lowercase_version
||
func
==
rl_vi_movement_mode
)
#else
if
(
!
func
||
func
==
rl_do_lowercase_version
)
#endif
rl_set_key
(
keyseq
,
default_func
,
_rl_keymap
);
}
}
/* Return non-zero if any members of ARRAY are a substring in STRING. */
static
int
substring_member_of_array
(
string
,
array
)
...
...
cmd-line-utils/readline/callback.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "rlconf.h"
...
...
@@ -129,7 +131,7 @@ rl_callback_read_char ()
if
(
in_handler
==
0
&&
rl_linefunc
)
_rl_callback_newline
();
}
if
(
rl_pending_input
)
if
(
rl_pending_input
||
_rl_pushed_input_available
()
)
eof
=
readline_internal_char
();
else
break
;
...
...
cmd-line-utils/readline/chardefs.h
View file @
7cf58d1f
...
...
@@ -77,7 +77,11 @@
# define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
#endif
#define NON_NEGATIVE(c) ((unsigned char)(c) == (c))
#if defined (CTYPE_NON_ASCII)
# define NON_NEGATIVE(c) 1
#else
# define NON_NEGATIVE(c) ((unsigned char)(c) == (c))
#endif
/* Some systems define these; we want our definitions. */
#undef ISPRINT
...
...
cmd-line-utils/readline/compat.c
0 → 100644
View file @
7cf58d1f
/* compat.c -- backwards compatibility functions. */
/* Copyright (C) 2000 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 2, 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,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include "rlstdc.h"
#include "rltypedefs.h"
extern
void
rl_free_undo_list
PARAMS
((
void
));
extern
int
rl_maybe_save_line
PARAMS
((
void
));
extern
int
rl_maybe_unsave_line
PARAMS
((
void
));
extern
int
rl_maybe_replace_line
PARAMS
((
void
));
extern
int
rl_crlf
PARAMS
((
void
));
extern
int
rl_ding
PARAMS
((
void
));
extern
int
rl_alphabetic
PARAMS
((
int
));
extern
char
**
rl_completion_matches
PARAMS
((
const
char
*
,
rl_compentry_func_t
*
));
extern
char
*
rl_username_completion_function
PARAMS
((
const
char
*
,
int
));
extern
char
*
rl_filename_completion_function
PARAMS
((
const
char
*
,
int
));
/* Provide backwards-compatible entry points for old function names. */
void
free_undo_list
()
{
rl_free_undo_list
();
}
int
maybe_replace_line
()
{
return
rl_maybe_replace_line
();
}
int
maybe_save_line
()
{
return
rl_maybe_save_line
();
}
int
maybe_unsave_line
()
{
return
rl_maybe_unsave_line
();
}
int
ding
()
{
return
rl_ding
();
}
int
crlf
()
{
return
rl_crlf
();
}
int
alphabetic
(
c
)
int
c
;
{
return
rl_alphabetic
(
c
);
}
char
**
completion_matches
(
s
,
f
)
const
char
*
s
;
rl_compentry_func_t
*
f
;
{
return
rl_completion_matches
(
s
,
f
);
}
char
*
username_completion_function
(
s
,
i
)
const
char
*
s
;
int
i
;
{
return
rl_username_completion_function
(
s
,
i
);
}
char
*
filename_completion_function
(
s
,
i
)
const
char
*
s
;
int
i
;
{
return
rl_filename_completion_function
(
s
,
i
);
}
cmd-line-utils/readline/complete.c
View file @
7cf58d1f
This diff is collapsed.
Click to expand it.
cmd-line-utils/readline/configure.in
View file @
7cf58d1f
...
...
@@ -4,9 +4,9 @@ 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
4.3, version 2.45
, from autoconf version] AC_ACVERSION)
AC_REVISION([for Readline
5.0, version 2.52
, from autoconf version] AC_ACVERSION)
AC_INIT(readline,
4.3
, bug-readline@gnu.org)
AC_INIT(readline,
5.0-rc1
, bug-readline@gnu.org)
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.50)
...
...
@@ -16,7 +16,7 @@ AC_CONFIG_AUX_DIR(./support)
AC_CONFIG_HEADERS(config.h)
dnl update the value of RL_READLINE_VERSION in readline.h when this changes
LIBVERSION=
4.3
LIBVERSION=
5.0
AC_CANONICAL_HOST
...
...
@@ -31,12 +31,18 @@ if test "$opt_curses" = "yes"; then
fi
dnl option parsing for optional features
opt_multibyte=yes
opt_static_libs=yes
opt_shared_libs=yes
AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
if test $opt_multibyte = no; then
AC_DEFINE(NO_MULTIBYTE_SUPPORT)
fi
echo ""
echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
echo ""
...
...
@@ -72,6 +78,8 @@ AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
AC_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_DIRENT
...
...
@@ -90,6 +98,7 @@ BASH_SYS_REINSTALL_SIGHANDLERS
BASH_FUNC_POSIX_SETJMP
BASH_FUNC_LSTAT
BASH_FUNC_STRCOLL
BASH_FUNC_CTYPE_NONASCII
BASH_CHECK_GETPW_FUNCS
...
...
cmd-line-utils/readline/display.c
View file @
7cf58d1f
This diff is collapsed.
Click to expand it.
cmd-line-utils/readline/funmap.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if !defined (BUFSIZ)
#include <stdio.h>
...
...
@@ -129,6 +131,7 @@ static FUNMAP default_funmap[] = {
{
"tty-status"
,
rl_tty_status
},
{
"undo"
,
rl_undo_command
},
{
"universal-argument"
,
rl_universal_argument
},
{
"unix-filename-rubout"
,
rl_unix_filename_rubout
},
{
"unix-line-discard"
,
rl_unix_line_discard
},
{
"unix-word-rubout"
,
rl_unix_word_rubout
},
{
"upcase-word"
,
rl_upcase_word
},
...
...
cmd-line-utils/readline/histexpand.c
View file @
7cf58d1f
This diff is collapsed.
Click to expand it.
cmd-line-utils/readline/histfile.c
View file @
7cf58d1f
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989
, 1992
Free Software Foundation, Inc.
/* Copyright (C) 1989
-2003
Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
...
...
@@ -23,14 +23,21 @@
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
you can call. I think I have done that. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (__TANDEM)
# include <floss.h>
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#if
ndef _MINIX
#if
! defined (_MINIX) && defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#include "posixstat.h"
...
...
@@ -50,7 +57,7 @@
# undef HAVE_MMAP
#endif
#ifdef H
AV
E_MMAP
#ifdef H
ISTORY_US
E_MMAP
# include <sys/mman.h>
# ifdef MAP_FILE
...
...
@@ -65,7 +72,7 @@
# define MAP_FAILED ((void *)-1)
# endif
#endif
/* H
AV
E_MMAP */
#endif
/* H
ISTORY_US
E_MMAP */
/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
on win 95/98/nt), we want to open files with O_BINARY mode so that there
...
...
@@ -91,6 +98,13 @@ extern int errno;
#include "rlshell.h"
#include "xmalloc.h"
/* If non-zero, we write timestamps to the history file in history_do_write() */
int
history_write_timestamps
=
0
;
/* Does S look like the beginning of a history timestamp entry? Placeholder
for more extensive tests. */
#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char)
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
filename to read_history (), or write_history (). */
...
...
@@ -149,13 +163,20 @@ read_history_range (filename, from, to)
const
char
*
filename
;
int
from
,
to
;
{
register
char
*
line_start
,
*
line_end
;
char
*
input
,
*
buffer
,
*
bufend
;
register
char
*
line_start
,
*
line_end
,
*
p
;
char
*
input
,
*
buffer
,
*
bufend
,
*
last_ts
;
int
file
,
current_line
,
chars_read
;
struct
stat
finfo
;
size_t
file_size
;
#if defined (EFBIG)
int
overflow_errno
=
EFBIG
;
#elif defined (EOVERFLOW)
int
overflow_errno
=
EOVERFLOW
;
#else
int
overflow_errno
=
EIO
;
#endif
buffer
=
(
char
*
)
NULL
;
buffer
=
last_ts
=
(
char
*
)
NULL
;
input
=
history_filename
(
filename
);
file
=
open
(
input
,
O_RDONLY
|
O_BINARY
,
0666
);
...
...
@@ -167,37 +188,42 @@ read_history_range (filename, from, to)
/* check for overflow on very large files */
if
(
file_size
!=
finfo
.
st_size
||
file_size
+
1
<
file_size
)
{
#if defined (EFBIG)
errno
=
EFBIG
;
#elif defined (EOVERFLOW)
errno
=
EOVERFLOW
;
#endif
errno
=
overflow_errno
;
goto
error_and_exit
;
}
#ifdef H
AV
E_MMAP
#ifdef H
ISTORY_US
E_MMAP
/* We map read/write and private so we can change newlines to NULs without
affecting the underlying object. */
buffer
=
(
char
*
)
mmap
(
0
,
file_size
,
PROT_READ
|
PROT_WRITE
,
MAP_RFLAGS
,
file
,
0
);
if
((
void
*
)
buffer
==
MAP_FAILED
)
goto
error_and_exit
;
{
errno
=
overflow_errno
;
goto
error_and_exit
;
}
chars_read
=
file_size
;
#else
buffer
=
(
char
*
)
malloc
(
file_size
+
1
);
if
(
buffer
==
0
)
goto
error_and_exit
;
{
errno
=
overflow_errno
;
goto
error_and_exit
;
}
chars_read
=
read
(
file
,
buffer
,
file_size
);
#endif
if
(
chars_read
<
0
)
{
error_and_exit:
chars_read
=
errno
;
if
(
errno
!=
0
)
chars_read
=
errno
;
else
chars_read
=
EIO
;
if
(
file
>=
0
)
close
(
file
);
FREE
(
input
);
#ifndef H
AV
E_MMAP
#ifndef H
ISTORY_US
E_MMAP
FREE
(
buffer
);
#endif
...
...
@@ -218,8 +244,12 @@ read_history_range (filename, from, to)
for
(
line_start
=
line_end
=
buffer
;
line_end
<
bufend
&&
current_line
<
from
;
line_end
++
)
if
(
*
line_end
==
'\n'
)
{
current_line
++
;
line_start
=
line_end
+
1
;
p
=
line_end
+
1
;
/* If we see something we think is a timestamp, continue with this
line. We should check more extensively here... */
if
(
HIST_TIMESTAMP_START
(
p
)
==
0
)
current_line
++
;
line_start
=
p
;
}
/* If there are lines left to gobble, then gobble them now. */
...
...
@@ -229,7 +259,22 @@ read_history_range (filename, from, to)
*
line_end
=
'\0'
;
if
(
*
line_start
)
add_history
(
line_start
);
{
if
(
HIST_TIMESTAMP_START
(
line_start
)
==
0
)
{
add_history
(
line_start
);
if
(
last_ts
)
{
add_history_time
(
last_ts
);
last_ts
=
NULL
;
}
}
else
{
last_ts
=
line_start
;
current_line
--
;
}
}
current_line
++
;
...
...
@@ -240,7 +285,7 @@ read_history_range (filename, from, to)
}
FREE
(
input
);
#ifndef H
AV
E_MMAP
#ifndef H
ISTORY_US
E_MMAP
FREE
(
buffer
);
#else
munmap
(
buffer
,
file_size
);
...
...
@@ -257,7 +302,7 @@ history_truncate_file (fname, lines)
const
char
*
fname
;
int
lines
;
{
char
*
buffer
,
*
filename
,
*
bp
;
char
*
buffer
,
*
filename
,
*
bp
,
*
bp1
;
/* bp1 == bp+1 */
int
file
,
chars_read
,
rv
;
struct
stat
finfo
;
size_t
file_size
;
...
...
@@ -320,11 +365,14 @@ history_truncate_file (fname, lines)
}
/* Count backwards from the end of buffer until we have passed
LINES lines. */
for
(
bp
=
buffer
+
chars_read
-
1
;
lines
&&
bp
>
buffer
;
bp
--
)
LINES lines. bp1 is set funny initially. But since bp[1] can't
be a comment character (since it's off the end) and *bp can't be
both a newline and the history comment character, it should be OK. */
for
(
bp1
=
bp
=
buffer
+
chars_read
-
1
;
lines
&&
bp
>
buffer
;
bp
--
)
{
if
(
*
bp
==
'\n'
)
if
(
*
bp
==
'\n'
&&
HIST_TIMESTAMP_START
(
bp1
)
==
0
)
lines
--
;
bp1
=
bp
;
}
/* If this is the first line, then the file contains exactly the
...
...
@@ -333,11 +381,14 @@ history_truncate_file (fname, lines)
the current value of i and 0. Otherwise, write from the start of
this line until the end of the buffer. */
for
(
;
bp
>
buffer
;
bp
--
)
if
(
*
bp
==
'\n'
)
{
bp
++
;
break
;
}
{
if
(
*
bp
==
'\n'
&&
HIST_TIMESTAMP_START
(
bp1
)
==
0
)
{
bp
++
;
break
;
}
bp1
=
bp
;
}
/* Write only if there are more lines in the file than we want to
truncate to. */
...
...
@@ -372,9 +423,9 @@ history_do_write (filename, nelements, overwrite)
register
int
i
;
char
*
output
;
int
file
,
mode
,
rv
;
#ifdef HISTORY_USE_MMAP
size_t
cursize
;
#ifdef HAVE_MMAP
mode
=
overwrite
?
O_RDWR
|
O_CREAT
|
O_TRUNC
|
O_BINARY
:
O_RDWR
|
O_APPEND
|
O_BINARY
;
#else
mode
=
overwrite
?
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
:
O_WRONLY
|
O_APPEND
|
O_BINARY
;
...
...
@@ -388,7 +439,7 @@ history_do_write (filename, nelements, overwrite)
return
(
errno
);
}
#ifdef H
AV
E_MMAP
#ifdef H
ISTORY_US
E_MMAP
cursize
=
overwrite
?
0
:
lseek
(
file
,
0
,
SEEK_END
);
#endif
...
...
@@ -406,10 +457,18 @@ history_do_write (filename, nelements, overwrite)
the_history
=
history_list
();
/* Calculate the total number of bytes to write. */
for
(
buffer_size
=
0
,
i
=
history_length
-
nelements
;
i
<
history_length
;
i
++
)
buffer_size
+=
1
+
strlen
(
the_history
[
i
]
->
line
);
#if 0
buffer_size += 2 + HISTENT_BYTES (the_history[i]);
#else
{
if
(
history_write_timestamps
&&
the_history
[
i
]
->
timestamp
&&
the_history
[
i
]
->
timestamp
[
0
])
buffer_size
+=
strlen
(
the_history
[
i
]
->
timestamp
)
+
1
;
buffer_size
+=
strlen
(
the_history
[
i
]
->
line
)
+
1
;
}
#endif
/* Allocate the buffer, and fill it. */
#ifdef H
AV
E_MMAP
#ifdef H
ISTORY_US
E_MMAP
if
(
ftruncate
(
file
,
buffer_size
+
cursize
)
==
-
1
)
goto
mmap_error
;
buffer
=
(
char
*
)
mmap
(
0
,
buffer_size
,
PROT_READ
|
PROT_WRITE
,
MAP_WFLAGS
,
file
,
cursize
);
...
...
@@ -434,12 +493,18 @@ mmap_error:
for
(
j
=
0
,
i
=
history_length
-
nelements
;
i
<
history_length
;
i
++
)
{
if
(
history_write_timestamps
&&
the_history
[
i
]
->
timestamp
&&
the_history
[
i
]
->
timestamp
[
0
])
{
strcpy
(
buffer
+
j
,
the_history
[
i
]
->
timestamp
);
j
+=
strlen
(
the_history
[
i
]
->
timestamp
);
buffer
[
j
++
]
=
'\n'
;
}
strcpy
(
buffer
+
j
,
the_history
[
i
]
->
line
);
j
+=
strlen
(
the_history
[
i
]
->
line
);
buffer
[
j
++
]
=
'\n'
;
}
#ifdef H
AV
E_MMAP
#ifdef H
ISTORY_US
E_MMAP
if
(
msync
(
buffer
,
buffer_size
,
0
)
!=
0
||
munmap
(
buffer
,
buffer_size
)
!=
0
)
rv
=
errno
;
#else
...
...
cmd-line-utils/readline/history.c
View file @
7cf58d1f
/*
H
istory.c -- standalone history library */
/*
h
istory.c -- standalone history library */
/* Copyright (C) 1989
, 1992
Free Software Foundation, Inc.
/* Copyright (C) 1989
-2003
Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
...
...
@@ -25,7 +25,9 @@
you can call. I think I have done that. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
...
...
@@ -50,6 +52,8 @@
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
static
char
*
hist_inittime
PARAMS
((
void
));
/* **************************************************************** */
/* */
/* History Functions */
...
...
@@ -121,14 +125,15 @@ using_history ()
}
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines. */
This just adds up the lengths of the_history->lines and the associated
timestamps. */
int
history_total_bytes
()
{
register
int
i
,
result
;
for
(
i
=
result
=
0
;
the_history
&&
the_history
[
i
];
i
++
)
result
+=
strlen
(
the_history
[
i
]
->
line
);
result
+=
HISTENT_BYTES
(
the_history
[
i
]
);
return
(
result
);
}
...
...
@@ -204,6 +209,40 @@ history_get (offset)
:
the_history
[
local_index
];
}
time_t
history_get_time
(
hist
)
HIST_ENTRY
*
hist
;
{
char
*
ts
;
time_t
t
;
if
(
hist
==
0
||
hist
->
timestamp
==
0
)
return
0
;
ts
=
hist
->
timestamp
;
if
(
ts
[
0
]
!=
history_comment_char
)
return
0
;
t
=
(
time_t
)
atol
(
ts
+
1
);
/* XXX - should use strtol() here */
return
t
;
}
static
char
*
hist_inittime
()
{
time_t
t
;
char
ts
[
64
],
*
ret
;
t
=
(
time_t
)
time
((
time_t
*
)
0
);
#if defined (HAVE_VSNPRINTF)
/* assume snprintf if vsnprintf exists */
snprintf
(
ts
,
sizeof
(
ts
)
-
1
,
"X%lu"
,
(
unsigned
long
)
t
);
#else
sprintf
(
ts
,
"X%lu"
,
(
unsigned
long
)
t
);
#endif
ret
=
savestring
(
ts
);
ret
[
0
]
=
history_comment_char
;
return
ret
;
}
/* Place STRING at the end of the history list. The data field
is set to NULL. */
void
...
...
@@ -223,10 +262,7 @@ add_history (string)
/* If there is something in the slot, then remove it. */
if
(
the_history
[
0
])
{
free
(
the_history
[
0
]
->
line
);
free
(
the_history
[
0
]);
}
(
void
)
free_history_entry
(
the_history
[
0
]);
/* Copy the rest of the entries, moving down one slot. */
for
(
i
=
0
;
i
<
history_length
;
i
++
)
...
...
@@ -258,10 +294,41 @@ add_history (string)
temp
->
line
=
savestring
(
string
);
temp
->
data
=
(
char
*
)
NULL
;
temp
->
timestamp
=
hist_inittime
();
the_history
[
history_length
]
=
(
HIST_ENTRY
*
)
NULL
;
the_history
[
history_length
-
1
]
=
temp
;
}
/* Change the time stamp of the most recent history entry to STRING. */
void
add_history_time
(
string
)
const
char
*
string
;
{
HIST_ENTRY
*
hs
;
hs
=
the_history
[
history_length
-
1
];
FREE
(
hs
->
timestamp
);
hs
->
timestamp
=
savestring
(
string
);
}
/* Free HIST and return the data so the calling application can free it
if necessary and desired. */
histdata_t
free_history_entry
(
hist
)
HIST_ENTRY
*
hist
;
{
histdata_t
x
;
if
(
hist
==
0
)
return
((
histdata_t
)
0
);
FREE
(
hist
->
line
);
FREE
(
hist
->
timestamp
);
x
=
hist
->
data
;
free
(
hist
);
return
(
x
);
}
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
...
...
@@ -281,6 +348,7 @@ replace_history_entry (which, line, data)
temp
->
line
=
savestring
(
line
);
temp
->
data
=
data
;
temp
->
timestamp
=
savestring
(
old_value
->
timestamp
);
the_history
[
which
]
=
temp
;
return
(
old_value
);
...
...
@@ -325,10 +393,7 @@ stifle_history (max)
{
/* This loses because we cannot free the data. */
for
(
i
=
0
,
j
=
history_length
-
max
;
i
<
j
;
i
++
)
{
free
(
the_history
[
i
]
->
line
);
free
(
the_history
[
i
]);
}
free_history_entry
(
the_history
[
i
]);
history_base
=
i
;
for
(
j
=
0
,
i
=
history_length
-
max
;
j
<
max
;
i
++
,
j
++
)
...
...
@@ -370,8 +435,7 @@ clear_history ()
/* This loses because we cannot free the data. */
for
(
i
=
0
;
i
<
history_length
;
i
++
)
{
free
(
the_history
[
i
]
->
line
);
free
(
the_history
[
i
]);
free_history_entry
(
the_history
[
i
]);
the_history
[
i
]
=
(
HIST_ENTRY
*
)
NULL
;
}
...
...
cmd-line-utils/readline/history.h
View file @
7cf58d1f
/*
H
istory.h -- the names of functions that you can call in history. */
/* Copyright (C) 1989
, 1992
Free Software Foundation, Inc.
/*
h
istory.h -- the names of functions that you can call in history. */
/* Copyright (C) 1989
-2003
Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
...
...
@@ -26,6 +26,8 @@
extern
"C"
{
#endif
#include <time.h>
/* XXX - for history timestamp code */
#if defined READLINE_LIBRARY
# include "rlstdc.h"
# include "rltypedefs.h"
...
...
@@ -43,9 +45,13 @@ typedef char *histdata_t;
/* The structure used to store a history entry. */
typedef
struct
_hist_entry
{
char
*
line
;
char
*
timestamp
;
/* char * rather than time_t for read/write */
histdata_t
data
;
}
HIST_ENTRY
;
/* Size of the history-library-managed space in history entry HS. */
#define HISTENT_BYTES(hs) (strlen ((hs)->line) + strlen ((hs)->timestamp))
/* A structure used to pass the current state of the history stuff around. */
typedef
struct
_hist_state
{
HIST_ENTRY
**
entries
;
/* Pointer to the entries themselves. */
...
...
@@ -76,11 +82,19 @@ extern void history_set_history_state PARAMS((HISTORY_STATE *));
The associated data field (if any) is set to NULL. */
extern
void
add_history
PARAMS
((
const
char
*
));
/* Change the timestamp associated with the most recent history entry to
STRING. */
extern
void
add_history_time
PARAMS
((
const
char
*
));
/* A reasonably useless function, only here for completeness. WHICH
is the magic number that tells us which element to delete. The
elements are numbered from 0. */
extern
HIST_ENTRY
*
remove_history
PARAMS
((
int
));
/* Free the history entry H and return any application-specific data
associated with it. */
extern
histdata_t
free_history_entry
PARAMS
((
HIST_ENTRY
*
));
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
...
...
@@ -119,6 +133,10 @@ extern HIST_ENTRY *current_history PARAMS((void));
array. OFFSET is relative to history_base. */
extern
HIST_ENTRY
*
history_get
PARAMS
((
int
));
/* Return the timestamp associated with the HIST_ENTRY * passed as an
argument */
extern
time_t
history_get_time
PARAMS
((
HIST_ENTRY
*
));
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines. */
extern
int
history_total_bytes
PARAMS
((
void
));
...
...
@@ -225,12 +243,14 @@ extern int history_length;
extern
int
history_max_entries
;
extern
char
history_expansion_char
;
extern
char
history_subst_char
;
extern
c
onst
c
har
*
history_word_delimiters
;
extern
char
*
history_word_delimiters
;
extern
char
history_comment_char
;
extern
c
onst
c
har
*
history_no_expand_chars
;
extern
char
*
history_no_expand_chars
;
extern
char
*
history_search_delimiter_chars
;
extern
int
history_quotes_inhibit_expansion
;
extern
int
history_write_timestamps
;
/* Backwards compatibility */
extern
int
max_input_history
;
...
...
cmd-line-utils/readline/histsearch.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#if defined (HAVE_STDLIB_H)
...
...
@@ -75,11 +77,11 @@ history_search_internal (string, direction, anchored)
if
(
string
==
0
||
*
string
==
'\0'
)
return
(
-
1
);
if
(
!
history_length
||
((
i
=
=
history_length
)
&&
!
reverse
))
if
(
!
history_length
||
((
i
>
=
history_length
)
&&
!
reverse
))
return
(
-
1
);
if
(
reverse
&&
(
i
=
=
history_length
))
i
--
;
if
(
reverse
&&
(
i
>
=
history_length
))
i
=
history_length
-
1
;
#define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)
...
...
cmd-line-utils/readline/input.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,13 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (__TANDEM)
# include <floss.h>
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
...
...
@@ -152,6 +158,12 @@ _rl_unget_char (key)
return
(
0
);
}
int
_rl_pushed_input_available
()
{
return
(
push_index
!=
pop_index
);
}
/* If a character is available to be read, then read it and stuff it into
IBUFFER. Otherwise, just return. Returns number of characters read
(0 if none available) and -1 on error (EIO). */
...
...
@@ -160,7 +172,7 @@ rl_gather_tyi ()
{
int
tty
;
register
int
tem
,
result
;
int
chars_avail
;
int
chars_avail
,
k
;
char
input
;
#if defined(HAVE_SELECT)
fd_set
readfds
,
exceptfds
;
...
...
@@ -200,6 +212,11 @@ rl_gather_tyi ()
fcntl
(
tty
,
F_SETFL
,
tem
);
if
(
chars_avail
==
-
1
&&
errno
==
EAGAIN
)
return
0
;
if
(
chars_avail
==
0
)
/* EOF */
{
rl_stuff_char
(
EOF
);
return
(
0
);
}
}
#endif
/* O_NDELAY */
...
...
@@ -223,7 +240,12 @@ rl_gather_tyi ()
if
(
result
!=
-
1
)
{
while
(
chars_avail
--
)
rl_stuff_char
((
*
rl_getc_function
)
(
rl_instream
));
{
k
=
(
*
rl_getc_function
)
(
rl_instream
);
rl_stuff_char
(
k
);
if
(
k
==
NEWLINE
||
k
==
RETURN
)
break
;
}
}
else
{
...
...
@@ -385,7 +407,7 @@ rl_read_key ()
else
{
/* If input is coming from a macro, then use that. */
if
(
(
c
=
_rl_next_macro_key
()
))
if
(
c
=
_rl_next_macro_key
(
))
return
(
c
);
/* If the user has an event function, then call it periodically. */
...
...
cmd-line-utils/readline/isearch.c
View file @
7cf58d1f
...
...
@@ -26,7 +26,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -68,7 +70,7 @@ static char *prev_line_found;
static
char
*
last_isearch_string
;
static
int
last_isearch_string_len
;
static
c
onst
c
har
*
default_isearch_terminators
=
"
\033\012
"
;
static
char
*
default_isearch_terminators
=
"
\033\012
"
;
/* Search backwards through the history looking for a string which is typed
interactively. Start with the current line. */
...
...
@@ -96,7 +98,7 @@ rl_forward_search_history (sign, key)
static
void
rl_display_search
(
search_string
,
reverse_p
,
where
)
char
*
search_string
;
int
reverse_p
,
where
__attribute__
((
unused
))
;
int
reverse_p
,
where
;
{
char
*
message
;
int
msglen
,
searchlen
;
...
...
@@ -144,7 +146,7 @@ rl_display_search (search_string, reverse_p, where)
backwards. */
static
int
rl_search_history
(
direction
,
invoking_key
)
int
direction
,
invoking_key
__attribute__
((
unused
))
;
int
direction
,
invoking_key
;
{
/* The string that the user types in to search for. */
char
*
search_string
;
...
...
@@ -184,7 +186,7 @@ rl_search_history (direction, invoking_key)
/* The list of characters which terminate the search, but are not
subsequently executed. If the variable isearch-terminators has
been set, we use that value, otherwise we use ESC and C-J. */
c
onst
c
har
*
isearch_terminators
;
char
*
isearch_terminators
;
RL_SETSTATE
(
RL_STATE_ISEARCH
);
orig_point
=
rl_point
;
...
...
cmd-line-utils/readline/keymaps.c
View file @
7cf58d1f
...
...
@@ -20,7 +20,9 @@
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
...
...
@@ -62,11 +64,13 @@ rl_make_bare_keymap ()
keymap
[
i
].
function
=
(
rl_command_func_t
*
)
NULL
;
}
#if 0
for (i = 'A'; i < ('Z' + 1); i++)
{
keymap[i].type = ISFUNC;
keymap[i].function = rl_do_lowercase_version;
}
#endif
return
(
keymap
);
}
...
...
@@ -77,8 +81,9 @@ rl_copy_keymap (map)
Keymap
map
;
{
register
int
i
;
Keymap
temp
=
rl_make_bare_keymap
()
;
Keymap
temp
;
temp
=
rl_make_bare_keymap
();
for
(
i
=
0
;
i
<
KEYMAP_SIZE
;
i
++
)
{
temp
[
i
].
type
=
map
[
i
].
type
;
...
...
@@ -107,12 +112,8 @@ rl_make_keymap ()
newmap
[
CTRL
(
'H'
)].
function
=
rl_rubout
;
#if KEYMAP_SIZE > 128
/* Printing characters in some 8-bit character sets. */
for
(
i
=
128
;
i
<
160
;
i
++
)
newmap
[
i
].
function
=
rl_insert
;
/* ISO Latin-1 printing characters should self-insert. */
for
(
i
=
160
;
i
<
256
;
i
++
)
/* Printing characters in ISO Latin-1 and some 8-bit character sets. */
for
(
i
=
128
;
i
<
256
;
i
++
)
newmap
[
i
].
function
=
rl_insert
;
#endif
/* KEYMAP_SIZE > 128 */
...
...
cmd-line-utils/readline/kill.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -77,7 +79,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int));
of kill material. */
int
rl_set_retained_kills
(
num
)
int
num
__attribute__
((
unused
))
;
int
num
;
{
return
0
;
}
...
...
@@ -294,7 +296,7 @@ rl_backward_kill_line (direction, ignore)
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
rl_begin_undo_group
();
rl_point
=
0
;
...
...
@@ -312,7 +314,7 @@ rl_kill_full_line (count, ignore)
using behaviour that they expect. */
int
rl_unix_word_rubout
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
int
orig_point
;
...
...
@@ -337,6 +339,47 @@ rl_unix_word_rubout (count, key)
if
(
rl_editing_mode
==
emacs_mode
)
rl_mark
=
rl_point
;
}
return
0
;
}
/* This deletes one filename component in a Unix pathname. That is, it
deletes backward to directory separator (`/') or whitespace. */
int
rl_unix_filename_rubout
(
count
,
key
)
int
count
,
key
;
{
int
orig_point
,
c
;
if
(
rl_point
==
0
)
rl_ding
();
else
{
orig_point
=
rl_point
;
if
(
count
<=
0
)
count
=
1
;
while
(
count
--
)
{
c
=
rl_line_buffer
[
rl_point
-
1
];
while
(
rl_point
&&
(
whitespace
(
c
)
||
c
==
'/'
))
{
rl_point
--
;
c
=
rl_line_buffer
[
rl_point
-
1
];
}
while
(
rl_point
&&
(
whitespace
(
c
)
==
0
)
&&
c
!=
'/'
)
{
rl_point
--
;
c
=
rl_line_buffer
[
rl_point
-
1
];
}
}
rl_kill_text
(
orig_point
,
rl_point
);
if
(
rl_editing_mode
==
emacs_mode
)
rl_mark
=
rl_point
;
}
return
0
;
}
...
...
@@ -348,7 +391,7 @@ rl_unix_word_rubout (count, key)
doing. */
int
rl_unix_line_discard
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_point
==
0
)
rl_ding
();
...
...
@@ -385,7 +428,7 @@ region_kill_internal (delete)
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
return
(
region_kill_internal
(
0
));
}
...
...
@@ -393,7 +436,7 @@ rl_copy_region_to_kill (count, ignore)
/* Kill the text between the point and mark. */
int
rl_kill_region
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
int
r
,
npoint
;
...
...
@@ -458,7 +501,7 @@ rl_copy_backward_word (count, key)
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
if
(
rl_kill_ring
==
0
)
{
...
...
@@ -477,7 +520,7 @@ rl_yank (count, ignore)
yank back some other text. */
int
rl_yank_pop
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
int
l
,
n
;
...
...
cmd-line-utils/readline/macro.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -190,7 +192,7 @@ _rl_kill_kbd_macro ()
re-executing the existing macro. */
int
rl_start_kbd_macro
(
ignore1
,
ignore2
)
int
ignore1
__attribute__
((
unused
)),
ignore2
__attribute__
((
unused
))
;
int
ignore1
,
ignore2
;
{
if
(
RL_ISSTATE
(
RL_STATE_MACRODEF
))
{
...
...
@@ -215,7 +217,7 @@ rl_start_kbd_macro (ignore1, ignore2)
that many times, counting the definition as the first time. */
int
rl_end_kbd_macro
(
count
,
ignore
)
int
count
,
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
if
(
RL_ISSTATE
(
RL_STATE_MACRODEF
)
==
0
)
{
...
...
@@ -235,7 +237,7 @@ rl_end_kbd_macro (count, ignore)
COUNT says how many times to execute it. */
int
rl_call_last_kbd_macro
(
count
,
ignore
)
int
count
,
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
if
(
current_macro
==
0
)
_rl_abort_internal
();
...
...
cmd-line-utils/readline/mbutil.c
View file @
7cf58d1f
/* mbutil.c -- readline multibyte character utility functions */
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001
-2004
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.
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
...
...
@@ -90,12 +92,12 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
/* if this is true, means that seed was not pointed character
started byte. So correct the point and consume count */
if
(
seed
<
point
)
count
--
;
count
--
;
while
(
count
>
0
)
{
tmp
=
mbrtowc
(
&
wc
,
string
+
point
,
strlen
(
string
+
point
),
&
ps
);
if
(
(
size_t
)(
tmp
)
==
(
size_t
)
-
1
||
(
size_t
)(
tmp
)
==
(
size_t
)
-
2
)
if
(
MB_INVALIDCH
((
size_t
)
tmp
)
)
{
/* invalid bytes. asume a byte represents a character */
point
++
;
...
...
@@ -103,9 +105,8 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
/* reset states. */
memset
(
&
ps
,
0
,
sizeof
(
mbstate_t
));
}
else
if
(
tmp
==
(
size_t
)
0
)
/* found '\0' char */
break
;
else
if
(
MB_NULLWCH
(
tmp
))
break
;
/* found wide '\0' */
else
{
/* valid bytes */
...
...
@@ -158,7 +159,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero)
while
(
point
<
seed
)
{
tmp
=
mbrtowc
(
&
wc
,
string
+
point
,
length
-
point
,
&
ps
);
if
(
(
size_t
)(
tmp
)
==
(
size_t
)
-
1
||
(
size_t
)(
tmp
)
==
(
size_t
)
-
2
)
if
(
MB_INVALIDCH
((
size_t
)
tmp
)
)
{
/* in this case, bytes are invalid or shorted to compose
multibyte char, so assume that the first byte represents
...
...
@@ -167,8 +168,12 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero)
/* clear the state of the byte sequence, because
in this case effect of mbstate is undefined */
memset
(
&
ps
,
0
,
sizeof
(
mbstate_t
));
/* Since we're assuming that this byte represents a single
non-zero-width character, don't forget about it. */
prev
=
point
;
}
else
if
(
tmp
==
0
)
else
if
(
MB_NULLWCH
(
tmp
)
)
break
;
/* Found '\0' char. Can this happen? */
else
{
...
...
@@ -194,7 +199,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero)
if it couldn't parse a complete multibyte character. */
int
_rl_get_char_len
(
src
,
ps
)
c
onst
c
har
*
src
;
char
*
src
;
mbstate_t
*
ps
;
{
size_t
tmp
;
...
...
@@ -203,14 +208,16 @@ _rl_get_char_len (src, ps)
if
(
tmp
==
(
size_t
)(
-
2
))
{
/* shorted to compose multibyte char */
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
if
(
ps
)
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
return
-
2
;
}
else
if
(
tmp
==
(
size_t
)(
-
1
))
{
/* invalid to compose multibyte char */
/* initialize the conversion state */
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
if
(
ps
)
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
return
-
1
;
}
else
if
(
tmp
==
(
size_t
)
0
)
...
...
@@ -223,9 +230,12 @@ _rl_get_char_len (src, ps)
return 1. Otherwise return 0. */
int
_rl_compare_chars
(
buf1
,
pos1
,
ps1
,
buf2
,
pos2
,
ps2
)
char
*
buf1
,
*
buf2
;
mbstate_t
*
ps1
,
*
ps2
;
int
pos1
,
pos2
;
char
*
buf1
;
int
pos1
;
mbstate_t
*
ps1
;
char
*
buf2
;
int
pos2
;
mbstate_t
*
ps2
;
{
int
i
,
w1
,
w2
;
...
...
@@ -249,7 +259,7 @@ _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
it returns -1 */
int
_rl_adjust_point
(
string
,
point
,
ps
)
c
onst
c
har
*
string
;
char
*
string
;
int
point
;
mbstate_t
*
ps
;
{
...
...
@@ -266,7 +276,7 @@ _rl_adjust_point(string, point, ps)
while
(
pos
<
point
)
{
tmp
=
mbrlen
(
string
+
pos
,
length
-
pos
,
ps
);
if
((
size_t
)(
tmp
)
==
(
size_t
)
-
1
||
(
size_t
)(
tmp
)
==
(
size_t
)
-
2
)
if
(
MB_INVALIDCH
((
size_t
)
tmp
)
)
{
/* in this case, bytes are invalid or shorted to compose
multibyte char, so assume that the first byte represents
...
...
@@ -274,8 +284,11 @@ _rl_adjust_point(string, point, ps)
pos
++
;
/* clear the state of the byte sequence, because
in this case effect of mbstate is undefined */
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
if
(
ps
)
memset
(
ps
,
0
,
sizeof
(
mbstate_t
));
}
else
if
(
MB_NULLWCH
(
tmp
))
pos
++
;
else
pos
+=
tmp
;
}
...
...
@@ -308,8 +321,8 @@ _rl_is_mbchar_matched (string, seed, end, mbchar, length)
#undef _rl_find_next_mbchar
int
_rl_find_next_mbchar
(
string
,
seed
,
count
,
flags
)
char
*
string
__attribute__
((
unused
))
;
int
seed
,
count
,
flags
__attribute__
((
unused
))
;
char
*
string
;
int
seed
,
count
,
flags
;
{
#if defined (HANDLE_MULTIBYTE)
return
_rl_find_next_mbchar_internal
(
string
,
seed
,
count
,
flags
);
...
...
@@ -324,8 +337,8 @@ _rl_find_next_mbchar (string, seed, count, flags)
#undef _rl_find_prev_mbchar
int
_rl_find_prev_mbchar
(
string
,
seed
,
flags
)
char
*
string
__attribute__
((
unused
))
;
int
seed
,
flags
__attribute__
((
unused
))
;
char
*
string
;
int
seed
,
flags
;
{
#if defined (HANDLE_MULTIBYTE)
return
_rl_find_prev_mbchar_internal
(
string
,
seed
,
flags
);
...
...
cmd-line-utils/readline/misc.c
View file @
7cf58d1f
/* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-200
2
Free Software Foundation, Inc.
/* Copyright (C) 1987-200
4
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.
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
...
...
@@ -155,7 +157,7 @@ rl_digit_loop ()
/* Add the current digit to the argument in progress. */
int
rl_digit_argument
(
ignore
,
key
)
int
ignore
__attribute__
((
unused
))
,
key
;
int
ignore
,
key
;
{
rl_execute_next
(
key
);
return
(
rl_digit_loop
());
...
...
@@ -185,7 +187,7 @@ _rl_init_argument ()
dispatch on it. If the key is the abort character then abort. */
int
rl_universal_argument
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_numeric_arg
*=
4
;
return
(
rl_digit_loop
());
...
...
@@ -251,6 +253,8 @@ rl_maybe_unsave_line ()
{
if
(
_rl_saved_line_for_history
)
{
/* Can't call with `1' because rl_undo_list might point to an undo
list from a history entry, as in rl_replace_from_history() below. */
rl_replace_line
(
_rl_saved_line_for_history
->
line
,
0
);
rl_undo_list
=
(
UNDO_LIST
*
)
_rl_saved_line_for_history
->
data
;
_rl_free_history_entry
(
_rl_saved_line_for_history
);
...
...
@@ -272,6 +276,13 @@ rl_maybe_save_line ()
_rl_saved_line_for_history
->
line
=
savestring
(
rl_line_buffer
);
_rl_saved_line_for_history
->
data
=
(
char
*
)
rl_undo_list
;
}
else
if
(
STREQ
(
rl_line_buffer
,
_rl_saved_line_for_history
->
line
)
==
0
)
{
free
(
_rl_saved_line_for_history
->
line
);
_rl_saved_line_for_history
->
line
=
savestring
(
rl_line_buffer
);
_rl_saved_line_for_history
->
data
=
(
char
*
)
rl_undo_list
;
/* XXX possible memleak */
}
return
0
;
}
...
...
@@ -296,7 +307,7 @@ _rl_history_set_point ()
rl_point
=
rl_end
;
#if defined (VI_MODE)
if
(
rl_editing_mode
==
vi_mode
)
if
(
rl_editing_mode
==
vi_mode
&&
_rl_keymap
!=
vi_insertion_keymap
)
rl_point
=
0
;
#endif
/* VI_MODE */
...
...
@@ -307,8 +318,10 @@ _rl_history_set_point ()
void
rl_replace_from_history
(
entry
,
flags
)
HIST_ENTRY
*
entry
;
int
flags
__attribute__
((
unused
))
;
/* currently unused */
int
flags
;
/* currently unused */
{
/* Can't call with `1' because rl_undo_list might point to an undo list
from a history entry, just like we're setting up here. */
rl_replace_line
(
entry
->
line
,
0
);
rl_undo_list
=
(
UNDO_LIST
*
)
entry
->
data
;
rl_point
=
rl_end
;
...
...
@@ -332,7 +345,7 @@ rl_replace_from_history (entry, flags)
/* Meta-< goes to the start of the history. */
int
rl_beginning_of_history
(
count
,
key
)
int
count
__attribute__
((
unused
))
,
key
;
int
count
,
key
;
{
return
(
rl_get_previous_history
(
1
+
where_history
(),
key
));
}
...
...
@@ -340,7 +353,7 @@ rl_beginning_of_history (count, key)
/* Meta-> goes to the end of the history. (The current line). */
int
rl_end_of_history
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_maybe_replace_line
();
using_history
();
...
...
@@ -433,6 +446,7 @@ rl_get_previous_history (count, key)
rl_replace_from_history
(
temp
,
0
);
_rl_history_set_point
();
}
return
0
;
}
...
...
@@ -444,7 +458,7 @@ rl_get_previous_history (count, key)
/* How to toggle back and forth between editing modes. */
int
rl_vi_editing_mode
(
count
,
key
)
int
count
__attribute__
((
unused
))
,
key
;
int
count
,
key
;
{
#if defined (VI_MODE)
_rl_set_insert_mode
(
RL_IM_INSERT
,
1
);
/* vi mode ignores insert mode */
...
...
@@ -457,7 +471,7 @@ rl_vi_editing_mode (count, key)
int
rl_emacs_editing_mode
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_editing_mode
=
emacs_mode
;
_rl_set_insert_mode
(
RL_IM_INSERT
,
1
);
/* emacs mode default is insert mode */
...
...
@@ -468,7 +482,7 @@ rl_emacs_editing_mode (count, key)
/* Function for the rest of the library to use to set insert/overwrite mode. */
void
_rl_set_insert_mode
(
im
,
force
)
int
im
,
force
__attribute__
((
unused
))
;
int
im
,
force
;
{
#ifdef CURSOR_MODE
_rl_set_cursor
(
im
,
force
);
...
...
@@ -481,7 +495,7 @@ _rl_set_insert_mode (im, force)
mode. A negative or zero explicit argument selects insert mode. */
int
rl_overwrite_mode
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_explicit_arg
==
0
)
_rl_set_insert_mode
(
rl_insert_mode
^
1
,
0
);
...
...
cmd-line-utils/readline/nls.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -73,6 +75,23 @@ static char *normalize_codeset PARAMS((char *));
static
char
*
find_codeset
PARAMS
((
char
*
,
size_t
*
));
#endif
/* !HAVE_SETLOCALE */
static
char
*
_rl_get_locale_var
PARAMS
((
const
char
*
));
static
char
*
_rl_get_locale_var
(
v
)
const
char
*
v
;
{
char
*
lspec
;
lspec
=
sh_get_env_value
(
"LC_ALL"
);
if
(
lspec
==
0
||
*
lspec
==
0
)
lspec
=
sh_get_env_value
(
v
);
if
(
lspec
==
0
||
*
lspec
==
0
)
lspec
=
sh_get_env_value
(
"LANG"
);
return
lspec
;
}
/* 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
1 if we set eight-bit mode. */
...
...
@@ -82,10 +101,21 @@ _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
;
char
*
lspec
,
*
t
;
/* Set the LC_CTYPE locale category from environment variables. */
t
=
setlocale
(
LC_CTYPE
,
""
);
lspec
=
_rl_get_locale_var
(
"LC_CTYPE"
);
/* Since _rl_get_locale_var queries the right environment variables,
we query the current locale settings with setlocale(), and, if
that doesn't return anything, we set lspec to the empty string to
force the subsequent call to setlocale() to define the `native'
environment. */
if
(
lspec
==
0
||
*
lspec
==
0
)
lspec
=
setlocale
(
LC_CTYPE
,
(
char
*
)
NULL
);
if
(
lspec
==
0
)
lspec
=
""
;
t
=
setlocale
(
LC_CTYPE
,
lspec
);
if
(
t
&&
*
t
&&
(
t
[
0
]
!=
'C'
||
t
[
1
])
&&
(
STREQ
(
t
,
"POSIX"
)
==
0
))
{
_rl_meta_flag
=
1
;
...
...
@@ -103,9 +133,8 @@ _rl_init_eightbit ()
/* 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
=
sh_get_env_value
(
"LC_ALL"
);
if
(
lspec
==
0
)
lspec
=
sh_get_env_value
(
"LC_CTYPE"
);
if
(
lspec
==
0
)
lspec
=
sh_get_env_value
(
"LANG"
);
lspec
=
_rl_get_locale_var
(
"LC_CTYPE"
);
if
(
lspec
==
0
||
(
t
=
normalize_codeset
(
lspec
))
==
0
)
return
(
0
);
for
(
i
=
0
;
t
&&
legal_lang_values
[
i
];
i
++
)
...
...
cmd-line-utils/readline/parens.c
View file @
7cf58d1f
...
...
@@ -21,9 +21,15 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (__TANDEM)
# include <floss.h>
#endif
#include "rlconf.h"
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
...
...
cmd-line-utils/readline/posixdir.h
View file @
7cf58d1f
...
...
@@ -25,7 +25,11 @@
#if defined (HAVE_DIRENT_H)
# include <dirent.h>
# define D_NAMLEN(d) (strlen ((d)->d_name))
# if defined (HAVE_STRUCT_DIRENT_D_NAMLEN)
# define D_NAMLEN(d) ((d)->d_namlen)
# else
# define D_NAMLEN(d) (strlen ((d)->d_name))
# endif
/* !HAVE_STRUCT_DIRENT_D_NAMLEN */
#else
# if defined (HAVE_SYS_NDIR_H)
# include <sys/ndir.h>
...
...
@@ -42,11 +46,11 @@
# define D_NAMLEN(d) ((d)->d_namlen)
#endif
/* !HAVE_DIRENT_H */
#if defined (
STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS
_D_FILENO)
#if defined (
HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT
_D_FILENO)
# define d_fileno d_ino
#endif
#if defined (_POSIX_SOURCE) && (!defined (
STRUCT_DIRENT_HAS
_D_INO) || defined (BROKEN_DIRENT_D_INO))
#if defined (_POSIX_SOURCE) && (!defined (
HAVE_STRUCT_DIRENT
_D_INO) || defined (BROKEN_DIRENT_D_INO))
/* Posix does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
...
...
cmd-line-utils/readline/readline.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include "posixstat.h"
...
...
@@ -66,11 +68,11 @@
#include "xmalloc.h"
#ifndef RL_LIBRARY_VERSION
# define RL_LIBRARY_VERSION "
4.3
"
# define RL_LIBRARY_VERSION "
5.0
"
#endif
#ifndef RL_READLINE_VERSION
# define RL_READLINE_VERSION 0x0
403
# define RL_READLINE_VERSION 0x0
500
#endif
extern
void
_rl_free_history_entry
PARAMS
((
HIST_ENTRY
*
));
...
...
@@ -83,6 +85,7 @@ static void bind_arrow_keys_internal PARAMS((Keymap));
static
void
bind_arrow_keys
PARAMS
((
void
));
static
void
readline_default_bindings
PARAMS
((
void
));
static
void
reset_default_bindings
PARAMS
((
void
));
/* **************************************************************** */
/* */
...
...
@@ -345,7 +348,7 @@ readline_internal_setup ()
#if defined (VI_MODE)
if
(
rl_editing_mode
==
vi_mode
)
rl_vi_insertion_mode
(
1
,
0
);
rl_vi_insertion_mode
(
1
,
'i'
);
#endif
/* VI_MODE */
if
(
rl_pre_input_hook
)
...
...
@@ -648,7 +651,21 @@ _rl_dispatch_subseq (key, map, got_subseq)
the function. The recursive call to _rl_dispatch_subseq has
already taken care of pushing any necessary input back onto
the input queue with _rl_unget_char. */
r
=
_rl_dispatch
(
ANYOTHERKEY
,
FUNCTION_TO_KEYMAP
(
map
,
key
));
{
#if 0
r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key));
#else
/* XXX - experimental code -- might never be executed. Save
for later. */
Keymap
m
=
FUNCTION_TO_KEYMAP
(
map
,
key
);
int
type
=
m
[
ANYOTHERKEY
].
type
;
func
=
m
[
ANYOTHERKEY
].
function
;
if
(
type
==
ISFUNC
&&
func
==
rl_do_lowercase_version
)
r
=
_rl_dispatch
(
_rl_to_lower
(
key
),
map
);
else
r
=
_rl_dispatch
(
ANYOTHERKEY
,
m
);
#endif
}
else
if
(
r
&&
map
[
ANYOTHERKEY
].
function
)
{
/* We didn't match (r is probably -1), so return something to
...
...
@@ -682,6 +699,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
}
#if defined (VI_MODE)
if
(
rl_editing_mode
==
vi_mode
&&
_rl_keymap
==
vi_movement_keymap
&&
key
!=
ANYOTHERKEY
&&
_rl_vi_textmod_command
(
key
))
_rl_vi_set_last
(
key
,
rl_numeric_arg
,
rl_arg_sign
);
#endif
...
...
@@ -836,7 +854,7 @@ readline_initialize_everything ()
/* If the completion parser's default word break characters haven't
been set yet, then do so now. */
if
(
rl_completer_word_break_characters
==
(
char
*
)
NULL
)
rl_completer_word_break_characters
=
rl_basic_word_break_characters
;
rl_completer_word_break_characters
=
(
char
*
)
rl_basic_word_break_characters
;
}
/* If this system allows us to look at the values of the regular
...
...
@@ -848,6 +866,15 @@ readline_default_bindings ()
rl_tty_set_default_bindings
(
_rl_keymap
);
}
/* Reset the default bindings for the terminal special characters we're
interested in back to rl_insert and read the new ones. */
static
void
reset_default_bindings
()
{
rl_tty_unset_default_bindings
(
_rl_keymap
);
rl_tty_set_default_bindings
(
_rl_keymap
);
}
/* Bind some common arrow key sequences in MAP. */
static
void
bind_arrow_keys_internal
(
map
)
...
...
@@ -859,25 +886,25 @@ bind_arrow_keys_internal (map)
_rl_keymap
=
map
;
#if defined (__MSDOS__)
_rl_bind
_if_unbound
(
"
\033
[0A"
,
rl_get_previous_history
);
_rl_bind
_if_unbound
(
"
\033
[0B"
,
rl_backward_char
);
_rl_bind
_if_unbound
(
"
\033
[0C"
,
rl_forward_char
);
_rl_bind
_if_unbound
(
"
\033
[0D"
,
rl_get_next_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
[0A"
,
rl_get_previous_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
[0B"
,
rl_backward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
[0C"
,
rl_forward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
[0D"
,
rl_get_next_history
);
#endif
_rl_bind
_if_unbound
(
"
\033
[A"
,
rl_get_previous_history
);
_rl_bind
_if_unbound
(
"
\033
[B"
,
rl_get_next_history
);
_rl_bind
_if_unbound
(
"
\033
[C"
,
rl_forward_char
);
_rl_bind
_if_unbound
(
"
\033
[D"
,
rl_backward_char
);
_rl_bind
_if_unbound
(
"
\033
[H"
,
rl_beg_of_line
);
_rl_bind
_if_unbound
(
"
\033
[F"
,
rl_end_of_line
);
_rl_bind
_if_unbound
(
"
\033
OA"
,
rl_get_previous_history
);
_rl_bind
_if_unbound
(
"
\033
OB"
,
rl_get_next_history
);
_rl_bind
_if_unbound
(
"
\033
OC"
,
rl_forward_char
);
_rl_bind
_if_unbound
(
"
\033
OD"
,
rl_backward_char
);
_rl_bind
_if_unbound
(
"
\033
OH"
,
rl_beg_of_line
);
_rl_bind
_if_unbound
(
"
\033
OF"
,
rl_end_of_line
);
rl_bind_keyseq
_if_unbound
(
"
\033
[A"
,
rl_get_previous_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
[B"
,
rl_get_next_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
[C"
,
rl_forward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
[D"
,
rl_backward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
[H"
,
rl_beg_of_line
);
rl_bind_keyseq
_if_unbound
(
"
\033
[F"
,
rl_end_of_line
);
rl_bind_keyseq
_if_unbound
(
"
\033
OA"
,
rl_get_previous_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
OB"
,
rl_get_next_history
);
rl_bind_keyseq
_if_unbound
(
"
\033
OC"
,
rl_forward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
OD"
,
rl_backward_char
);
rl_bind_keyseq
_if_unbound
(
"
\033
OH"
,
rl_beg_of_line
);
rl_bind_keyseq
_if_unbound
(
"
\033
OF"
,
rl_end_of_line
);
_rl_keymap
=
xkeymap
;
}
...
...
cmd-line-utils/readline/readline.h
View file @
7cf58d1f
/* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987
, 1989, 1992
Free Software Foundation, Inc.
/* Copyright (C) 1987
-2004
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.
...
...
@@ -40,9 +40,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0
403
/* Readline 4.3
*/
#define RL_VERSION_MAJOR
4
#define RL_VERSION_MINOR
3
#define RL_READLINE_VERSION 0x0
500
/* Readline 5.0
*/
#define RL_VERSION_MAJOR
5
#define RL_VERSION_MINOR
0
/* Readline data structures. */
...
...
@@ -160,6 +160,7 @@ extern int rl_kill_line PARAMS((int, int));
extern
int
rl_backward_kill_line
PARAMS
((
int
,
int
));
extern
int
rl_kill_full_line
PARAMS
((
int
,
int
));
extern
int
rl_unix_word_rubout
PARAMS
((
int
,
int
));
extern
int
rl_unix_filename_rubout
PARAMS
((
int
,
int
));
extern
int
rl_unix_line_discard
PARAMS
((
int
,
int
));
extern
int
rl_copy_region_to_kill
PARAMS
((
int
,
int
));
extern
int
rl_kill_region
PARAMS
((
int
,
int
));
...
...
@@ -258,6 +259,8 @@ extern int rl_vi_check PARAMS((void));
extern
int
rl_vi_domove
PARAMS
((
int
,
int
*
));
extern
int
rl_vi_bracktype
PARAMS
((
int
));
extern
void
rl_vi_start_inserting
PARAMS
((
int
,
int
,
int
));
/* VI-mode pseudo-bindable commands, used as utility functions. */
extern
int
rl_vi_fWord
PARAMS
((
int
,
int
));
extern
int
rl_vi_bWord
PARAMS
((
int
,
int
));
...
...
@@ -290,12 +293,20 @@ extern int rl_bind_key PARAMS((int, rl_command_func_t *));
extern
int
rl_bind_key_in_map
PARAMS
((
int
,
rl_command_func_t
*
,
Keymap
));
extern
int
rl_unbind_key
PARAMS
((
int
));
extern
int
rl_unbind_key_in_map
PARAMS
((
int
,
Keymap
));
extern
int
rl_bind_key_if_unbound
PARAMS
((
int
,
rl_command_func_t
*
));
extern
int
rl_bind_key_if_unbound_in_map
PARAMS
((
int
,
rl_command_func_t
*
,
Keymap
));
extern
int
rl_unbind_function_in_map
PARAMS
((
rl_command_func_t
*
,
Keymap
));
extern
int
rl_unbind_command_in_map
PARAMS
((
const
char
*
,
Keymap
));
extern
int
rl_set_key
PARAMS
((
const
char
*
,
rl_command_func_t
*
,
Keymap
));
extern
int
rl_bind_keyseq
PARAMS
((
const
char
*
,
rl_command_func_t
*
));
extern
int
rl_bind_keyseq_in_map
PARAMS
((
const
char
*
,
rl_command_func_t
*
,
Keymap
));
extern
int
rl_bind_keyseq_if_unbound
PARAMS
((
const
char
*
,
rl_command_func_t
*
));
extern
int
rl_bind_keyseq_if_unbound_in_map
PARAMS
((
const
char
*
,
rl_command_func_t
*
,
Keymap
));
extern
int
rl_generic_bind
PARAMS
((
int
,
const
char
*
,
char
*
,
Keymap
));
extern
int
rl_variable_bind
PARAMS
((
const
char
*
,
const
char
*
));
/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
extern
int
rl_set_key
PARAMS
((
const
char
*
,
rl_command_func_t
*
,
Keymap
));
/* Backwards compatibility, use rl_generic_bind instead. */
extern
int
rl_macro_bind
PARAMS
((
const
char
*
,
const
char
*
,
Keymap
));
...
...
@@ -329,7 +340,7 @@ extern void rl_set_keymap PARAMS((Keymap));
extern
Keymap
rl_get_keymap
PARAMS
((
void
));
/* Undocumented; used internally only. */
extern
void
rl_set_keymap_from_edit_mode
PARAMS
((
void
));
extern
c
onst
c
har
*
rl_get_keymap_name_from_edit_mode
PARAMS
((
void
));
extern
char
*
rl_get_keymap_name_from_edit_mode
PARAMS
((
void
));
/* Functions for manipulating the funmap, which maps command names to functions. */
extern
int
rl_add_funmap_entry
PARAMS
((
const
char
*
,
rl_command_func_t
*
));
...
...
@@ -358,7 +369,7 @@ extern int rl_clear_message PARAMS((void));
extern
int
rl_reset_line_state
PARAMS
((
void
));
extern
int
rl_crlf
PARAMS
((
void
));
#if
(defined (__STDC__) || defined (__cplusplus)) &&
defined (USE_VARARGS) && defined (PREFER_STDARG)
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern
int
rl_message
(
const
char
*
,
...)
__attribute__
((
__format__
(
printf
,
1
,
2
)));
#else
extern
int
rl_message
();
...
...
@@ -384,13 +395,14 @@ extern char *rl_copy_text PARAMS((int, int));
extern
void
rl_prep_terminal
PARAMS
((
int
));
extern
void
rl_deprep_terminal
PARAMS
((
void
));
extern
void
rl_tty_set_default_bindings
PARAMS
((
Keymap
));
extern
void
rl_tty_unset_default_bindings
PARAMS
((
Keymap
));
extern
int
rl_reset_terminal
PARAMS
((
const
char
*
));
extern
void
rl_resize_terminal
PARAMS
((
void
));
extern
void
rl_set_screen_size
PARAMS
((
int
,
int
));
extern
void
rl_get_screen_size
PARAMS
((
int
*
,
int
*
));
extern
c
onst
c
har
*
rl_get_termcap
PARAMS
((
const
char
*
));
extern
char
*
rl_get_termcap
PARAMS
((
const
char
*
));
/* Functions for character input. */
extern
int
rl_stuff_char
PARAMS
((
int
));
...
...
@@ -603,7 +615,12 @@ extern const char *rl_basic_word_break_characters;
/* The list of characters that signal a break between words for
rl_complete_internal. The default list is the contents of
rl_basic_word_break_characters. */
extern
const
char
*
rl_completer_word_break_characters
;
extern
/*const*/
char
*
rl_completer_word_break_characters
;
/* Hook function to allow an application to set the completion word
break characters before readline breaks up the line. Allows
position-dependent word break characters. */
extern
rl_cpvfunc_t
*
rl_completion_word_break_hook
;
/* List of characters which can be used to quote a substring of the line.
Completion occurs on the entire substring, and within the substring
...
...
@@ -687,6 +704,11 @@ extern int rl_attempted_completion_over;
functions. */
extern
int
rl_completion_type
;
/* 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
;
/* Character appended to completed words when at the end of the line. The
default is a space. Nothing is added if this is '\0'. */
extern
int
rl_completion_append_character
;
...
...
@@ -695,10 +717,18 @@ extern int rl_completion_append_character;
rl_completion_append_character will not be appended. */
extern
int
rl_completion_suppress_append
;
/* 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
;
/* Set to any quote character readline thinks it finds before any application
completion function is called. */
extern
int
rl_completion_quote_character
;
/* Set to a non-zero value if readline found quoting anywhere in the word to
be completed; set before any application completion function is called. */
extern
int
rl_completion_found_quote
;
/* If non-zero, the completion functions don't append any closing quote.
This is set to 0 by rl_complete_internal and may be changed by an
application-specific completion function. */
extern
int
rl_completion_suppress_quote
;
/* If non-zero, a slash will be appended to completed filenames that are
symbolic links to directory names, subject to the value of the
...
...
@@ -749,6 +779,7 @@ extern int rl_inhibit_completion;
#define RL_STATE_SIGHANDLER 0x08000
/* in readline sighandler */
#define RL_STATE_UNDOING 0x10000
/* doing an undo */
#define RL_STATE_INPUTPENDING 0x20000
/* rl_execute_next called */
#define RL_STATE_TTYCSAVED 0x40000
/* tty special chars saved */
#define RL_STATE_DONE 0x80000
/* done; accepted line */
...
...
@@ -785,6 +816,12 @@ struct readline_state {
int
catchsigs
;
int
catchsigwinch
;
/* search state */
/* completion state */
/* options state */
/* reserved for future expansion, so the struct size doesn't change */
char
reserved
[
64
];
};
...
...
cmd-line-utils/readline/rldefs.h
View file @
7cf58d1f
...
...
@@ -32,10 +32,6 @@
#include "rlstdc.h"
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ <8)
#define __attribute__(A)
#endif
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
# define TERMIOS_TTY_DRIVER
#else
...
...
@@ -81,7 +77,7 @@ extern int _rl_stricmp PARAMS((char *, char *));
extern
int
_rl_strnicmp
PARAMS
((
char
*
,
char
*
,
int
));
#endif
#if defined (HAVE_STRPBRK)
#if defined (HAVE_STRPBRK)
&& !defined (HAVE_MULTIBYTE)
# define _rl_strpbrk(a,b) strpbrk((a),(b))
#else
extern
char
*
_rl_strpbrk
PARAMS
((
const
char
*
,
const
char
*
));
...
...
cmd-line-utils/readline/rlmbutil.h
View file @
7cf58d1f
...
...
@@ -35,11 +35,18 @@
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
# if defined (HAVE_MBSRTOWCS)
/* system is supposed to support XPG5 */
# if defined (HAVE_MBSRTOWCS) && defined (HAVE_MBRTOWC) && defined (HAVE_MBRLEN) && defined (HAVE_WCWIDTH)
/* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
/* If we don't want multibyte chars even on a system that supports them, let
the configuring user turn multibyte support off. */
#if defined (NO_MULTIBYTE_SUPPORT)
# undef HANDLE_MULTIBYTE
#endif
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T)
# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0)
...
...
@@ -82,14 +89,17 @@ extern int _rl_find_next_mbchar PARAMS((char *, int, int, int));
#ifdef HANDLE_MULTIBYTE
extern
int
_rl_compare_chars
PARAMS
((
char
*
,
int
,
mbstate_t
*
,
char
*
,
int
,
mbstate_t
*
));
extern
int
_rl_get_char_len
PARAMS
((
c
onst
c
har
*
,
mbstate_t
*
));
extern
int
_rl_adjust_point
PARAMS
((
c
onst
c
har
*
,
int
,
mbstate_t
*
));
extern
int
_rl_get_char_len
PARAMS
((
char
*
,
mbstate_t
*
));
extern
int
_rl_adjust_point
PARAMS
((
char
*
,
int
,
mbstate_t
*
));
extern
int
_rl_read_mbchar
PARAMS
((
char
*
,
int
));
extern
int
_rl_read_mbstring
PARAMS
((
int
,
char
*
,
int
));
extern
int
_rl_is_mbchar_matched
PARAMS
((
char
*
,
int
,
int
,
char
*
,
int
));
#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
#define MB_NULLWCH(x) ((x) == 0)
#else
/* !HANDLE_MULTIBYTE */
#undef MB_LEN_MAX
...
...
@@ -101,6 +111,9 @@ extern int _rl_is_mbchar_matched PARAMS((char *, int, int, char *, int));
#define _rl_find_prev_mbchar(b, i, f) (((i) == 0) ? (i) : ((i) - 1))
#define _rl_find_next_mbchar(b, i1, i2, f) ((i1) + (i2))
#define MB_INVALIDCH(x) (0)
#define MB_NULLWCH(x) (0)
#endif
/* !HANDLE_MULTIBYTE */
extern
int
rl_byte_oriented
;
...
...
cmd-line-utils/readline/rlprivate.h
View file @
7cf58d1f
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999 Free Software Foundation, Inc.
/* Copyright (C) 1999
-2004
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.
...
...
@@ -73,7 +73,7 @@ extern int rl_set_retained_kills PARAMS((int));
extern
void
_rl_set_screen_size
PARAMS
((
int
,
int
));
/* undo.c */
extern
int
_rl_fix_last_undo_of_type
PARAMS
((
unsigned
int
,
int
,
int
));
extern
int
_rl_fix_last_undo_of_type
PARAMS
((
int
,
int
,
int
));
/* util.c */
extern
char
*
_rl_savestring
PARAMS
((
const
char
*
));
...
...
@@ -103,7 +103,6 @@ extern int readline_internal_char PARAMS((void));
#endif
/* READLINE_CALLBACKS */
/* bind.c */
extern
void
_rl_bind_if_unbound
PARAMS
((
const
char
*
,
rl_command_func_t
*
));
/* complete.c */
extern
char
_rl_find_completion_word
PARAMS
((
int
*
,
int
*
));
...
...
@@ -131,6 +130,7 @@ extern int _rl_input_available PARAMS((void));
extern
int
_rl_input_queued
PARAMS
((
int
));
extern
void
_rl_insert_typein
PARAMS
((
int
));
extern
int
_rl_unget_char
PARAMS
((
int
));
extern
int
_rl_pushed_input_available
PARAMS
((
void
));
/* macro.c */
extern
void
_rl_with_macro_input
PARAMS
((
char
*
));
...
...
@@ -219,6 +219,7 @@ extern const char *_rl_possible_meta_prefixes[];
/* complete.c */
extern
int
_rl_complete_show_all
;
extern
int
_rl_complete_show_unmodified
;
extern
int
_rl_complete_mark_directories
;
extern
int
_rl_complete_mark_symlink_dirs
;
extern
int
_rl_print_completions_horizontally
;
...
...
@@ -230,7 +231,7 @@ extern int _rl_page_completions;
extern
int
_rl_vis_botlin
;
extern
int
_rl_last_c_pos
;
extern
int
_rl_suppress_redisplay
;
extern
c
onst
c
har
*
rl_display_prompt
;
extern
char
*
rl_display_prompt
;
/* isearch.c */
extern
char
*
_rl_isearch_terminators
;
...
...
@@ -261,16 +262,16 @@ extern procenv_t readline_top_level;
/* terminal.c */
extern
int
_rl_enable_keypad
;
extern
int
_rl_enable_meta
;
extern
c
onst
c
har
*
_rl_term_clreol
;
extern
c
onst
c
har
*
_rl_term_clrpag
;
extern
c
onst
c
har
*
_rl_term_im
;
extern
c
onst
c
har
*
_rl_term_ic
;
extern
c
onst
c
har
*
_rl_term_ei
;
extern
c
onst
c
har
*
_rl_term_DC
;
extern
c
onst
c
har
*
_rl_term_up
;
extern
c
onst
c
har
*
_rl_term_dc
;
extern
c
onst
c
har
*
_rl_term_cr
;
extern
c
onst
c
har
*
_rl_term_IC
;
extern
char
*
_rl_term_clreol
;
extern
char
*
_rl_term_clrpag
;
extern
char
*
_rl_term_im
;
extern
char
*
_rl_term_ic
;
extern
char
*
_rl_term_ei
;
extern
char
*
_rl_term_DC
;
extern
char
*
_rl_term_up
;
extern
char
*
_rl_term_dc
;
extern
char
*
_rl_term_cr
;
extern
char
*
_rl_term_IC
;
extern
int
_rl_screenheight
;
extern
int
_rl_screenwidth
;
extern
int
_rl_screenchars
;
...
...
@@ -281,4 +282,7 @@ extern int _rl_term_autowrap;
extern
int
_rl_doing_an_undo
;
extern
int
_rl_undo_group_level
;
/* vi_mode.c */
extern
int
_rl_vi_last_command
;
#endif
/* _RL_PRIVATE_H_ */
cmd-line-utils/readline/rlstdc.h
View file @
7cf58d1f
...
...
@@ -37,7 +37,7 @@
#endif
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
|| __STRICT_ANSI__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x)
# endif
#endif
...
...
cmd-line-utils/readline/rltty.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <signal.h>
...
...
@@ -184,6 +186,8 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
static
void
prepare_terminal_settings
PARAMS
((
int
,
TIOTYPE
,
TIOTYPE
*
));
static
void
set_special_char
PARAMS
((
Keymap
,
TIOTYPE
*
,
int
,
rl_command_func_t
));
static
void
save_tty_chars
(
tiop
)
TIOTYPE
*
tiop
;
...
...
@@ -398,6 +402,9 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
static
void
prepare_terminal_settings
PARAMS
((
int
,
TIOTYPE
,
TIOTYPE
*
));
static
void
set_special_char
PARAMS
((
Keymap
,
TIOTYPE
*
,
int
,
rl_command_func_t
));
static
void
_rl_bind_tty_special_chars
PARAMS
((
Keymap
,
TIOTYPE
));
#if defined (FLUSHO)
# define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO)
#else
...
...
@@ -650,7 +657,10 @@ rl_prep_terminal (meta_flag)
otio
=
tio
;
rl_tty_unset_default_bindings
(
_rl_keymap
);
save_tty_chars
(
&
otio
);
RL_SETSTATE
(
RL_STATE_TTYCSAVED
);
_rl_bind_tty_special_chars
(
_rl_keymap
,
tio
);
prepare_terminal_settings
(
meta_flag
,
otio
,
&
tio
);
...
...
@@ -709,7 +719,7 @@ rl_deprep_terminal ()
int
rl_restart_output
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
int
fildes
=
fileno
(
rl_outstream
);
#if defined (TIOCSTART)
...
...
@@ -742,7 +752,7 @@ rl_restart_output (count, key)
int
rl_stop_output
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
int
fildes
=
fileno
(
rl_instream
);
...
...
@@ -774,70 +784,97 @@ rl_stop_output (count, key)
/* */
/* **************************************************************** */
/* Set the system's default editing characters to their readline equivalents
in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */
void
rltty_set_default_bindings
(
kmap
)
Keymap
kmap
;
{
TIOTYPE
ttybuff
;
int
tty
=
fileno
(
rl_instream
);
#define SET_SPECIAL(sc, func) set_special_char(kmap, &ttybuff, sc, func)
#if defined (NEW_TTY_DRIVER)
static
void
set_special_char
(
kmap
,
tiop
,
sc
,
func
)
Keymap
kmap
;
TIOTYPE
*
tiop
;
int
sc
;
rl_command_func_t
*
func
;
{
if
(
sc
!=
-
1
&&
kmap
[(
unsigned
char
)
sc
].
type
==
ISFUNC
)
kmap
[(
unsigned
char
)
sc
].
function
=
func
;
}
#define SET_SPECIAL(sc, func) \
do \
{ \
int ic; \
ic = sc; \
if (ic != -1 && kmap[(unsigned char)ic].type == ISFUNC) \
kmap[(unsigned char)ic].function = func; \
} \
while (0)
#define RESET_SPECIAL(c) \
if (c != -1 && kmap[(unsigned char)c].type == ISFUNC)
kmap
[(
unsigned
char
)
c
].
function
=
rl_insert
;
if
(
get_tty_settings
(
tty
,
&
ttybuff
)
==
0
)
static
void
_rl_bind_tty_special_chars
(
kmap
,
ttybuff
)
Keymap
kmap
;
TIOTYPE
ttybuff
;
{
if
(
ttybuff
.
flags
&
SGTTY_SET
)
{
if
(
ttybuff
.
flags
&
SGTTY_SET
)
{
SET_SPECIAL
(
ttybuff
.
sgttyb
.
sg_erase
,
rl_rubout
);
SET_SPECIAL
(
ttybuff
.
sgttyb
.
sg_kill
,
rl_unix_line_discard
);
}
SET_SPECIAL
(
ttybuff
.
sgttyb
.
sg_erase
,
rl_rubout
);
SET_SPECIAL
(
ttybuff
.
sgttyb
.
sg_kill
,
rl_unix_line_discard
);
}
# if defined (TIOCGLTC)
if
(
ttybuff
.
flags
&
LTCHARS_SET
)
{
SET_SPECIAL
(
ttybuff
.
ltchars
.
t_werasc
,
rl_unix_word_rubout
);
SET_SPECIAL
(
ttybuff
.
ltchars
.
t_lnextc
,
rl_quoted_insert
);
}
# endif
/* TIOCGLTC */
if
(
ttybuff
.
flags
&
LTCHARS_SET
)
{
SET_SPECIAL
(
ttybuff
.
ltchars
.
t_werasc
,
rl_unix_word_rubout
);
SET_SPECIAL
(
ttybuff
.
ltchars
.
t_lnextc
,
rl_quoted_insert
);
}
# endif
/* TIOCGLTC */
}
#else
/* !NEW_TTY_DRIVER */
static
void
set_special_char
(
kmap
,
tiop
,
sc
,
func
)
Keymap
kmap
;
TIOTYPE
*
tiop
;
int
sc
;
rl_command_func_t
*
func
;
{
unsigned
char
uc
;
#define SET_SPECIAL(sc, func) \
do \
{ \
unsigned char uc; \
uc = ttybuff.c_cc[sc]; \
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \
kmap[uc].function = func; \
} \
while (0)
uc
=
tiop
->
c_cc
[
sc
];
if
(
uc
!=
(
unsigned
char
)
_POSIX_VDISABLE
&&
kmap
[
uc
].
type
==
ISFUNC
)
kmap
[
uc
].
function
=
func
;
}
if
(
get_tty_settings
(
tty
,
&
ttybuff
)
==
0
)
{
SET_SPECIAL
(
VERASE
,
rl_rubout
);
SET_SPECIAL
(
VKILL
,
rl_unix_line_discard
);
/* used later */
#define RESET_SPECIAL(uc) \
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \
kmap[uc].function = rl_insert;
static
void
_rl_bind_tty_special_chars
(
kmap
,
ttybuff
)
Keymap
kmap
;
TIOTYPE
ttybuff
;
{
SET_SPECIAL
(
VERASE
,
rl_rubout
);
SET_SPECIAL
(
VKILL
,
rl_unix_line_discard
);
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
SET_SPECIAL
(
VLNEXT
,
rl_quoted_insert
);
SET_SPECIAL
(
VLNEXT
,
rl_quoted_insert
);
# endif
/* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
SET_SPECIAL
(
VWERASE
,
rl_unix_word_rubout
);
SET_SPECIAL
(
VWERASE
,
rl_unix_word_rubout
);
# endif
/* VWERASE && TERMIOS_TTY_DRIVER */
}
}
#endif
/* !NEW_TTY_DRIVER */
/* Set the system's default editing characters to their readline equivalents
in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */
void
rltty_set_default_bindings
(
kmap
)
Keymap
kmap
;
{
TIOTYPE
ttybuff
;
int
tty
;
static
int
called
=
0
;
tty
=
fileno
(
rl_instream
);
if
(
get_tty_settings
(
tty
,
&
ttybuff
)
==
0
)
_rl_bind_tty_special_chars
(
kmap
,
ttybuff
);
}
/* New public way to set the system default editing chars to their readline
...
...
@@ -849,6 +886,30 @@ rl_tty_set_default_bindings (kmap)
rltty_set_default_bindings
(
kmap
);
}
/* Rebind all of the tty special chars that readline worries about back
to self-insert. Call this before saving the current terminal special
chars with save_tty_chars(). This only works on POSIX termios or termio
systems. */
void
rl_tty_unset_default_bindings
(
kmap
)
Keymap
kmap
;
{
/* Don't bother before we've saved the tty special chars at least once. */
if
(
RL_ISSTATE
(
RL_STATE_TTYCSAVED
)
==
0
)
return
;
RESET_SPECIAL
(
_rl_tty_chars
.
t_erase
);
RESET_SPECIAL
(
_rl_tty_chars
.
t_kill
);
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
RESET_SPECIAL
(
_rl_tty_chars
.
t_lnext
);
# endif
/* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
RESET_SPECIAL
(
_rl_tty_chars
.
t_werase
);
# endif
/* VWERASE && TERMIOS_TTY_DRIVER */
}
#if defined (HANDLE_SIGNALS)
#if defined (NEW_TTY_DRIVER)
...
...
cmd-line-utils/readline/rltty.h
View file @
7cf58d1f
...
...
@@ -61,22 +61,22 @@
#endif
/* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
typedef
struct
_rl_tty_chars
{
char
t_eof
;
char
t_eol
;
char
t_eol2
;
char
t_erase
;
char
t_werase
;
char
t_kill
;
char
t_reprint
;
char
t_intr
;
char
t_quit
;
char
t_susp
;
char
t_dsusp
;
char
t_start
;
char
t_stop
;
char
t_lnext
;
char
t_flush
;
char
t_status
;
unsigned
char
t_eof
;
unsigned
char
t_eol
;
unsigned
char
t_eol2
;
unsigned
char
t_erase
;
unsigned
char
t_werase
;
unsigned
char
t_kill
;
unsigned
char
t_reprint
;
unsigned
char
t_intr
;
unsigned
char
t_quit
;
unsigned
char
t_susp
;
unsigned
char
t_dsusp
;
unsigned
char
t_start
;
unsigned
char
t_stop
;
unsigned
char
t_lnext
;
unsigned
char
t_flush
;
unsigned
char
t_status
;
}
_RL_TTY_CHARS
;
#endif
/* _RLTTY_H_ */
cmd-line-utils/readline/rltypedefs.h
View file @
7cf58d1f
/* rltypedefs.h -- Type declarations for readline functions. */
/* Copyright (C) 2000 Free Software Foundation, Inc.
/* Copyright (C) 2000
-2004
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.
...
...
@@ -79,6 +79,12 @@ typedef void rl_voidfunc_t PARAMS((void));
typedef
void
rl_vintfunc_t
PARAMS
((
int
));
typedef
void
rl_vcpfunc_t
PARAMS
((
char
*
));
typedef
void
rl_vcppfunc_t
PARAMS
((
char
**
));
typedef
char
*
rl_cpvfunc_t
PARAMS
((
void
));
typedef
char
*
rl_cpifunc_t
PARAMS
((
int
));
typedef
char
*
rl_cpcpfunc_t
PARAMS
((
char
*
));
typedef
char
*
rl_cpcppfunc_t
PARAMS
((
char
**
));
#endif
/* _RL_FUNCTION_TYPEDEF */
#ifdef __cplusplus
...
...
cmd-line-utils/readline/savestring.c
0 → 100644
View file @
7cf58d1f
/* savestring.c */
/* Copyright (C) 1998,2003 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 2, 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,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include <config.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include "xmalloc.h"
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
char
*
savestring
(
s
)
const
char
*
s
;
{
return
((
char
*
)
strcpy
((
char
*
)
xmalloc
(
1
+
strlen
(
s
)),
(
s
)));
}
cmd-line-utils/readline/search.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <stdio.h>
...
...
@@ -80,8 +82,13 @@ static void
make_history_line_current
(
entry
)
HIST_ENTRY
*
entry
;
{
rl_replace_line
(
entry
->
line
,
0
);
#if 0
rl_replace_line (entry->line, 1);
rl_undo_list = (UNDO_LIST *)entry->data;
#else
_rl_replace_text
(
entry
->
line
,
0
,
rl_end
);
_rl_fix_point
(
1
);
#endif
if
(
_rl_saved_line_for_history
)
_rl_free_history_entry
(
_rl_saved_line_for_history
);
...
...
@@ -187,6 +194,11 @@ noninc_search (dir, pchar)
saved_point
=
rl_point
;
saved_mark
=
rl_mark
;
/* Clear the undo list, since reading the search string should create its
own undo list, and the whole list will end up being freed when we
finish reading the search string. */
rl_undo_list
=
0
;
/* Use the line buffer to read the search string. */
rl_line_buffer
[
0
]
=
0
;
rl_end
=
rl_point
=
0
;
...
...
@@ -294,7 +306,7 @@ noninc_search (dir, pchar)
code calls this, KEY will be `?'. */
int
rl_noninc_forward_search
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
noninc_search
(
1
,
(
key
==
'?'
)
?
'?'
:
0
);
return
0
;
...
...
@@ -304,7 +316,7 @@ rl_noninc_forward_search (count, key)
calls this, KEY will be `/'. */
int
rl_noninc_reverse_search
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
noninc_search
(
-
1
,
(
key
==
'/'
)
?
'/'
:
0
);
return
0
;
...
...
@@ -314,7 +326,7 @@ rl_noninc_reverse_search (count, key)
for. If there is no saved search string, abort. */
int
rl_noninc_forward_search_again
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
!
noninc_search_string
)
{
...
...
@@ -329,7 +341,7 @@ rl_noninc_forward_search_again (count, key)
for. If there is no saved search string, abort. */
int
rl_noninc_reverse_search_again
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
!
noninc_search_string
)
{
...
...
cmd-line-utils/readline/shell.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -124,6 +126,7 @@ sh_set_lines_and_columns (lines, cols)
b
=
(
char
*
)
xmalloc
(
INT_STRLEN_BOUND
(
int
)
+
sizeof
(
"LINES="
)
+
1
);
sprintf
(
b
,
"LINES=%d"
,
lines
);
putenv
(
b
);
b
=
(
char
*
)
xmalloc
(
INT_STRLEN_BOUND
(
int
)
+
sizeof
(
"COLUMNS="
)
+
1
);
sprintf
(
b
,
"COLUMNS=%d"
,
cols
);
putenv
(
b
);
...
...
@@ -132,9 +135,12 @@ sh_set_lines_and_columns (lines, cols)
b
=
(
char
*
)
xmalloc
(
INT_STRLEN_BOUND
(
int
)
+
1
);
sprintf
(
b
,
"%d"
,
lines
);
setenv
(
"LINES"
,
b
,
1
);
free
(
b
);
b
=
(
char
*
)
xmalloc
(
INT_STRLEN_BOUND
(
int
)
+
1
);
sprintf
(
b
,
"%d"
,
cols
);
setenv
(
"COLUMNS"
,
b
,
1
);
free
(
b
);
# endif
/* HAVE_SETENV */
#endif
/* !HAVE_PUTENV */
}
...
...
cmd-line-utils/readline/signals.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
/* Just for NULL. Yuck. */
#include <sys/types.h>
...
...
@@ -71,6 +73,10 @@ typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt
# define sigemptyset(m)
#endif
/* !HAVE_POSIX_SIGNALS */
#ifndef SA_RESTART
# define SA_RESTART 0
#endif
static
SigHandler
*
rl_set_sighandler
PARAMS
((
int
,
SigHandler
*
,
sighandler_cxt
*
));
static
void
rl_maybe_set_sighandler
PARAMS
((
int
,
SigHandler
*
,
sighandler_cxt
*
));
...
...
@@ -83,6 +89,8 @@ int rl_catch_signals = 1;
/* If non-zero, readline will install a signal handler for SIGWINCH. */
#ifdef SIGWINCH
int
rl_catch_sigwinch
=
1
;
#else
int
rl_catch_sigwinch
=
0
;
/* for the readline state struct in readline.c */
#endif
static
int
signals_set_flag
;
...
...
@@ -231,7 +239,7 @@ rl_set_sighandler (sig, handler, ohandler)
struct
sigaction
act
;
act
.
sa_handler
=
handler
;
act
.
sa_flags
=
0
;
/* XXX - should we set SA_RESTART for SIGWINCH? */
act
.
sa_flags
=
(
sig
==
SIGWINCH
)
?
SA_RESTART
:
0
;
sigemptyset
(
&
act
.
sa_mask
);
sigemptyset
(
&
ohandler
->
sa_mask
);
sigaction
(
sig
,
&
act
,
&
old_handler
);
...
...
cmd-line-utils/readline/terminal.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include "posixstat.h"
...
...
@@ -82,41 +84,40 @@ static int tcap_initialized;
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif
/* __EMX__ || NEED_EXTERN_PC */
char
PC
;
char
*
BC
,
*
UP
;
char
PC
,
*
BC
,
*
UP
;
#endif
/* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
c
onst
c
har
*
_rl_term_clreol
;
c
onst
c
har
*
_rl_term_clrpag
;
c
onst
c
har
*
_rl_term_cr
;
c
onst
c
har
*
_rl_term_backspace
;
c
onst
c
har
*
_rl_term_goto
;
c
onst
c
har
*
_rl_term_pc
;
char
*
_rl_term_clreol
;
char
*
_rl_term_clrpag
;
char
*
_rl_term_cr
;
char
*
_rl_term_backspace
;
char
*
_rl_term_goto
;
char
*
_rl_term_pc
;
/* Non-zero if we determine that the terminal can do character insertion. */
int
_rl_terminal_can_insert
=
0
;
/* How to insert characters. */
c
onst
c
har
*
_rl_term_im
;
c
onst
c
har
*
_rl_term_ei
;
c
onst
c
har
*
_rl_term_ic
;
c
onst
c
har
*
_rl_term_ip
;
c
onst
c
har
*
_rl_term_IC
;
char
*
_rl_term_im
;
char
*
_rl_term_ei
;
char
*
_rl_term_ic
;
char
*
_rl_term_ip
;
char
*
_rl_term_IC
;
/* How to delete characters. */
c
onst
c
har
*
_rl_term_dc
;
c
onst
c
har
*
_rl_term_DC
;
char
*
_rl_term_dc
;
char
*
_rl_term_DC
;
#if defined (HACK_TERMCAP_MOTION)
char
*
_rl_term_forward_char
;
#endif
/* HACK_TERMCAP_MOTION */
/* How to go up a line. */
c
onst
c
har
*
_rl_term_up
;
char
*
_rl_term_up
;
/* A visible bell; char if the terminal can be made to flash the screen. */
static
c
onst
c
har
*
_rl_visible_bell
;
static
char
*
_rl_visible_bell
;
/* Non-zero means the terminal can auto-wrap lines. */
int
_rl_term_autowrap
;
...
...
@@ -126,30 +127,30 @@ static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static
c
onst
c
har
*
_rl_term_mm
;
static
c
onst
c
har
*
_rl_term_mo
;
static
char
*
_rl_term_mm
;
static
char
*
_rl_term_mo
;
/* The key sequences output by the arrow keys, if this terminal has any. */
static
c
onst
c
har
*
_rl_term_ku
;
static
c
onst
c
har
*
_rl_term_kd
;
static
c
onst
c
har
*
_rl_term_kr
;
static
c
onst
c
har
*
_rl_term_kl
;
static
char
*
_rl_term_ku
;
static
char
*
_rl_term_kd
;
static
char
*
_rl_term_kr
;
static
char
*
_rl_term_kl
;
/* How to initialize and reset the arrow keys, if this terminal has any. */
static
c
onst
c
har
*
_rl_term_ks
;
static
c
onst
c
har
*
_rl_term_ke
;
static
char
*
_rl_term_ks
;
static
char
*
_rl_term_ke
;
/* The key sequences sent by the Home and End keys, if any. */
static
c
onst
c
har
*
_rl_term_kh
;
static
c
onst
c
har
*
_rl_term_kH
;
static
c
onst
c
har
*
_rl_term_at7
;
/* @7 */
static
char
*
_rl_term_kh
;
static
char
*
_rl_term_kH
;
static
char
*
_rl_term_at7
;
/* @7 */
/* Insert key */
static
c
onst
c
har
*
_rl_term_kI
;
static
char
*
_rl_term_kI
;
/* Cursor control */
static
c
onst
c
har
*
_rl_term_vs
;
/* very visible */
static
c
onst
c
har
*
_rl_term_ve
;
/* normal */
static
char
*
_rl_term_vs
;
/* very visible */
static
char
*
_rl_term_ve
;
/* normal */
static
void
bind_termcap_arrow_keys
PARAMS
((
Keymap
));
...
...
@@ -295,7 +296,7 @@ rl_resize_terminal ()
struct
_tc_string
{
const
char
*
tc_var
;
c
onst
c
har
**
tc_value
;
char
**
tc_value
;
};
/* This should be kept sorted, just in case we decide to change the
...
...
@@ -343,14 +344,10 @@ get_term_capabilities (bp)
char
**
bp
;
{
#if !defined (__DJGPP__)
/* XXX - doesn't DJGPP have a termcap library? */
register
unsigned
int
i
;
register
int
i
;
for
(
i
=
0
;
i
<
NUM_TC_STRINGS
;
i
++
)
# if defined(__LCC__) || defined(__MWERKS__)
*
(
tc_strings
[
i
].
tc_value
)
=
tgetstr
((
char
*
)
tc_strings
[
i
].
tc_var
,
bp
);
# else
*
(
tc_strings
[
i
].
tc_value
)
=
tgetstr
(
tc_strings
[
i
].
tc_var
,
bp
);
# endif
#endif
tcap_initialized
=
1
;
}
...
...
@@ -432,8 +429,8 @@ _rl_init_terminal_io (terminal_name)
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC
=
'\0'
;
BC
=
(
char
*
)(
_rl_term_backspace
=
"
\b
"
)
;
UP
=
(
char
*
)
_rl_term_up
;
BC
=
_rl_term_backspace
=
"
\b
"
;
UP
=
_rl_term_up
;
return
0
;
}
...
...
@@ -443,8 +440,8 @@ _rl_init_terminal_io (terminal_name)
/* Set up the variables that the termcap library expects the application
to provide. */
PC
=
_rl_term_pc
?
*
_rl_term_pc
:
0
;
BC
=
(
char
*
)
_rl_term_backspace
;
UP
=
(
char
*
)
_rl_term_up
;
BC
=
_rl_term_backspace
;
UP
=
_rl_term_up
;
if
(
!
_rl_term_cr
)
_rl_term_cr
=
"
\r
"
;
...
...
@@ -488,22 +485,22 @@ bind_termcap_arrow_keys (map)
xkeymap
=
_rl_keymap
;
_rl_keymap
=
map
;
_rl_bind
_if_unbound
(
_rl_term_ku
,
rl_get_previous_history
);
_rl_bind
_if_unbound
(
_rl_term_kd
,
rl_get_next_history
);
_rl_bind_if_unbound
(
_rl_term_kr
,
rl_forward
);
_rl_bind_if_unbound
(
_rl_term_kl
,
rl_backward
);
rl_bind_keyseq
_if_unbound
(
_rl_term_ku
,
rl_get_previous_history
);
rl_bind_keyseq
_if_unbound
(
_rl_term_kd
,
rl_get_next_history
);
rl_bind_keyseq_if_unbound
(
_rl_term_kr
,
rl_forward_char
);
rl_bind_keyseq_if_unbound
(
_rl_term_kl
,
rl_backward_char
);
_rl_bind
_if_unbound
(
_rl_term_kh
,
rl_beg_of_line
);
/* Home */
_rl_bind
_if_unbound
(
_rl_term_at7
,
rl_end_of_line
);
/* End */
rl_bind_keyseq
_if_unbound
(
_rl_term_kh
,
rl_beg_of_line
);
/* Home */
rl_bind_keyseq
_if_unbound
(
_rl_term_at7
,
rl_end_of_line
);
/* End */
_rl_keymap
=
xkeymap
;
}
c
onst
c
har
*
char
*
rl_get_termcap
(
cap
)
const
char
*
cap
;
{
register
unsigned
int
i
;
register
int
i
;
if
(
tcap_initialized
==
0
)
return
((
char
*
)
NULL
);
...
...
cmd-line-utils/readline/text.c
View file @
7cf58d1f
/* text.c -- text handling commands for readline. */
/* Copyright (C) 1987-200
2
Free Software Foundation, Inc.
/* Copyright (C) 1987-200
4
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.
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
...
...
@@ -168,6 +170,9 @@ _rl_fix_point (fix_mark_too)
}
#undef _RL_FIX_POINT
/* Replace the contents of the line buffer between START and END with
TEXT. The operation is undoable. To replace the entire line in an
undoable mode, use _rl_replace_text(text, 0, rl_end); */
int
_rl_replace_text
(
text
,
start
,
end
)
const
char
*
text
;
...
...
@@ -400,7 +405,7 @@ rl_backward (count, key)
/* Move to the beginning of the line. */
int
rl_beg_of_line
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_point
=
0
;
return
0
;
...
...
@@ -409,7 +414,7 @@ rl_beg_of_line (count, key)
/* Move to the end of the line. */
int
rl_end_of_line
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_point
=
rl_end
;
return
0
;
...
...
@@ -506,7 +511,7 @@ rl_backward_word (count, key)
/* Clear the current line. Numeric argument to C-l does this. */
int
rl_refresh_line
(
ignore1
,
ignore2
)
int
ignore1
__attribute__
((
unused
)),
ignore2
__attribute__
((
unused
))
;
int
ignore1
,
ignore2
;
{
int
curr_line
;
...
...
@@ -545,7 +550,7 @@ rl_clear_screen (count, key)
int
rl_arrow_keys
(
count
,
c
)
int
count
,
c
__attribute__
((
unused
))
;
int
count
,
c
;
{
int
ch
;
...
...
@@ -799,13 +804,10 @@ _rl_overwrite_char (count, c)
k
=
_rl_read_mbstring
(
c
,
mbkey
,
MB_LEN_MAX
);
#endif
rl_begin_undo_group
();
for
(
i
=
0
;
i
<
count
;
i
++
)
{
rl_begin_undo_group
();
if
(
rl_point
<
rl_end
)
rl_delete
(
1
,
c
);
#if defined (HANDLE_MULTIBYTE)
if
(
MB_CUR_MAX
>
1
&&
rl_byte_oriented
==
0
)
rl_insert_text
(
mbkey
);
...
...
@@ -813,9 +815,12 @@ _rl_overwrite_char (count, c)
#endif
_rl_insert_char
(
1
,
c
);
rl_end_undo_group
();
if
(
rl_point
<
rl_end
)
rl_delete
(
1
,
c
);
}
rl_end_undo_group
();
return
0
;
}
...
...
@@ -830,7 +835,7 @@ rl_insert (count, c)
/* Insert the next typed character verbatim. */
int
rl_quoted_insert
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
int
c
;
...
...
@@ -852,7 +857,7 @@ rl_quoted_insert (count, key)
/* Insert a tab character. */
int
rl_tab_insert
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
_rl_insert_char
(
count
,
'\t'
));
}
...
...
@@ -862,7 +867,7 @@ rl_tab_insert (count, key)
meaning in the future. */
int
rl_newline
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
rl_done
=
1
;
...
...
@@ -875,7 +880,8 @@ rl_newline (count, key)
if
(
rl_editing_mode
==
vi_mode
)
{
_rl_vi_done_inserting
();
_rl_vi_reset_last
();
if
(
_rl_vi_textmod_command
(
_rl_vi_last_command
)
==
0
)
/* XXX */
_rl_vi_reset_last
();
}
#endif
/* VI_MODE */
...
...
@@ -895,7 +901,7 @@ rl_newline (count, key)
is special cased. */
int
rl_do_lowercase_version
(
ignore1
,
ignore2
)
int
ignore1
__attribute__
((
unused
)),
ignore2
__attribute__
((
unused
))
;
int
ignore1
,
ignore2
;
{
return
0
;
}
...
...
@@ -933,9 +939,12 @@ _rl_overwrite_rubout (count, key)
rl_delete_text
(
opoint
,
rl_point
);
/* Emacs puts point at the beginning of the sequence of spaces. */
opoint
=
rl_point
;
_rl_insert_char
(
l
,
' '
);
rl_point
=
opoint
;
if
(
rl_point
<
rl_end
)
{
opoint
=
rl_point
;
_rl_insert_char
(
l
,
' '
);
rl_point
=
opoint
;
}
rl_end_undo_group
();
...
...
@@ -1087,7 +1096,7 @@ rl_rubout_or_delete (count, key)
/* Delete all spaces and tabs around point. */
int
rl_delete_horizontal_space
(
count
,
ignore
)
int
count
__attribute__
((
unused
)),
ignore
__attribute__
((
unused
))
;
int
count
,
ignore
;
{
int
start
=
rl_point
;
...
...
@@ -1128,9 +1137,9 @@ rl_delete_or_show_completions (count, key)
A K*rn shell style function. */
int
rl_insert_comment
(
count
,
key
)
int
count
__attribute__
((
unused
))
,
key
;
int
count
,
key
;
{
c
onst
c
har
*
rl_comment_text
;
char
*
rl_comment_text
;
int
rl_comment_len
;
rl_beg_of_line
(
1
,
key
);
...
...
@@ -1167,7 +1176,7 @@ rl_insert_comment (count, key)
/* Uppercase the word at point. */
int
rl_upcase_word
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
rl_change_case
(
count
,
UpCase
));
}
...
...
@@ -1175,7 +1184,7 @@ rl_upcase_word (count, key)
/* Lowercase the word at point. */
int
rl_downcase_word
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
rl_change_case
(
count
,
DownCase
));
}
...
...
@@ -1183,7 +1192,7 @@ rl_downcase_word (count, key)
/* Upcase the first letter, downcase the rest. */
int
rl_capitalize_word
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
rl_change_case
(
count
,
CapCase
));
}
...
...
@@ -1308,7 +1317,7 @@ rl_transpose_words (count, key)
then transpose the characters before point. */
int
rl_transpose_chars
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
#if defined (HANDLE_MULTIBYTE)
char
*
dummy
;
...
...
@@ -1480,14 +1489,14 @@ _rl_char_search (count, fdir, bdir)
int
rl_char_search
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
_rl_char_search
(
count
,
FFIND
,
BFIND
));
}
int
rl_backward_char_search
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
_rl_char_search
(
count
,
BFIND
,
FFIND
));
}
...
...
@@ -1513,7 +1522,7 @@ _rl_set_mark_at_pos (position)
/* A bindable command to set the mark. */
int
rl_set_mark
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
_rl_set_mark_at_pos
(
rl_explicit_arg
?
count
:
rl_point
));
}
...
...
@@ -1521,7 +1530,7 @@ rl_set_mark (count, key)
/* Exchange the position of mark and point. */
int
rl_exchange_point_and_mark
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
rl_mark
>
rl_end
)
rl_mark
=
-
1
;
...
...
cmd-line-utils/readline/tilde.c
View file @
7cf58d1f
...
...
@@ -19,7 +19,11 @@
along with Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config_readline.h"
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
...
...
@@ -188,7 +192,7 @@ tilde_expand (string)
int
result_size
,
result_index
;
result_index
=
result_size
=
0
;
if
(
(
result
=
strchr
(
string
,
'~'
)
))
if
(
result
=
strchr
(
string
,
'~'
))
result
=
(
char
*
)
xmalloc
(
result_size
=
(
strlen
(
string
)
+
16
));
else
result
=
(
char
*
)
xmalloc
(
result_size
=
(
strlen
(
string
)
+
1
));
...
...
cmd-line-utils/readline/undo.c
View file @
7cf58d1f
...
...
@@ -22,7 +22,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
...
...
@@ -169,8 +171,7 @@ rl_do_undo ()
int
_rl_fix_last_undo_of_type
(
type
,
start
,
end
)
unsigned
int
type
;
int
start
,
end
;
int
type
,
start
,
end
;
{
UNDO_LIST
*
rl
;
...
...
@@ -228,7 +229,7 @@ rl_modifying (start, end)
/* Revert the current line to its previous state. */
int
rl_revert_line
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
!
rl_undo_list
)
rl_ding
();
...
...
@@ -243,7 +244,7 @@ rl_revert_line (count, key)
/* Do some undoing of things that were done. */
int
rl_undo_command
(
count
,
key
)
int
count
,
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
if
(
count
<
0
)
return
0
;
/* Nothing to do. */
...
...
cmd-line-utils/readline/util.c
View file @
7cf58d1f
...
...
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
...
...
@@ -96,14 +98,14 @@ _rl_abort_internal ()
int
rl_abort
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
return
(
_rl_abort_internal
());
}
int
rl_tty_status
(
count
,
key
)
int
count
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
count
,
key
;
{
#if defined (TIOCSTAT)
ioctl
(
1
,
TIOCSTAT
,
(
char
*
)
0
);
...
...
@@ -153,7 +155,7 @@ rl_extend_line_buffer (len)
/* A function for simple tilde expansion. */
int
rl_tilde_expand
(
ignore
,
key
)
int
ignore
__attribute__
((
unused
)),
key
__attribute__
((
unused
))
;
int
ignore
,
key
;
{
register
int
start
,
end
;
char
*
homedir
,
*
temp
;
...
...
@@ -248,7 +250,7 @@ _rl_strpbrk (string1, string2)
{
v
=
_rl_get_char_len
(
string1
,
&
ps
);
if
(
v
>
1
)
string
+=
v
-
1
;
/* -1 to account for auto-increment in loop */
string
1
+=
v
-
1
;
/* -1 to account for auto-increment in loop */
}
#endif
}
...
...
cmd-line-utils/readline/vi_mode.c
View file @
7cf58d1f
This diff is collapsed.
Click to expand it.
cmd-line-utils/readline/xmalloc.c
View file @
7cf58d1f
...
...
@@ -20,7 +20,9 @@
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "config_readline.h"
#if defined (HAVE_CONFIG_H)
#include <config.h>
#endif
#include <stdio.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment