commit bash-20110325 snapshot

This commit is contained in:
Chet Ramey
2011-12-29 13:05:52 -05:00
parent 7df0c1b2df
commit c1854f2dd6
36 changed files with 13716 additions and 1532 deletions
+72 -1
View File
@@ -11299,7 +11299,7 @@ lib/glob/glob.c
- fix mbskipname to call skipname if either the pattern or the filename
can't be converted into a wide-char string
lib/glob/xmbstowcs.c
lib/glob/xmbsrtowcs.c
- fix xdupmbstowcs2 to handle return value of 0 from mbsnrtowcs and
short-circuit with failure in that case. Fixes bug reported by
Roman Rakus <rrakus@redhat.com>
@@ -11313,3 +11313,74 @@ bashline.c
- change bashline_reset and attempt_shell_completion to restore
rl_filename_quote_characters if not set to default
3/22
----
lib/glob/glob.c
- wdequote_pathname falls back to udequote_pathname if xdupmbstowcs
fails to convert the pathname to a wide-character string
lib/glob/xmbsrtowcs.c
- xdupmbstowcs2: change to fix problem with leading '\\' (results in
nms == 0, which causes it to short-circuit with failure right
away). Fixes bug pointed out by Werner Fink <werner@suse.de>
- xdupmbstowcs2: compensate for mbsnrtowcs returning 0 by taking the
next single-byte character and going on
- xdupmbstowcs2: change memory allocation to increase by WSBUF_INC
bytes; try to avoid calls to realloc (even if they don't actually
result in more memory being allocated)
3/24
----
doc/{bash.1,bashref.texi}
- slightly modify BASH_SUBSHELL description based on complaint from
Sam Liddicott <sam@liddicott.com>
3/25
----
trap.c
- change free_trap_strings to not call free_trap_string for signals
that are being ignored, like reset_or_restore_signal_handlers.
Fixes bug reported by Satoshi Takahashi <blue3waters@gmail.com>
3/26
----
lib/readline/rltypedefs.h
- remove old Function/VFunction/CPFunction/CPPFunction typedefs as
suggested by Tom Tromey <tromey@redhat.com>
lib/readline/rlstdc.h
- move defines for USE_VARARGS/PREFER_STDARG/PREFER_VARARGS from
config.h.in to here because declaration of rl_message in
readline.h uses the defines. This makes it hard for another packages
to use after the header files are installed, since config.h is not
one of the installed files. Suggested by Tom Tromey
<tromey@redhat.com>
3/27
----
print_cmd.c
- change indirection_string from a static buffer to a dynamic one
managed by indirection_level_string(), so we don't end up truncating
PS4. Suggested by Dennis Williamson <dennistwilliamson@gmail.com>
lib/readline/shell.c
- change sh_set_lines_and_columns to use static buffers instead of
allocating the buffers to pass to setenv/putenv
lib/readline/terminal.c
- change _rl_get_screen_size to not call sh_set_lines_and_columns if
ignore_env == 0
- _rl_sigwinch_resize_terminal: new function to just retrieve terminal
size, ignoring environment
lib/readline/rlprivate.h
- new external declaration for _rl_sigwinch_resize_terminal() (currently
unused)
lib/readline/signals.c
- rl_sigwinch_handler: set _rl_caught_signal to SIGWINCH
- rl_sigwinch_handler: don't immediately call rl_resize_terminal; just
leave _rl_caught_signal set for RL_CHECK_SIGNALS to handle
- _rl_signal_handler: call rl_resize_terminal if sig == SIGWINCH.
Should fix hang when sending multiple repeated SIGWINCH reported by
Henning Bekel <h.bekel@googlemail.com>
+95 -1
View File
@@ -11288,5 +11288,99 @@ doc/{bash.1,bashref.texi}
arrayfunc.[ch],subst.c
- array_expand_index now takes a new first argument: a SHELL_VAR *
of the variable being subscripted. Can be used later to fully
of the array variable being subscripted. Can be used later to fully
implement negative subscripts
3/14
----
lib/glob/glob.c
- fix mbskipname to not turn the directory entry name into a wide char
string if the conversion of the pattern to a wide char string fails
- fix mbskipname to call skipname if either the pattern or the filename
can't be converted into a wide-char string
lib/glob/xmbsrtowcs.c
- fix xdupmbstowcs2 to handle return value of 0 from mbsnrtowcs and
short-circuit with failure in that case. Fixes bug reported by
Roman Rakus <rrakus@redhat.com>
3/15
----
bashline.c
- new variable, bash_filename_quote_characters to store the value
assigned to rl_filename_quote_characters so it can be restored
if changed.
- change bashline_reset and attempt_shell_completion to restore
rl_filename_quote_characters if not set to default
3/22
----
lib/glob/glob.c
- wdequote_pathname falls back to udequote_pathname if xdupmbstowcs
fails to convert the pathname to a wide-character string
lib/glob/xmbsrtowcs.c
- xdupmbstowcs2: change to fix problem with leading '\\' (results in
nms == 0, which causes it to short-circuit with failure right
away). Fixes bug pointed out by Werner Fink <werner@suse.de>
- xdupmbstowcs2: compensate for mbsnrtowcs returning 0 by taking the
next single-byte character and going on
- xdupmbstowcs2: change memory allocation to increase by WSBUF_INC
bytes; try to avoid calls to realloc (even if they don't actually
result in more memory being allocated)
3/24
----
doc/{bash.1,bashref.texi}
- slightly modify BASH_SUBSHELL description based on complaint from
Sam Liddicott <sam@liddicott.com>
3/25
----
trap.c
- change free_trap_strings to not call free_trap_string for signals
that are being ignored, like reset_or_restore_signal_handlers.
Fixes bug reported by Satoshi Takahashi <blue3waters@gmail.com>
3/26
----
lib/readline/rltypedefs.h
- remove old Function/VFunction/CPFunction/CPPFunction typedefs as
suggested by Tom Tromey <tromey@redhat.com>
lib/readline/rlstdc.h
- move defines for USE_VARARGS/PREFER_STDARG/PREFER_VARARGS from
config.h.in to here because declaration of rl_message in
readline.h uses the defines. This makes it hard for another packages
to use after the header files are installed, since config.h is not
one of the installed files. Suggested by Tom Tromey
<tromey@redhat.com>
3/27
----
print_cmd.c
- change indirection_string from a static buffer to a dynamic one
managed by indirection_level_string(), so we don't end up truncating
PS4. Suggested by Dennis Williamson <dennistwilliamson@gmail.com>
lib/readline/shell.c
- change sh_set_lines_and_columns to use static buffers instead of
allocating the buffers to pass to setenv/putenv
lib/readline/terminal.c
- change _rl_get_screen_size to not call sh_set_lines_and_columns if
ignore_env == 0
- _rl_sigwinch_resize_terminal: new function to just retrieve terminal
size, ignoring environment
lib/readline/rlprivate.h
- new external declaration for _rl_sigwinch_resize_terminal() (currently
unused)
lib/readline/signals.c
- rl_sigwinch_handler: set _rl_caught_signal to SIGWINCH
- rl_sigwinch_handler: don't immediately call rl_resize_terminal; just
leave _rl_caught_signal set for RL_CHECK_SIGNALS to handle
- _rl_signal_handler: call rl_resize_terminal if sig == SIGWINCH.
Should fix hang when sending multiple repeat SIGWINCH reported by
Henning Bekel <h.bekel@googlemail.com>
+4
View File
@@ -484,6 +484,8 @@ po/ca.gmo f
po/ca.po f
po/cs.gmo f
po/cs.po f
po/da.gmo f
po/da.po f
po/de.gmo f
po/de.po f
po/eo.gmo f
@@ -518,6 +520,8 @@ po/ru.gmo f
po/ru.po f
po/sk.gmo f
po/sk.po f
po/sl.gmo f
po/sl.po f
po/sv.gmo f
po/sv.po f
po/tr.gmo f
+3 -2
View File
@@ -351,6 +351,7 @@ void
save_history ()
{
char *hf;
int r;
hf = get_string_value ("HISTFILE");
if (hf && *hf && file_exists (hf))
@@ -360,9 +361,9 @@ save_history ()
using_history ();
if (history_lines_this_session <= where_history () || force_append_history)
append_history (history_lines_this_session, hf);
r = append_history (history_lines_this_session, hf);
else
write_history (hf);
r = write_history (hf);
sv_histsize ("HISTFILESIZE");
}
}
+909
View File
@@ -0,0 +1,909 @@
/* bashhist.c -- bash interface to the GNU history library. */
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#if defined (HISTORY)
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include "bashtypes.h"
#include <stdio.h>
#include <errno.h>
#include "bashansi.h"
#include "posixstat.h"
#include "filecntl.h"
#include "bashintl.h"
#if defined (SYSLOG_HISTORY)
# include <syslog.h>
#endif
#include "shell.h"
#include "flags.h"
#include "input.h"
#include "parser.h" /* for the struct dstack stuff. */
#include "pathexp.h" /* for the struct ignorevar stuff */
#include "bashhist.h" /* matching prototypes and declarations */
#include "builtins/common.h"
#include <readline/history.h>
#include <glob/glob.h>
#include <glob/strmatch.h>
#if defined (READLINE)
# include "bashline.h"
extern int rl_done, rl_dispatching; /* should really include readline.h */
#endif
#if !defined (errno)
extern int errno;
#endif
static int histignore_item_func __P((struct ign *));
static int check_history_control __P((char *));
static void hc_erasedups __P((char *));
static void really_add_history __P((char *));
static struct ignorevar histignore =
{
"HISTIGNORE",
(struct ign *)0,
0,
(char *)0,
(sh_iv_item_func_t *)histignore_item_func,
};
#define HIGN_EXPAND 0x01
/* Declarations of bash history variables. */
/* Non-zero means to remember lines typed to the shell on the history
list. This is different than the user-controlled behaviour; this
becomes zero when we read lines from a file, for example. */
int remember_on_history = 1;
int enable_history_list = 1; /* value for `set -o history' */
/* The number of lines that Bash has added to this history session. The
difference between the number of the top element in the history list
(offset from history_base) and the number of lines in the history file.
Appending this session's history to the history file resets this to 0. */
int history_lines_this_session;
/* The number of lines that Bash has read from the history file. */
int history_lines_in_file;
#if defined (BANG_HISTORY)
/* Non-zero means do no history expansion on this line, regardless
of what history_expansion says. */
int history_expansion_inhibited;
#endif
/* With the old default, every line was saved in the history individually.
I.e., if the user enters:
bash$ for i in a b c
> do
> echo $i
> done
Each line will be individually saved in the history.
bash$ history
10 for i in a b c
11 do
12 echo $i
13 done
14 history
If the variable command_oriented_history is set, multiple lines
which form one command will be saved as one history entry.
bash$ for i in a b c
> do
> echo $i
> done
bash$ history
10 for i in a b c
do
echo $i
done
11 history
The user can then recall the whole command all at once instead
of just being able to recall one line at a time.
This is now enabled by default.
*/
int command_oriented_history = 1;
/* Set to 1 if the first line of a possibly-multi-line command was saved
in the history list. Managed by maybe_add_history(), but global so
the history-manipluating builtins can see it. */
int current_command_first_line_saved = 0;
/* Non-zero means to store newlines in the history list when using
command_oriented_history rather than trying to use semicolons. */
int literal_history;
/* Non-zero means to append the history to the history file at shell
exit, even if the history has been stifled. */
int force_append_history;
/* A nit for picking at history saving. Flags have the following values:
Value == 0 means save all lines parsed by the shell on the history.
Value & HC_IGNSPACE means save all lines that do not start with a space.
Value & HC_IGNDUPS means save all lines that do not match the last
line saved.
Value & HC_ERASEDUPS means to remove all other matching lines from the
history list before saving the latest line. */
int history_control;
/* Set to 1 if the last command was added to the history list successfully
as a separate history entry; set to 0 if the line was ignored or added
to a previous entry as part of command-oriented-history processing. */
int hist_last_line_added;
/* Set to 1 if builtins/history.def:push_history added the last history
entry. */
int hist_last_line_pushed;
#if defined (READLINE)
/* If non-zero, and readline is being used, the user is offered the
chance to re-edit a failed history expansion. */
int history_reediting;
/* If non-zero, and readline is being used, don't directly execute a
line with history substitution. Reload it into the editing buffer
instead and let the user further edit and confirm with a newline. */
int hist_verify;
#endif /* READLINE */
/* Non-zero means to not save function definitions in the history list. */
int dont_save_function_defs;
/* Variables declared in other files used here. */
extern int current_command_line_count;
extern struct dstack dstack;
extern int parser_state;
static int bash_history_inhibit_expansion __P((char *, int));
#if defined (READLINE)
static void re_edit __P((char *));
#endif
static int history_expansion_p __P((char *));
static int shell_comment __P((char *));
static int should_expand __P((char *));
static HIST_ENTRY *last_history_entry __P((void));
static char *expand_histignore_pattern __P((char *));
static int history_should_ignore __P((char *));
/* Is the history expansion starting at string[i] one that should not
be expanded? */
static int
bash_history_inhibit_expansion (string, i)
char *string;
int i;
{
/* The shell uses ! as a pattern negation character in globbing [...]
expressions, so let those pass without expansion. */
if (i > 0 && (string[i - 1] == '[') && member (']', string + i + 1))
return (1);
/* The shell uses ! as the indirect expansion character, so let those
expansions pass as well. */
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
member ('}', string + i + 1))
return (1);
/* The shell uses $! as a defined parameter expansion. */
else if (i > 1 && string[i - 1] == '$' && string[i] == '!')
return (1);
#if defined (EXTENDED_GLOB)
else if (extended_glob && i > 1 && string[i+1] == '(' && member (')', string + i + 2))
return (1);
#endif
else
return (0);
}
void
bash_initialize_history ()
{
history_quotes_inhibit_expansion = 1;
history_search_delimiter_chars = ";&()|<>";
history_inhibit_expansion_function = bash_history_inhibit_expansion;
#if defined (BANG_HISTORY)
sv_histchars ("histchars");
#endif
}
void
bash_history_reinit (interact)
int interact;
{
#if defined (BANG_HISTORY)
history_expansion = interact != 0;
history_expansion_inhibited = 1;
#endif
remember_on_history = enable_history_list = interact != 0;
history_inhibit_expansion_function = bash_history_inhibit_expansion;
}
void
bash_history_disable ()
{
remember_on_history = 0;
#if defined (BANG_HISTORY)
history_expansion_inhibited = 1;
#endif
}
void
bash_history_enable ()
{
remember_on_history = 1;
#if defined (BANG_HISTORY)
history_expansion_inhibited = 0;
#endif
history_inhibit_expansion_function = bash_history_inhibit_expansion;
sv_history_control ("HISTCONTROL");
sv_histignore ("HISTIGNORE");
}
/* Load the history list from the history file. */
void
load_history ()
{
char *hf;
/* Truncate history file for interactive shells which desire it.
Note that the history file is automatically truncated to the
size of HISTSIZE if the user does not explicitly set the size
differently. */
set_if_not ("HISTSIZE", "500");
sv_histsize ("HISTSIZE");
set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE"));
sv_histsize ("HISTFILESIZE");
/* Read the history in HISTFILE into the history list. */
hf = get_string_value ("HISTFILE");
if (hf && *hf && file_exists (hf))
{
read_history (hf);
using_history ();
history_lines_in_file = where_history ();
}
}
void
bash_clear_history ()
{
clear_history ();
history_lines_this_session = 0;
}
/* Delete and free the history list entry at offset I. */
int
bash_delete_histent (i)
int i;
{
HIST_ENTRY *discard;
discard = remove_history (i);
if (discard)
free_history_entry (discard);
history_lines_this_session--;
return 1;
}
int
bash_delete_last_history ()
{
register int i;
HIST_ENTRY **hlist, *histent;
int r;
hlist = history_list ();
if (hlist == NULL)
return 0;
for (i = 0; hlist[i]; i++)
;
i--;
/* History_get () takes a parameter that must be offset by history_base. */
histent = history_get (history_base + i); /* Don't free this */
if (histent == NULL)
return 0;
r = bash_delete_histent (i);
if (where_history () > history_length)
history_set_pos (history_length);
return r;
}
#ifdef INCLUDE_UNUSED
/* Write the existing history out to the history file. */
void
save_history ()
{
char *hf;
hf = get_string_value ("HISTFILE");
if (hf && *hf && file_exists (hf))
{
/* Append only the lines that occurred this session to
the history file. */
using_history ();
if (history_lines_this_session <= where_history () || force_append_history)
append_history (history_lines_this_session, hf);
else
write_history (hf);
sv_histsize ("HISTFILESIZE");
}
}
#endif
int
maybe_append_history (filename)
char *filename;
{
int fd, result;
struct stat buf;
result = EXECUTION_SUCCESS;
if (history_lines_this_session && (history_lines_this_session <= where_history ()))
{
/* If the filename was supplied, then create it if necessary. */
if (stat (filename, &buf) == -1 && errno == ENOENT)
{
fd = open (filename, O_WRONLY|O_CREAT, 0600);
if (fd < 0)
{
builtin_error (_("%s: cannot create: %s"), filename, strerror (errno));
return (EXECUTION_FAILURE);
}
close (fd);
}
result = append_history (history_lines_this_session, filename);
history_lines_in_file += history_lines_this_session;
history_lines_this_session = 0;
}
return (result);
}
/* If this is an interactive shell, then append the lines executed
this session to the history file. */
int
maybe_save_shell_history ()
{
int result;
char *hf;
result = 0;
if (history_lines_this_session)
{
hf = get_string_value ("HISTFILE");
if (hf && *hf)
{
/* If the file doesn't exist, then create it. */
if (file_exists (hf) == 0)
{
int file;
file = open (hf, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (file != -1)
close (file);
}
/* Now actually append the lines if the history hasn't been
stifled. If the history has been stifled, rewrite the
history file. */
using_history ();
if (history_lines_this_session <= where_history () || force_append_history)
{
result = append_history (history_lines_this_session, hf);
history_lines_in_file += history_lines_this_session;
}
else
{
result = write_history (hf);
history_lines_in_file = history_lines_this_session;
}
history_lines_this_session = 0;
sv_histsize ("HISTFILESIZE");
}
}
return (result);
}
#if defined (READLINE)
/* Tell readline () that we have some text for it to edit. */
static void
re_edit (text)
char *text;
{
if (bash_input.type == st_stdin)
bash_re_edit (text);
}
#endif /* READLINE */
/* Return 1 if this line needs history expansion. */
static int
history_expansion_p (line)
char *line;
{
register char *s;
for (s = line; *s; s++)
if (*s == history_expansion_char || *s == history_subst_char)
return 1;
return 0;
}
/* Do pre-processing on LINE. If PRINT_CHANGES is non-zero, then
print the results of expanding the line if there were any changes.
If there is an error, return NULL, otherwise the expanded line is
returned. If ADDIT is non-zero the line is added to the history
list after history expansion. ADDIT is just a suggestion;
REMEMBER_ON_HISTORY can veto, and does.
Right now this does history expansion. */
char *
pre_process_line (line, print_changes, addit)
char *line;
int print_changes, addit;
{
char *history_value;
char *return_value;
int expanded;
return_value = line;
expanded = 0;
# if defined (BANG_HISTORY)
/* History expand the line. If this results in no errors, then
add that line to the history if ADDIT is non-zero. */
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
{
expanded = history_expand (line, &history_value);
if (expanded)
{
if (print_changes)
{
if (expanded < 0)
internal_error ("%s", history_value);
#if defined (READLINE)
else if (hist_verify == 0 || expanded == 2)
#else
else
#endif
fprintf (stderr, "%s\n", history_value);
}
/* If there was an error, return NULL. */
if (expanded < 0 || expanded == 2) /* 2 == print only */
{
# if defined (READLINE)
if (expanded == 2 && rl_dispatching == 0 && *history_value)
# else
if (expanded == 2 && *history_value)
# endif /* !READLINE */
maybe_add_history (history_value);
free (history_value);
# if defined (READLINE)
/* New hack. We can allow the user to edit the
failed history expansion. */
if (history_reediting && expanded < 0 && rl_done)
re_edit (line);
# endif /* READLINE */
return ((char *)NULL);
}
# if defined (READLINE)
if (hist_verify && expanded == 1)
{
re_edit (history_value);
return ((char *)NULL);
}
# endif
}
/* Let other expansions know that return_value can be free'ed,
and that a line has been added to the history list. Note
that we only add lines that have something in them. */
expanded = 1;
return_value = history_value;
}
# endif /* BANG_HISTORY */
if (addit && remember_on_history && *return_value)
maybe_add_history (return_value);
#if 0
if (expanded == 0)
return_value = savestring (line);
#endif
return (return_value);
}
/* Return 1 if the first non-whitespace character in LINE is a `#', indicating
* that the line is a shell comment. */
static int
shell_comment (line)
char *line;
{
char *p;
for (p = line; p && *p && whitespace (*p); p++)
;
return (p && *p == '#');
}
#ifdef INCLUDE_UNUSED
/* Remove shell comments from LINE. A `#' and anything after it is a comment.
This isn't really useful yet, since it doesn't handle quoting. */
static char *
filter_comments (line)
char *line;
{
char *p;
for (p = line; p && *p && *p != '#'; p++)
;
if (p && *p == '#')
*p = '\0';
return (line);
}
#endif
/* Check LINE against what HISTCONTROL says to do. Returns 1 if the line
should be saved; 0 if it should be discarded. */
static int
check_history_control (line)
char *line;
{
HIST_ENTRY *temp;
int r;
if (history_control == 0)
return 1;
/* ignorespace or ignoreboth */
if ((history_control & HC_IGNSPACE) && *line == ' ')
return 0;
/* ignoredups or ignoreboth */
if (history_control & HC_IGNDUPS)
{
using_history ();
temp = previous_history ();
r = (temp == 0 || STREQ (temp->line, line) == 0);
using_history ();
if (r == 0)
return r;
}
return 1;
}
/* Remove all entries matching LINE from the history list. Triggered when
HISTCONTROL includes `erasedups'. */
static void
hc_erasedups (line)
char *line;
{
HIST_ENTRY *temp;
int r;
using_history ();
while (temp = previous_history ())
{
if (STREQ (temp->line, line))
{
r = where_history ();
remove_history (r);
}
}
using_history ();
}
/* Add LINE to the history list, handling possibly multi-line compound
commands. We note whether or not we save the first line of each command
(which is usually the entire command and history entry), and don't add
the second and subsequent lines of a multi-line compound command if we
didn't save the first line. We don't usually save shell comment lines in
compound commands in the history, because they could have the effect of
commenting out the rest of the command when the entire command is saved as
a single history entry (when COMMAND_ORIENTED_HISTORY is enabled). If
LITERAL_HISTORY is set, we're saving lines in the history with embedded
newlines, so it's OK to save comment lines. We also make sure to save
multiple-line quoted strings or other constructs. */
void
maybe_add_history (line)
char *line;
{
hist_last_line_added = 0;
/* Don't use the value of history_control to affect the second
and subsequent lines of a multi-line command (old code did
this only when command_oriented_history is enabled). */
if (current_command_line_count > 1)
{
if (current_command_first_line_saved &&
(literal_history || dstack.delimiter_depth != 0 || shell_comment (line) == 0))
bash_add_history (line);
return;
}
/* This is the first line of a (possible multi-line) command. Note whether
or not we should save the first line and remember it. */
current_command_first_line_saved = check_add_history (line, 0);
}
/* Just check LINE against HISTCONTROL and HISTIGNORE and add it to the
history if it's OK. Used by `history -s' as well as maybe_add_history().
Returns 1 if the line was saved in the history, 0 otherwise. */
int
check_add_history (line, force)
char *line;
int force;
{
if (check_history_control (line) && history_should_ignore (line) == 0)
{
/* We're committed to saving the line. If the user has requested it,
remove other matching lines from the history. */
if (history_control & HC_ERASEDUPS)
hc_erasedups (line);
if (force)
{
really_add_history (line);
using_history ();
}
else
bash_add_history (line);
return 1;
}
return 0;
}
#if defined (SYSLOG_HISTORY)
#define SYSLOG_MAXLEN 600
void
bash_syslog_history (line)
const char *line;
{
char trunc[SYSLOG_MAXLEN];
if (strlen(line) < SYSLOG_MAXLEN)
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d %s", getpid(), current_user.uid, line);
else
{
strncpy (trunc, line, SYSLOG_MAXLEN);
trunc[SYSLOG_MAXLEN - 1] = '\0';
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY (TRUNCATED): PID=%d UID=%d %s", getpid(), current_user.uid, trunc);
}
}
#endif
/* Add a line to the history list.
The variable COMMAND_ORIENTED_HISTORY controls the style of history
remembering; when non-zero, and LINE is not the first line of a
complete parser construct, append LINE to the last history line instead
of adding it as a new line. */
void
bash_add_history (line)
char *line;
{
int add_it, offset, curlen;
HIST_ENTRY *current, *old;
char *chars_to_add, *new_line;
add_it = 1;
if (command_oriented_history && current_command_line_count > 1)
{
chars_to_add = literal_history ? "\n" : history_delimiting_chars (line);
using_history ();
current = previous_history ();
if (current)
{
/* If the previous line ended with an escaped newline (escaped
with backslash, but otherwise unquoted), then remove the quoted
newline, since that is what happens when the line is parsed. */
curlen = strlen (current->line);
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\\' &&
current->line[curlen - 2] != '\\')
{
current->line[curlen - 1] = '\0';
curlen--;
chars_to_add = "";
}
/* If we're not in some kind of quoted construct, the current history
entry ends with a newline, and we're going to add a semicolon,
don't. In some cases, it results in a syntax error (e.g., before
a close brace), and it should not be needed. */
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\n' && *chars_to_add == ';')
chars_to_add++;
new_line = (char *)xmalloc (1
+ curlen
+ strlen (line)
+ strlen (chars_to_add));
sprintf (new_line, "%s%s%s", current->line, chars_to_add, line);
offset = where_history ();
old = replace_history_entry (offset, new_line, current->data);
free (new_line);
if (old)
free_history_entry (old);
add_it = 0;
}
}
if (add_it)
really_add_history (line);
#if defined (SYSLOG_HISTORY)
bash_syslog_history (line);
#endif
using_history ();
}
static void
really_add_history (line)
char *line;
{
hist_last_line_added = 1;
hist_last_line_pushed = 0;
add_history (line);
history_lines_this_session++;
}
int
history_number ()
{
using_history ();
return (remember_on_history ? history_base + where_history () : 1);
}
static int
should_expand (s)
char *s;
{
char *p;
for (p = s; p && *p; p++)
{
if (*p == '\\')
p++;
else if (*p == '&')
return 1;
}
return 0;
}
static int
histignore_item_func (ign)
struct ign *ign;
{
if (should_expand (ign->val))
ign->flags |= HIGN_EXPAND;
return (0);
}
void
setup_history_ignore (varname)
char *varname;
{
setup_ignore_patterns (&histignore);
}
static HIST_ENTRY *
last_history_entry ()
{
HIST_ENTRY *he;
using_history ();
he = previous_history ();
using_history ();
return he;
}
char *
last_history_line ()
{
HIST_ENTRY *he;
he = last_history_entry ();
if (he == 0)
return ((char *)NULL);
return he->line;
}
static char *
expand_histignore_pattern (pat)
char *pat;
{
HIST_ENTRY *phe;
char *ret;
phe = last_history_entry ();
if (phe == (HIST_ENTRY *)0)
return (savestring (pat));
ret = strcreplace (pat, '&', phe->line, 1);
return ret;
}
/* Return 1 if we should not put LINE into the history according to the
patterns in HISTIGNORE. */
static int
history_should_ignore (line)
char *line;
{
register int i, match;
char *npat;
if (histignore.num_ignores == 0)
return 0;
for (i = match = 0; i < histignore.num_ignores; i++)
{
if (histignore.ignores[i].flags & HIGN_EXPAND)
npat = expand_histignore_pattern (histignore.ignores[i].val);
else
npat = histignore.ignores[i].val;
match = strmatch (npat, line, FNMATCH_EXTFLAG) != FNM_NOMATCH;
if (histignore.ignores[i].flags & HIGN_EXPAND)
free (npat);
if (match)
break;
}
return match;
}
#endif /* HISTORY */
+4 -3
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Sat Mar 12 21:44:43 EST 2011
.\" Last Change: Thu Mar 24 10:21:02 EDT 2011
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2011 March 12" "GNU Bash-4.2"
.TH BASH 1 "2011 March 24" "GNU Bash-4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1465,7 +1465,8 @@ The shell function
\fB${BASH_SOURCE[\fP\fI$i+1\fP\fB]}\fP.
.TP
.B BASH_SUBSHELL
Incremented by one each time a subshell or subshell environment is spawned.
Incremented by one within each subshell or subshell environment when
the shell begins executing in that environment.
The initial value is 0.
.TP
.B BASH_VERSINFO
+2 -1
View File
@@ -4945,7 +4945,8 @@ The shell function @code{$@{FUNCNAME[$i]@}} is defined in the file
@code{$@{BASH_SOURCE[$i]@}} and called from @code{$@{BASH_SOURCE[$i+1]@}}
@item BASH_SUBSHELL
Incremented by one each time a subshell or subshell environment is spawned.
Incremented by one within each subshell or subshell environment when
the shell begins executing in that environment.
The initial value is 0.
@item BASH_VERSINFO
+2 -2
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2011 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Mar 12 21:44:16 EST 2011
@set LASTCHANGE Thu Mar 24 10:20:44 EDT 2011
@set EDITION 4.2
@set VERSION 4.2
@set UPDATED 12 March 2011
@set UPDATED 24 March 2011
@set UPDATED-MONTH March 2011
+107
View File
@@ -0,0 +1,107 @@
*** /fs2/chet/bash/bash-20110317/lib/glob/xmbsrtowcs.c 2011-03-14 14:29:02.000000000 -0400
--- xmbsrtowcs.c 2011-03-22 16:06:47.000000000 -0400
***************
*** 35,40 ****
--- 35,42 ----
#if HANDLE_MULTIBYTE
+ #define WSBUF_INC 32
+
#ifndef FREE
# define FREE(x) do { if (x) free (x); } while (0)
#endif
***************
*** 171,180 ****
/* Compute the number of produced wide-characters. */
tmp_p = p;
tmp_state = state;
! wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
/* Conversion failed. */
! if (wcslength == 0 || wcslength == (size_t)-1)
{
free (wsbuf);
*destp = NULL;
--- 173,193 ----
/* Compute the number of produced wide-characters. */
tmp_p = p;
tmp_state = state;
!
! if (nms == 0 && *p == '\\') /* special initial case */
! nms = wcslength = 1;
! else
! wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
!
! if (wcslength == 0)
! {
! tmp_p = p; /* will need below */
! tmp_state = state;
! wcslength = 1; /* take a single byte */
! }
/* Conversion failed. */
! if (wcslength == (size_t)-1)
{
free (wsbuf);
*destp = NULL;
***************
*** 186,192 ****
{
wchar_t *wstmp;
! wsbuf_size = wcnum+wcslength+1; /* 1 for the L'\0' or the potential L'\\' */
wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
if (wstmp == NULL)
--- 199,206 ----
{
wchar_t *wstmp;
! while (wsbuf_size < wcnum+wcslength+1) /* 1 for the L'\0' or the potential L'\\' */
! wsbuf_size += WSBUF_INC;
wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
if (wstmp == NULL)
***************
*** 199,208 ****
}
/* Perform the conversion. This is assumed to return 'wcslength'.
! * It may set 'p' to NULL. */
n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
! wcnum += wcslength;
if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
{
--- 213,230 ----
}
/* Perform the conversion. This is assumed to return 'wcslength'.
! It may set 'p' to NULL. */
n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
! /* Compensate for taking single byte on wcs conversion failure above. */
! if (wcslength == 1 && (n == 0 || n == (size_t)-1))
! {
! state = tmp_state;
! p = tmp_p;
! wsbuf[wcnum++] = *p++;
! }
! else
! wcnum += wcslength;
if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
{
***************
*** 230,237 ****
If conversion is failed, the return value is (size_t)-1 and the values
of DESTP and INDICESP are NULL. */
- #define WSBUF_INC 32
-
size_t
xdupmbstowcs (destp, indicesp, src)
wchar_t **destp; /* Store the pointer to the wide character string */
--- 252,257 ----
+2 -2
View File
@@ -271,8 +271,8 @@ wdequote_pathname (pathname)
/* Convert the strings into wide characters. */
n = xdupmbstowcs (&wpathname, NULL, pathname);
if (n == (size_t) -1)
/* Something wrong. */
return;
/* Something wrong. Fall back to single-byte */
return udequote_pathname (pathname);
orig_wpathname = wpathname;
for (i = j = 0; wpathname && wpathname[i]; )
+27 -7
View File
@@ -35,6 +35,8 @@
#if HANDLE_MULTIBYTE
#define WSBUF_INC 32
#ifndef FREE
# define FREE(x) do { if (x) free (x); } while (0)
#endif
@@ -171,10 +173,21 @@ xdupmbstowcs2 (destp, src)
/* Compute the number of produced wide-characters. */
tmp_p = p;
tmp_state = state;
wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
if (nms == 0 && *p == '\\') /* special initial case */
nms = wcslength = 1;
else
wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
if (wcslength == 0)
{
tmp_p = p; /* will need below */
tmp_state = state;
wcslength = 1; /* take a single byte */
}
/* Conversion failed. */
if (wcslength == 0 || wcslength == (size_t)-1)
if (wcslength == (size_t)-1)
{
free (wsbuf);
*destp = NULL;
@@ -186,7 +199,8 @@ xdupmbstowcs2 (destp, src)
{
wchar_t *wstmp;
wsbuf_size = wcnum+wcslength+1; /* 1 for the L'\0' or the potential L'\\' */
while (wsbuf_size < wcnum+wcslength+1) /* 1 for the L'\0' or the potential L'\\' */
wsbuf_size += WSBUF_INC;
wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
if (wstmp == NULL)
@@ -199,10 +213,18 @@ xdupmbstowcs2 (destp, src)
}
/* Perform the conversion. This is assumed to return 'wcslength'.
* It may set 'p' to NULL. */
It may set 'p' to NULL. */
n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
wcnum += wcslength;
/* Compensate for taking single byte on wcs conversion failure above. */
if (wcslength == 1 && (n == 0 || n == (size_t)-1))
{
state = tmp_state;
p = tmp_p;
wsbuf[wcnum++] = *p++;
}
else
wcnum += wcslength;
if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
{
@@ -230,8 +252,6 @@ xdupmbstowcs2 (destp, src)
If conversion is failed, the return value is (size_t)-1 and the values
of DESTP and INDICESP are NULL. */
#define WSBUF_INC 32
size_t
xdupmbstowcs (destp, indicesp, src)
wchar_t **destp; /* Store the pointer to the wide character string */
+507
View File
@@ -0,0 +1,507 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2010 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_PRIVATE_H_)
#define _RL_PRIVATE_H_
#include "rlconf.h" /* for VISIBLE_STATS */
#include "rlstdc.h"
#include "posixjmp.h" /* defines procenv_t */
/*************************************************************************
* *
* Convenience definitions *
* *
*************************************************************************/
#define EMACS_MODE() (rl_editing_mode == emacs_mode)
#define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
#define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
#define RL_CHECK_SIGNALS() \
do { \
if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
} while (0)
/*************************************************************************
* *
* Global structs undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* search types */
#define RL_SEARCH_ISEARCH 0x01 /* incremental search */
#define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
#define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
/* search flags */
#define SF_REVERSE 0x01
#define SF_FOUND 0x02
#define SF_FAILED 0x04
#define SF_CHGKMAP 0x08
typedef struct __rl_search_context
{
int type;
int sflags;
char *search_string;
int search_string_index;
int search_string_size;
char **lines;
char *allocated_line;
int hlen;
int hindex;
int save_point;
int save_mark;
int save_line;
int last_found_line;
char *prev_line_found;
UNDO_LIST *save_undo_list;
Keymap keymap; /* used when dispatching commands in search string */
Keymap okeymap; /* original keymap */
int history_pos;
int direction;
int lastc;
#if defined (HANDLE_MULTIBYTE)
char mb[MB_LEN_MAX];
#endif
char *sline;
int sline_len;
int sline_index;
char *search_terminators;
} _rl_search_cxt;
/* Callback data for reading numeric arguments */
#define NUM_SAWMINUS 0x01
#define NUM_SAWDIGITS 0x02
#define NUM_READONE 0x04
typedef int _rl_arg_cxt;
/* A context for reading key sequences longer than a single character when
using the callback interface. */
#define KSEQ_DISPATCHED 0x01
#define KSEQ_SUBSEQ 0x02
#define KSEQ_RECURSIVE 0x04
typedef struct __rl_keyseq_context
{
int flags;
int subseq_arg;
int subseq_retval; /* XXX */
Keymap dmap;
Keymap oldmap;
int okey;
struct __rl_keyseq_context *ocxt;
int childval;
} _rl_keyseq_cxt;
/* vi-mode commands that use result of motion command to define boundaries */
#define VIM_DELETE 0x01
#define VIM_CHANGE 0x02
#define VIM_YANK 0x04
/* various states for vi-mode commands that use motion commands. reflects
RL_READLINE_STATE */
#define VMSTATE_READ 0x01
#define VMSTATE_NUMARG 0x02
typedef struct __rl_vimotion_context
{
int op;
int state;
int flags; /* reserved */
_rl_arg_cxt ncxt;
int numeric_arg;
int start, end; /* rl_point, rl_end */
int key, motion; /* initial key, motion command */
} _rl_vimotion_cxt;
/* fill in more as needed */
/* `Generic' callback data and functions */
typedef struct __rl_callback_generic_arg
{
int count;
int i1, i2;
/* add here as needed */
} _rl_callback_generic_arg;
typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
/*************************************************************************
* *
* Global functions undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/*************************************************************************
* *
* Global variables undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* complete.c */
extern int rl_complete_with_tilde_expansion;
#if defined (VISIBLE_STATS)
extern int rl_visible_stats;
#endif /* VISIBLE_STATS */
/* readline.c */
extern int rl_line_buffer_len;
extern int rl_arg_sign;
extern int rl_visible_prompt_length;
extern int rl_key_sequence_length;
extern int rl_byte_oriented;
/* display.c */
extern int rl_display_fixed;
/* parens.c */
extern int rl_blink_matching_paren;
/*************************************************************************
* *
* Global functions and variables unsed and undocumented *
* *
*************************************************************************/
/* kill.c */
extern int rl_set_retained_kills PARAMS((int));
/* terminal.c */
extern void _rl_set_screen_size PARAMS((int, int));
/* undo.c */
extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
/* util.c */
extern char *_rl_savestring PARAMS((const char *));
/*************************************************************************
* *
* Functions and variables private to the readline library *
* *
*************************************************************************/
/* NOTE: Functions and variables prefixed with `_rl_' are
pseudo-global: they are global so they can be shared
between files in the readline library, but are not intended
to be visible to readline callers. */
/*************************************************************************
* Undocumented private functions *
*************************************************************************/
#if defined(READLINE_CALLBACKS)
/* readline.c */
extern void readline_internal_setup PARAMS((void));
extern char *readline_internal_teardown PARAMS((int));
extern int readline_internal_char PARAMS((void));
extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
extern void _rl_keyseq_chain_dispose PARAMS((void));
extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
/* callback.c */
extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
#endif /* READLINE_CALLBACKS */
/* bind.c */
/* complete.c */
extern void _rl_reset_completion_state PARAMS((void));
extern char _rl_find_completion_word PARAMS((int *, int *));
extern void _rl_free_match_list PARAMS((char **));
/* display.c */
extern char *_rl_strip_prompt PARAMS((char *));
extern void _rl_move_cursor_relative PARAMS((int, const char *));
extern void _rl_move_vert PARAMS((int));
extern void _rl_save_prompt PARAMS((void));
extern void _rl_restore_prompt PARAMS((void));
extern char *_rl_make_prompt_for_search PARAMS((int));
extern void _rl_erase_at_end_of_line PARAMS((int));
extern void _rl_clear_to_eol PARAMS((int));
extern void _rl_clear_screen PARAMS((void));
extern void _rl_update_final PARAMS((void));
extern void _rl_redisplay_after_sigwinch PARAMS((void));
extern void _rl_clean_up_for_exit PARAMS((void));
extern void _rl_erase_entire_line PARAMS((void));
extern int _rl_current_display_line PARAMS((void));
/* input.c */
extern int _rl_any_typein PARAMS((void));
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));
/* isearch.c */
extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
extern int _rl_next_macro_key PARAMS((void));
extern void _rl_push_executing_macro PARAMS((void));
extern void _rl_pop_executing_macro PARAMS((void));
extern void _rl_add_macro_char PARAMS((int));
extern void _rl_kill_kbd_macro PARAMS((void));
/* misc.c */
extern int _rl_arg_overflow PARAMS((void));
extern void _rl_arg_init PARAMS((void));
extern int _rl_arg_getchar PARAMS((void));
extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
extern void _rl_reset_argument PARAMS((void));
extern void _rl_start_using_history PARAMS((void));
extern int _rl_free_saved_history_line PARAMS((void));
extern void _rl_set_insert_mode PARAMS((int, int));
extern void _rl_revert_all_lines PARAMS((void));
/* nls.c */
extern int _rl_init_eightbit PARAMS((void));
/* parens.c */
extern void _rl_enable_paren_matching PARAMS((int));
/* readline.c */
extern void _rl_init_line_state PARAMS((void));
extern void _rl_set_the_line PARAMS((void));
extern int _rl_dispatch PARAMS((int, Keymap));
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
extern void _rl_internal_char_cleanup PARAMS((void));
/* rltty.c */
extern int _rl_disable_tty_signals PARAMS((void));
extern int _rl_restore_tty_signals PARAMS((void));
/* search.c */
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
/* signals.c */
extern void _rl_signal_handler PARAMS((int));
extern void _rl_block_sigint PARAMS((void));
extern void _rl_release_sigint PARAMS((void));
extern void _rl_block_sigwinch PARAMS((void));
extern void _rl_release_sigwinch PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
e
extern int _rl_init_terminal_io PARAMS((const char *));
#ifdef _MINIX
extern void _rl_output_character_function PARAMS((int));
#else
extern int _rl_output_character_function PARAMS((int));
#endif
extern void _rl_output_some_chars PARAMS((const char *, int));
extern int _rl_backspace PARAMS((int));
extern void _rl_enable_meta_key PARAMS((void));
extern void _rl_control_keypad PARAMS((int));
extern void _rl_set_cursor PARAMS((int, int));
/* text.c */
extern void _rl_fix_point PARAMS((int));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_insert_char PARAMS((int, int));
extern int _rl_overwrite_char PARAMS((int, int));
extern int _rl_overwrite_rubout PARAMS((int, int));
extern int _rl_rubout_char PARAMS((int, int));
#if defined (HANDLE_MULTIBYTE)
extern int _rl_char_search_internal PARAMS((int, int, char *, int));
#else
extern int _rl_char_search_internal PARAMS((int, int, int));
#endif
extern int _rl_set_mark_at_pos PARAMS((int));
/* undo.c */
extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
/* util.c */
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern void _rl_ttymsg ();
extern void _rl_errmsg ();
extern void _rl_trace ();
#endif
extern int _rl_tropen PARAMS((void));
extern int _rl_abort_internal PARAMS((void));
extern int _rl_null_function PARAMS((int, int));
extern char *_rl_strindex PARAMS((const char *, const char *));
extern int _rl_qsort_string_compare PARAMS((char **, char **));
extern int (_rl_uppercase_p) PARAMS((int));
extern int (_rl_lowercase_p) PARAMS((int));
extern int (_rl_pure_alphabetic) PARAMS((int));
extern int (_rl_digit_p) PARAMS((int));
extern int (_rl_to_lower) PARAMS((int));
extern int (_rl_to_upper) PARAMS((int));
extern int (_rl_digit_value) PARAMS((int));
/* vi_mode.c */
extern void _rl_vi_initialize_line PARAMS((void));
extern void _rl_vi_reset_last PARAMS((void));
extern void _rl_vi_set_last PARAMS((int, int, int));
extern int _rl_vi_textmod_command PARAMS((int));
extern void _rl_vi_done_inserting PARAMS((void));
extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
/*************************************************************************
* Undocumented private variables *
*************************************************************************/
/* bind.c */
extern const char * const _rl_possible_control_prefixes[];
extern const char * const _rl_possible_meta_prefixes[];
/* callback.c */
extern _rl_callback_func_t *_rl_callback_func;
extern _rl_callback_generic_arg *_rl_callback_data;
/* 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_completion_prefix_display_length;
extern int _rl_completion_columns;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_completion_case_map;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
extern int _rl_menu_complete_prefix_first;
/* display.c */
extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
extern int _rl_want_redisplay;
/* isearch.c */
extern char *_rl_isearch_terminators;
extern _rl_search_cxt *_rl_iscxt;
/* macro.c */
extern char *_rl_executing_macro;
/* misc.c */
extern int _rl_history_preserve_point;
extern int _rl_history_saved_point;
extern _rl_arg_cxt _rl_argcxt;
/* readline.c */
extern int _rl_echoing_p;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
extern int _rl_meta_flag;
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_bind_stty_chars;
extern int _rl_revert_all_at_newline;
extern int _rl_echo_control_chars;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* signals.c */
extern int _rl_interrupt_immediately;
extern int volatile _rl_caught_signal;
extern int _rl_echoctl;
extern int _rl_intr_char;
extern int _rl_quit_char;
extern int _rl_susp_char;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;
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 char *_rl_term_forward_char;
extern int _rl_screenheight;
extern int _rl_screenwidth;
extern int _rl_screenchars;
extern int _rl_terminal_can_insert;
extern int _rl_term_autowrap;
/* undo.c */
extern int _rl_doing_an_undo;
extern int _rl_undo_group_level;
/* vi_mode.c */
extern int _rl_vi_last_command;
extern _rl_vimotion_cxt *_rl_vimvcxt;
#endif /* _RL_PRIVATE_H_ */
+3 -1
View File
@@ -45,6 +45,8 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <signal.h>
#include "posixselect.h"
#if defined (FIONREAD_IN_SYS_IOCTL)
@@ -507,7 +509,7 @@ rl_getc (stream)
#undef X_EWOULDBLOCK
#undef X_EAGAIN
/* If the error that we received was SIGINT, then try again,
/* If the error that we received was EINTR, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
+610
View File
@@ -0,0 +1,610 @@
/* input.c -- character input functions for readline. */
/* Copyright (C) 1994-2011 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (__TANDEM)
# include <floss.h>
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <signal.h>
#include "posixselect.h"
#if defined (FIONREAD_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif
#include <stdio.h>
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
/* Some standard library routines. */
#include "readline.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL;
rl_getc_func_t *rl_getc_function = rl_getc;
static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */
static int ibuffer_space PARAMS((void));
static int rl_get_char PARAMS((int *));
static int rl_gather_tyi PARAMS((void));
/* **************************************************************** */
/* */
/* Character Input Buffering */
/* */
/* **************************************************************** */
static int pop_index, push_index;
static unsigned char ibuffer[512];
static int ibuffer_len = sizeof (ibuffer) - 1;
#define any_typein (push_index != pop_index)
int
_rl_any_typein ()
{
return any_typein;
}
/* Return the amount of space available in the buffer for stuffing
characters. */
static int
ibuffer_space ()
{
if (pop_index > push_index)
return (pop_index - push_index - 1);
else
return (ibuffer_len - (push_index - pop_index));
}
/* Get a key from the buffer of characters to be read.
Return the key in KEY.
Result is KEY if there was a key, or 0 if there wasn't. */
static int
rl_get_char (key)
int *key;
{
if (push_index == pop_index)
return (0);
*key = ibuffer[pop_index++];
#if 0
if (pop_index >= ibuffer_len)
#else
if (pop_index > ibuffer_len)
#endif
pop_index = 0;
return (1);
}
/* Stuff KEY into the *front* of the input buffer.
Returns non-zero if successful, zero if there is
no space left in the buffer. */
int
_rl_unget_char (key)
int key;
{
if (ibuffer_space ())
{
pop_index--;
if (pop_index < 0)
pop_index = ibuffer_len;
ibuffer[pop_index] = key;
return (1);
}
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). */
static int
rl_gather_tyi ()
{
int tty;
register int tem, result;
int chars_avail, k;
char input;
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
chars_avail = 0;
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout);
if (result <= 0)
return 0; /* Nothing to read. */
#endif
result = -1;
#if defined (FIONREAD)
errno = 0;
result = ioctl (tty, FIONREAD, &chars_avail);
if (result == -1 && errno == EIO)
return -1;
#endif
#if defined (O_NDELAY)
if (result == -1)
{
tem = fcntl (tty, F_GETFL, 0);
fcntl (tty, F_SETFL, (tem | O_NDELAY));
chars_avail = read (tty, &input, 1);
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 */
#if defined (__MINGW32__)
/* Use getch/_kbhit to check for available console input, in the same way
that we read it normally. */
chars_avail = isatty (tty) ? _kbhit () : 0;
result = 0;
#endif
/* If there's nothing available, don't waste time trying to read
something. */
if (chars_avail <= 0)
return 0;
tem = ibuffer_space ();
if (chars_avail > tem)
chars_avail = tem;
/* One cannot read all of the available input. I can only read a single
character at a time, or else programs which require input can be
thwarted. If the buffer is larger than one character, I lose.
Damn! */
if (tem < ibuffer_len)
chars_avail = 0;
if (result != -1)
{
while (chars_avail--)
{
RL_CHECK_SIGNALS ();
k = (*rl_getc_function) (rl_instream);
if (rl_stuff_char (k) == 0)
break; /* some problem; no more room */
if (k == NEWLINE || k == RETURN)
break;
}
}
else
{
if (chars_avail)
rl_stuff_char (input);
}
return 1;
}
int
rl_set_keyboard_input_timeout (u)
int u;
{
int o;
o = _keyboard_input_timeout;
if (u >= 0)
_keyboard_input_timeout = u;
return (o);
}
/* Is there input available to be read on the readline input file
descriptor? Only works if the system has select(2) or FIONREAD.
Uses the value of _keyboard_input_timeout as the timeout; if another
readline function wants to specify a timeout and not leave it up to
the user, it should use _rl_input_queued(timeout_value_in_microseconds)
instead. */
int
_rl_input_available ()
{
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
#if !defined (HAVE_SELECT) && defined(FIONREAD)
int chars_avail;
#endif
int tty;
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
timeout.tv_usec = _keyboard_input_timeout;
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
#else
#if defined (FIONREAD)
if (ioctl (tty, FIONREAD, &chars_avail) == 0)
return (chars_avail);
#endif
#endif
#if defined (__MINGW32__)
if (isatty (tty))
return (_kbhit ());
#endif
return 0;
}
int
_rl_input_queued (t)
int t;
{
int old_timeout, r;
old_timeout = rl_set_keyboard_input_timeout (t);
r = _rl_input_available ();
rl_set_keyboard_input_timeout (old_timeout);
return r;
}
void
_rl_insert_typein (c)
int c;
{
int key, t, i;
char *string;
i = key = 0;
string = (char *)xmalloc (ibuffer_len + 1);
string[i++] = (char) c;
while ((t = rl_get_char (&key)) &&
_rl_keymap[key].type == ISFUNC &&
_rl_keymap[key].function == rl_insert)
string[i++] = key;
if (t)
_rl_unget_char (key);
string[i] = '\0';
rl_insert_text (string);
xfree (string);
}
/* Add KEY to the buffer of characters to be read. Returns 1 if the
character was stuffed correctly; 0 otherwise. */
int
rl_stuff_char (key)
int key;
{
if (ibuffer_space () == 0)
return 0;
if (key == EOF)
{
key = NEWLINE;
rl_pending_input = EOF;
RL_SETSTATE (RL_STATE_INPUTPENDING);
}
ibuffer[push_index++] = key;
#if 0
if (push_index >= ibuffer_len)
#else
if (push_index > ibuffer_len)
#endif
push_index = 0;
return 1;
}
/* Make C be the next command to be executed. */
int
rl_execute_next (c)
int c;
{
rl_pending_input = c;
RL_SETSTATE (RL_STATE_INPUTPENDING);
return 0;
}
/* Clear any pending input pushed with rl_execute_next() */
int
rl_clear_pending_input ()
{
rl_pending_input = 0;
RL_UNSETSTATE (RL_STATE_INPUTPENDING);
return 0;
}
/* **************************************************************** */
/* */
/* Character Input */
/* */
/* **************************************************************** */
/* Read a key, including pending input. */
int
rl_read_key ()
{
int c;
rl_key_sequence_length++;
if (rl_pending_input)
{
c = rl_pending_input;
rl_clear_pending_input ();
}
else
{
/* If input is coming from a macro, then use that. */
if (c = _rl_next_macro_key ())
return (c);
/* If the user has an event function, then call it periodically. */
if (rl_event_hook)
{
while (rl_event_hook)
{
if (rl_gather_tyi () < 0) /* XXX - EIO */
{
rl_done = 1;
return ('\n');
}
RL_CHECK_SIGNALS ();
if (rl_get_char (&c) != 0)
break;
if (rl_done) /* XXX - experimental */
return ('\n');
(*rl_event_hook) ();
}
}
else
{
if (rl_get_char (&c) == 0)
c = (*rl_getc_function) (rl_instream);
RL_CHECK_SIGNALS ();
}
}
return (c);
}
int
rl_getc (stream)
FILE *stream;
{
int result;
unsigned char c;
while (1)
{
RL_CHECK_SIGNALS ();
/* We know at this point that _rl_caught_signal == 0 */
#if defined (__MINGW32__)
if (isatty (fileno (stream)))
return (getch ());
#endif
result = read (fileno (stream), &c, sizeof (unsigned char));
if (_rl_caught_signal)
{
itrace("rl_getc: caught SIGWINCH: %d", _rl_caught_signal);
_rl_caught_signal = 0;
}
if (result == sizeof (unsigned char))
return (c);
/* If zero characters are returned, then the file that we are
reading from is empty! Return EOF in that case. */
if (result == 0)
return (EOF);
#if defined (__BEOS__)
if (errno == EINTR)
continue;
#endif
#if defined (EWOULDBLOCK)
# define X_EWOULDBLOCK EWOULDBLOCK
#else
# define X_EWOULDBLOCK -99
#endif
#if defined (EAGAIN)
# define X_EAGAIN EAGAIN
#else
# define X_EAGAIN -99
#endif
if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
{
if (sh_unset_nodelay_mode (fileno (stream)) < 0)
return (EOF);
continue;
}
#undef X_EWOULDBLOCK
#undef X_EAGAIN
/* If the error that we received was EINTR, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
else if (rl_event_hook)
(*rl_event_hook) ();
}
}
#if defined (HANDLE_MULTIBYTE)
/* read multibyte char */
int
_rl_read_mbchar (mbchar, size)
char *mbchar;
int size;
{
int mb_len, c;
size_t mbchar_bytes_length;
wchar_t wc;
mbstate_t ps, ps_back;
memset(&ps, 0, sizeof (mbstate_t));
memset(&ps_back, 0, sizeof (mbstate_t));
mb_len = 0;
while (mb_len < size)
{
RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
break;
mbchar[mb_len++] = c;
mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
if (mbchar_bytes_length == (size_t)(-1))
break; /* invalid byte sequence for the current locale */
else if (mbchar_bytes_length == (size_t)(-2))
{
/* shorted bytes */
ps = ps_back;
continue;
}
else if (mbchar_bytes_length == 0)
{
mbchar[0] = '\0'; /* null wide character */
mb_len = 1;
break;
}
else if (mbchar_bytes_length > (size_t)(0))
break;
}
return mb_len;
}
/* Read a multibyte-character string whose first character is FIRST into
the buffer MB of length MLEN. Returns the last character read, which
may be FIRST. Used by the search functions, among others. Very similar
to _rl_read_mbchar. */
int
_rl_read_mbstring (first, mb, mlen)
int first;
char *mb;
int mlen;
{
int i, c;
mbstate_t ps;
c = first;
memset (mb, 0, mlen);
for (i = 0; c >= 0 && i < mlen; i++)
{
mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));
if (_rl_get_char_len (mb, &ps) == -2)
{
/* Read more for multibyte character */
RL_SETSTATE (RL_STATE_MOREINPUT);
c = rl_read_key ();
RL_UNSETSTATE (RL_STATE_MOREINPUT);
}
else
break;
}
return c;
}
#endif /* HANDLE_MULTIBYTE */
+1
View File
@@ -330,6 +330,7 @@ extern void _rl_release_sigwinch PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
extern void _rl_sigwinch_resize_terminal PARAMS((void));
extern int _rl_init_terminal_io PARAMS((const char *));
#ifdef _MINIX
extern void _rl_output_character_function PARAMS((int));
+506
View File
@@ -0,0 +1,506 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2010 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_PRIVATE_H_)
#define _RL_PRIVATE_H_
#include "rlconf.h" /* for VISIBLE_STATS */
#include "rlstdc.h"
#include "posixjmp.h" /* defines procenv_t */
/*************************************************************************
* *
* Convenience definitions *
* *
*************************************************************************/
#define EMACS_MODE() (rl_editing_mode == emacs_mode)
#define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
#define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
#define RL_CHECK_SIGNALS() \
do { \
if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
} while (0)
/*************************************************************************
* *
* Global structs undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* search types */
#define RL_SEARCH_ISEARCH 0x01 /* incremental search */
#define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
#define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
/* search flags */
#define SF_REVERSE 0x01
#define SF_FOUND 0x02
#define SF_FAILED 0x04
#define SF_CHGKMAP 0x08
typedef struct __rl_search_context
{
int type;
int sflags;
char *search_string;
int search_string_index;
int search_string_size;
char **lines;
char *allocated_line;
int hlen;
int hindex;
int save_point;
int save_mark;
int save_line;
int last_found_line;
char *prev_line_found;
UNDO_LIST *save_undo_list;
Keymap keymap; /* used when dispatching commands in search string */
Keymap okeymap; /* original keymap */
int history_pos;
int direction;
int lastc;
#if defined (HANDLE_MULTIBYTE)
char mb[MB_LEN_MAX];
#endif
char *sline;
int sline_len;
int sline_index;
char *search_terminators;
} _rl_search_cxt;
/* Callback data for reading numeric arguments */
#define NUM_SAWMINUS 0x01
#define NUM_SAWDIGITS 0x02
#define NUM_READONE 0x04
typedef int _rl_arg_cxt;
/* A context for reading key sequences longer than a single character when
using the callback interface. */
#define KSEQ_DISPATCHED 0x01
#define KSEQ_SUBSEQ 0x02
#define KSEQ_RECURSIVE 0x04
typedef struct __rl_keyseq_context
{
int flags;
int subseq_arg;
int subseq_retval; /* XXX */
Keymap dmap;
Keymap oldmap;
int okey;
struct __rl_keyseq_context *ocxt;
int childval;
} _rl_keyseq_cxt;
/* vi-mode commands that use result of motion command to define boundaries */
#define VIM_DELETE 0x01
#define VIM_CHANGE 0x02
#define VIM_YANK 0x04
/* various states for vi-mode commands that use motion commands. reflects
RL_READLINE_STATE */
#define VMSTATE_READ 0x01
#define VMSTATE_NUMARG 0x02
typedef struct __rl_vimotion_context
{
int op;
int state;
int flags; /* reserved */
_rl_arg_cxt ncxt;
int numeric_arg;
int start, end; /* rl_point, rl_end */
int key, motion; /* initial key, motion command */
} _rl_vimotion_cxt;
/* fill in more as needed */
/* `Generic' callback data and functions */
typedef struct __rl_callback_generic_arg
{
int count;
int i1, i2;
/* add here as needed */
} _rl_callback_generic_arg;
typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
/*************************************************************************
* *
* Global functions undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/*************************************************************************
* *
* Global variables undocumented in texinfo manual and not in readline.h *
* *
*************************************************************************/
/* complete.c */
extern int rl_complete_with_tilde_expansion;
#if defined (VISIBLE_STATS)
extern int rl_visible_stats;
#endif /* VISIBLE_STATS */
/* readline.c */
extern int rl_line_buffer_len;
extern int rl_arg_sign;
extern int rl_visible_prompt_length;
extern int rl_key_sequence_length;
extern int rl_byte_oriented;
/* display.c */
extern int rl_display_fixed;
/* parens.c */
extern int rl_blink_matching_paren;
/*************************************************************************
* *
* Global functions and variables unsed and undocumented *
* *
*************************************************************************/
/* kill.c */
extern int rl_set_retained_kills PARAMS((int));
/* terminal.c */
extern void _rl_set_screen_size PARAMS((int, int));
/* undo.c */
extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
/* util.c */
extern char *_rl_savestring PARAMS((const char *));
/*************************************************************************
* *
* Functions and variables private to the readline library *
* *
*************************************************************************/
/* NOTE: Functions and variables prefixed with `_rl_' are
pseudo-global: they are global so they can be shared
between files in the readline library, but are not intended
to be visible to readline callers. */
/*************************************************************************
* Undocumented private functions *
*************************************************************************/
#if defined(READLINE_CALLBACKS)
/* readline.c */
extern void readline_internal_setup PARAMS((void));
extern char *readline_internal_teardown PARAMS((int));
extern int readline_internal_char PARAMS((void));
extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
extern void _rl_keyseq_chain_dispose PARAMS((void));
extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
/* callback.c */
extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
#endif /* READLINE_CALLBACKS */
/* bind.c */
/* complete.c */
extern void _rl_reset_completion_state PARAMS((void));
extern char _rl_find_completion_word PARAMS((int *, int *));
extern void _rl_free_match_list PARAMS((char **));
/* display.c */
extern char *_rl_strip_prompt PARAMS((char *));
extern void _rl_move_cursor_relative PARAMS((int, const char *));
extern void _rl_move_vert PARAMS((int));
extern void _rl_save_prompt PARAMS((void));
extern void _rl_restore_prompt PARAMS((void));
extern char *_rl_make_prompt_for_search PARAMS((int));
extern void _rl_erase_at_end_of_line PARAMS((int));
extern void _rl_clear_to_eol PARAMS((int));
extern void _rl_clear_screen PARAMS((void));
extern void _rl_update_final PARAMS((void));
extern void _rl_redisplay_after_sigwinch PARAMS((void));
extern void _rl_clean_up_for_exit PARAMS((void));
extern void _rl_erase_entire_line PARAMS((void));
extern int _rl_current_display_line PARAMS((void));
/* input.c */
extern int _rl_any_typein PARAMS((void));
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));
/* isearch.c */
extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
extern int _rl_next_macro_key PARAMS((void));
extern void _rl_push_executing_macro PARAMS((void));
extern void _rl_pop_executing_macro PARAMS((void));
extern void _rl_add_macro_char PARAMS((int));
extern void _rl_kill_kbd_macro PARAMS((void));
/* misc.c */
extern int _rl_arg_overflow PARAMS((void));
extern void _rl_arg_init PARAMS((void));
extern int _rl_arg_getchar PARAMS((void));
extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
extern void _rl_reset_argument PARAMS((void));
extern void _rl_start_using_history PARAMS((void));
extern int _rl_free_saved_history_line PARAMS((void));
extern void _rl_set_insert_mode PARAMS((int, int));
extern void _rl_revert_all_lines PARAMS((void));
/* nls.c */
extern int _rl_init_eightbit PARAMS((void));
/* parens.c */
extern void _rl_enable_paren_matching PARAMS((int));
/* readline.c */
extern void _rl_init_line_state PARAMS((void));
extern void _rl_set_the_line PARAMS((void));
extern int _rl_dispatch PARAMS((int, Keymap));
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
extern void _rl_internal_char_cleanup PARAMS((void));
/* rltty.c */
extern int _rl_disable_tty_signals PARAMS((void));
extern int _rl_restore_tty_signals PARAMS((void));
/* search.c */
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
/* signals.c */
extern void _rl_signal_handler PARAMS((int));
extern void _rl_block_sigint PARAMS((void));
extern void _rl_release_sigint PARAMS((void));
extern void _rl_block_sigwinch PARAMS((void));
extern void _rl_release_sigwinch PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
extern int _rl_init_terminal_io PARAMS((const char *));
#ifdef _MINIX
extern void _rl_output_character_function PARAMS((int));
#else
extern int _rl_output_character_function PARAMS((int));
#endif
extern void _rl_output_some_chars PARAMS((const char *, int));
extern int _rl_backspace PARAMS((int));
extern void _rl_enable_meta_key PARAMS((void));
extern void _rl_control_keypad PARAMS((int));
extern void _rl_set_cursor PARAMS((int, int));
/* text.c */
extern void _rl_fix_point PARAMS((int));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_insert_char PARAMS((int, int));
extern int _rl_overwrite_char PARAMS((int, int));
extern int _rl_overwrite_rubout PARAMS((int, int));
extern int _rl_rubout_char PARAMS((int, int));
#if defined (HANDLE_MULTIBYTE)
extern int _rl_char_search_internal PARAMS((int, int, char *, int));
#else
extern int _rl_char_search_internal PARAMS((int, int, int));
#endif
extern int _rl_set_mark_at_pos PARAMS((int));
/* undo.c */
extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
/* util.c */
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern void _rl_ttymsg ();
extern void _rl_errmsg ();
extern void _rl_trace ();
#endif
extern int _rl_tropen PARAMS((void));
extern int _rl_abort_internal PARAMS((void));
extern int _rl_null_function PARAMS((int, int));
extern char *_rl_strindex PARAMS((const char *, const char *));
extern int _rl_qsort_string_compare PARAMS((char **, char **));
extern int (_rl_uppercase_p) PARAMS((int));
extern int (_rl_lowercase_p) PARAMS((int));
extern int (_rl_pure_alphabetic) PARAMS((int));
extern int (_rl_digit_p) PARAMS((int));
extern int (_rl_to_lower) PARAMS((int));
extern int (_rl_to_upper) PARAMS((int));
extern int (_rl_digit_value) PARAMS((int));
/* vi_mode.c */
extern void _rl_vi_initialize_line PARAMS((void));
extern void _rl_vi_reset_last PARAMS((void));
extern void _rl_vi_set_last PARAMS((int, int, int));
extern int _rl_vi_textmod_command PARAMS((int));
extern void _rl_vi_done_inserting PARAMS((void));
extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
/*************************************************************************
* Undocumented private variables *
*************************************************************************/
/* bind.c */
extern const char * const _rl_possible_control_prefixes[];
extern const char * const _rl_possible_meta_prefixes[];
/* callback.c */
extern _rl_callback_func_t *_rl_callback_func;
extern _rl_callback_generic_arg *_rl_callback_data;
/* 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_completion_prefix_display_length;
extern int _rl_completion_columns;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_completion_case_map;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
extern int _rl_menu_complete_prefix_first;
/* display.c */
extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
extern int _rl_want_redisplay;
/* isearch.c */
extern char *_rl_isearch_terminators;
extern _rl_search_cxt *_rl_iscxt;
/* macro.c */
extern char *_rl_executing_macro;
/* misc.c */
extern int _rl_history_preserve_point;
extern int _rl_history_saved_point;
extern _rl_arg_cxt _rl_argcxt;
/* readline.c */
extern int _rl_echoing_p;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
extern int _rl_meta_flag;
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_bind_stty_chars;
extern int _rl_revert_all_at_newline;
extern int _rl_echo_control_chars;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* signals.c */
extern int _rl_interrupt_immediately;
extern int volatile _rl_caught_signal;
extern int _rl_echoctl;
extern int _rl_intr_char;
extern int _rl_quit_char;
extern int _rl_susp_char;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;
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 char *_rl_term_forward_char;
extern int _rl_screenheight;
extern int _rl_screenwidth;
extern int _rl_screenchars;
extern int _rl_terminal_can_insert;
extern int _rl_term_autowrap;
/* undo.c */
extern int _rl_doing_an_undo;
extern int _rl_undo_group_level;
/* vi_mode.c */
extern int _rl_vi_last_command;
extern _rl_vimotion_cxt *_rl_vimvcxt;
#endif /* _RL_PRIVATE_H_ */
+12
View File
@@ -42,4 +42,16 @@
# endif
#endif
/* Moved from config.h.in because readline.h:rl_message depends on these
defines. */
#if defined (__STDC__) && defined (HAVE_STDARG_H)
# define PREFER_STDARG
# define USE_VARARGS
#else
# if defined (HAVE_VARARGS_H)
# define PREFER_VARARGS
# define USE_VARARGS
# endif
#endif
#endif /* !_RL_STDC_H_ */
+45
View File
@@ -0,0 +1,45 @@
/* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_STDC_H_)
#define _RL_STDC_H_
/* Adapted from BSD /usr/include/sys/cdefs.h. */
/* A function can be defined using prototypes and compile on both ANSI C
and traditional C compilers with something like this:
extern char *func PARAMS((char *, char *, int)); */
#if !defined (PARAMS)
# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
# define PARAMS(protos) protos
# else
# define PARAMS(protos) ()
# endif
#endif
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x)
# endif
#endif
#endif /* !_RL_STDC_H_ */
+1 -13
View File
@@ -1,6 +1,6 @@
/* rltypedefs.h -- Type declarations for readline functions. */
/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
/* Copyright (C) 2000-2011 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -26,18 +26,6 @@
extern "C" {
#endif
/* Old-style */
#if !defined (_FUNCTION_DEF)
# define _FUNCTION_DEF
typedef int Function ();
typedef void VFunction ();
typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
/* New style. */
#if !defined (_RL_FUNCTION_TYPEDEF)
+93
View File
@@ -0,0 +1,93 @@
/* rltypedefs.h -- Type declarations for readline functions. */
/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RL_TYPEDEFS_H_
#define _RL_TYPEDEFS_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Old-style */
#if !defined (_FUNCTION_DEF)
# define _FUNCTION_DEF
typedef int Function ();
typedef void VFunction ();
typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
/* New style. */
#if !defined (_RL_FUNCTION_TYPEDEF)
# define _RL_FUNCTION_TYPEDEF
/* Bindable functions */
typedef int rl_command_func_t PARAMS((int, int));
/* Typedefs for the completion system */
typedef char *rl_compentry_func_t PARAMS((const char *, int));
typedef char **rl_completion_func_t PARAMS((const char *, int, int));
typedef char *rl_quote_func_t PARAMS((char *, int, char *));
typedef char *rl_dequote_func_t PARAMS((char *, int));
typedef int rl_compignore_func_t PARAMS((char **));
typedef void rl_compdisp_func_t PARAMS((char **, int, int));
/* Type for input and pre-read hook functions like rl_event_hook */
typedef int rl_hook_func_t PARAMS((void));
/* Input function type */
typedef int rl_getc_func_t PARAMS((FILE *));
/* Generic function that takes a character buffer (which could be the readline
line buffer) and an index into it (which could be rl_point) and returns
an int. */
typedef int rl_linebuf_func_t PARAMS((char *, int));
/* `Generic' function pointer typedefs */
typedef int rl_intfunc_t PARAMS((int));
#define rl_ivoidfunc_t rl_hook_func_t
typedef int rl_icpfunc_t PARAMS((char *));
typedef int rl_icppfunc_t PARAMS((char **));
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
}
#endif
#endif /* _RL_TYPEDEFS_H_ */
+12 -16
View File
@@ -120,31 +120,27 @@ sh_single_quote (string)
/* Set the environment variables LINES and COLUMNS to lines and cols,
respectively. */
static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
void
sh_set_lines_and_columns (lines, cols)
int lines, cols;
{
char *b;
#if defined (HAVE_SETENV)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
xfree (b);
sprintf (setenv_buf, "%d", lines);
setenv ("LINES", setenv_buf, 1);
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
xfree (b);
sprintf (setenv_buf, "%d", cols);
setenv ("COLUMNS", setenv_buf, 1);
#else /* !HAVE_SETENV */
# if defined (HAVE_PUTENV)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
sprintf (b, "LINES=%d", lines);
putenv (b);
sprintf (putenv_buf1, "LINES=%d", lines);
putenv (putenv_buf1);
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
sprintf (b, "COLUMNS=%d", cols);
putenv (b);
sprintf (putenv_buf2, "COLUMNS=%d", cols);
putenv (putenv_buf2);
# endif /* HAVE_PUTENV */
#endif /* !HAVE_SETENV */
}
+4
View File
@@ -164,7 +164,11 @@ sh_get_home_dir ()
home_dir = (char *)NULL;
#if defined (HAVE_GETPWUID)
# if defined (__TANDEM)
entry = getpwnam (getlogin ());
# else
entry = getpwuid (getuid ());
# endif
if (entry)
home_dir = entry->pw_dir;
#endif
+5 -2
View File
@@ -135,7 +135,10 @@ _rl_signal_handler (sig)
{
_rl_caught_signal = 0; /* XXX */
_rl_handle_signal (sig);
if (sig == SIGWINCH)
rl_resize_terminal ();
else
_rl_handle_signal (sig);
SIGHANDLER_RETURN;
}
@@ -258,7 +261,7 @@ rl_sigwinch_handler (sig)
#endif
RL_SETSTATE(RL_STATE_SIGHANDLER);
rl_resize_terminal ();
_rl_caught_signal = sig;
/* If another sigwinch handler has been installed, call it. */
oh = (SigHandler *)old_winch.sa_handler;
+678
View File
@@ -0,0 +1,678 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h> /* Just for NULL. Yuck. */
#include <sys/types.h>
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (GWINSZ_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#if defined (HANDLE_SIGNALS)
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
# else
# define RETSIGTYPE int
# endif /* !VOID_SIGHANDLER */
#endif /* !RETSIGTYPE */
#if defined (VOID_SIGHANDLER)
# define SIGHANDLER_RETURN return
#else
# define SIGHANDLER_RETURN return (0)
#endif
/* This typedef is equivalent to the one for Function; it allows us
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef RETSIGTYPE SigHandler ();
#if defined (HAVE_POSIX_SIGNALS)
typedef struct sigaction sighandler_cxt;
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
#else
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 *));
static RETSIGTYPE rl_signal_handler PARAMS((int));
static RETSIGTYPE _rl_handle_signal PARAMS((int));
/* Exported variables for use by applications. */
/* If non-zero, readline will install its own signal handlers for
SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
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
/* Private variables. */
int _rl_interrupt_immediately = 0;
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
/* If non-zero, print characters corresponding to received signals as long as
the user has indicated his desire to do so (_rl_echo_control_chars). */
int _rl_echoctl = 0;
int _rl_intr_char = 0;
int _rl_quit_char = 0;
int _rl_susp_char = 0;
static int signals_set_flag;
static int sigwinch_set_flag;
/* **************************************************************** */
/* */
/* Signal Handling */
/* */
/* **************************************************************** */
static sighandler_cxt old_int, old_term, old_hup, old_alrm, old_quit;
#if defined (SIGTSTP)
static sighandler_cxt old_tstp, old_ttou, old_ttin;
#endif
#if defined (SIGWINCH)
static sighandler_cxt old_winch;
#endif
/* Readline signal handler functions. */
/* Called from RL_CHECK_SIGNALS() macro */
RETSIGTYPE
_rl_signal_handler (sig)
int sig;
{
_rl_caught_signal = 0; /* XXX */
if (sig == SIGWINCH)
rl_resize_terminal ();
else
_rl_handle_signal (sig);
SIGHANDLER_RETURN;
}
static RETSIGTYPE
rl_signal_handler (sig)
int sig;
{
if (_rl_interrupt_immediately || RL_ISSTATE(RL_STATE_CALLBACK))
{
_rl_interrupt_immediately = 0;
_rl_handle_signal (sig);
}
else
_rl_caught_signal = sig;
SIGHANDLER_RETURN;
}
static RETSIGTYPE
_rl_handle_signal (sig)
int sig;
{
#if defined (HAVE_POSIX_SIGNALS)
sigset_t set;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
# else /* !HAVE_BSD_SIGNALS */
sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
RL_SETSTATE(RL_STATE_SIGHANDLER);
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
handler, ignore it until rl_clear_signals resets the catcher. */
# if defined (SIGALRM)
if (sig == SIGINT || sig == SIGALRM)
# else
if (sig == SIGINT)
# endif
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
switch (sig)
{
case SIGINT:
_rl_reset_completion_state ();
rl_free_line_state ();
/* FALLTHROUGH */
case SIGTERM:
case SIGHUP:
#if defined (SIGTSTP)
case SIGTSTP:
case SIGTTOU:
case SIGTTIN:
#endif /* SIGTSTP */
#if defined (SIGALRM)
case SIGALRM:
#endif
#if defined (SIGQUIT)
case SIGQUIT:
#endif
rl_echo_signal_char (sig);
rl_cleanup_after_signal ();
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&set);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
sigdelset (&set, sig);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
omask = sigblock (0);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#if defined (__EMX__)
signal (sig, SIG_ACK);
#endif
#if defined (HAVE_KILL)
kill (getpid (), sig);
#else
raise (sig); /* assume we have raise */
#endif
/* Let the signal that we just sent through. */
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (omask & ~(sigmask (sig)));
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
rl_reset_after_signal ();
}
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
#if defined (SIGWINCH)
static RETSIGTYPE
rl_sigwinch_handler (sig)
int sig;
{
SigHandler *oh;
#if defined (MUST_REINSTALL_SIGHANDLERS)
sighandler_cxt dummy_winch;
/* We don't want to change old_winch -- it holds the state of SIGWINCH
disposition set by the calling application. We need this state
because we call the application's SIGWINCH handler after updating
our own idea of the screen size. */
rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
#endif
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_caught_signal = sig;
/* If another sigwinch handler has been installed, call it. */
oh = (SigHandler *)old_winch.sa_handler;
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
(*oh) (sig);
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
#endif /* SIGWINCH */
/* Functions to manage signal handling. */
#if !defined (HAVE_POSIX_SIGNALS)
static int
rl_sigaction (sig, nh, oh)
int sig;
sighandler_cxt *nh, *oh;
{
oh->sa_handler = signal (sig, nh->sa_handler);
return 0;
}
#endif /* !HAVE_POSIX_SIGNALS */
/* Set up a readline-specific signal handler, saving the old signal
information in OHANDLER. Return the old signal handler, like
signal(). */
static SigHandler *
rl_set_sighandler (sig, handler, ohandler)
int sig;
SigHandler *handler;
sighandler_cxt *ohandler;
{
sighandler_cxt old_handler;
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
act.sa_handler = handler;
# if defined (SIGWINCH)
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
# else
act.sa_flags = 0;
# endif /* SIGWINCH */
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, &old_handler);
#else
old_handler.sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
/* XXX -- assume we have memcpy */
/* If rl_set_signals is called twice in a row, don't set the old handler to
rl_signal_handler, because that would cause infinite recursion. */
if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
return (ohandler->sa_handler);
}
static void
rl_maybe_set_sighandler (sig, handler, ohandler)
int sig;
SigHandler *handler;
sighandler_cxt *ohandler;
{
sighandler_cxt dummy;
SigHandler *oh;
sigemptyset (&dummy.sa_mask);
oh = rl_set_sighandler (sig, handler, ohandler);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (sig, ohandler, &dummy);
}
int
rl_set_signals ()
{
sighandler_cxt dummy;
SigHandler *oh;
#if defined (HAVE_POSIX_SIGNALS)
static int sigmask_set = 0;
static sigset_t bset, oset;
#endif
#if defined (HAVE_POSIX_SIGNALS)
if (rl_catch_signals && sigmask_set == 0)
{
sigemptyset (&bset);
sigaddset (&bset, SIGINT);
sigaddset (&bset, SIGTERM);
sigaddset (&bset, SIGHUP);
#if defined (SIGQUIT)
sigaddset (&bset, SIGQUIT);
#endif
#if defined (SIGALRM)
sigaddset (&bset, SIGALRM);
#endif
#if defined (SIGTSTP)
sigaddset (&bset, SIGTSTP);
#endif
#if defined (SIGTTIN)
sigaddset (&bset, SIGTTIN);
#endif
#if defined (SIGTTOU)
sigaddset (&bset, SIGTTOU);
#endif
sigmask_set = 1;
}
#endif /* HAVE_POSIX_SIGNALS */
if (rl_catch_signals && signals_set_flag == 0)
{
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&oset);
sigprocmask (SIG_BLOCK, &bset, &oset);
#endif
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
#if defined (SIGQUIT)
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
#endif
#if defined (SIGALRM)
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
/* If the application using readline has already installed a signal
handler with SA_RESTART, SIGALRM will cause reads to be restarted
automatically, so readline should just get out of the way. Since
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif /* HAVE_POSIX_SIGNALS */
#endif /* SIGALRM */
#if defined (SIGTSTP)
rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
#endif /* SIGTSTP */
#if defined (SIGTTOU)
rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
#endif /* SIGTTOU */
#if defined (SIGTTIN)
rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
#endif /* SIGTTIN */
signals_set_flag = 1;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
#endif
}
#if defined (SIGWINCH)
if (rl_catch_sigwinch && sigwinch_set_flag == 0)
{
rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
sigwinch_set_flag = 1;
}
#endif /* SIGWINCH */
return 0;
}
int
rl_clear_signals ()
{
sighandler_cxt dummy;
if (rl_catch_signals && signals_set_flag == 1)
{
sigemptyset (&dummy.sa_mask);
rl_sigaction (SIGINT, &old_int, &dummy);
rl_sigaction (SIGTERM, &old_term, &dummy);
rl_sigaction (SIGHUP, &old_hup, &dummy);
#if defined (SIGQUIT)
rl_sigaction (SIGQUIT, &old_quit, &dummy);
#endif
#if defined (SIGALRM)
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif
#if defined (SIGTSTP)
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
#endif /* SIGTSTP */
#if defined (SIGTTOU)
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
#endif /* SIGTTOU */
#if defined (SIGTTIN)
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
#endif /* SIGTTIN */
signals_set_flag = 0;
}
#if defined (SIGWINCH)
if (rl_catch_sigwinch && sigwinch_set_flag == 1)
{
sigemptyset (&dummy.sa_mask);
rl_sigaction (SIGWINCH, &old_winch, &dummy);
sigwinch_set_flag = 0;
}
#endif
return 0;
}
/* Clean up the terminal and readline state after catching a signal, before
resending it to the calling application. */
void
rl_cleanup_after_signal ()
{
_rl_clean_up_for_exit ();
if (rl_deprep_term_function)
(*rl_deprep_term_function) ();
rl_clear_pending_input ();
rl_clear_signals ();
}
/* Reset the terminal and readline state after a signal handler returns. */
void
rl_reset_after_signal ()
{
if (rl_prep_term_function)
(*rl_prep_term_function) (_rl_meta_flag);
rl_set_signals ();
}
/* Free up the readline variable line state for the current line (undo list,
any partial history entry, any keyboard macros in progress, and any
numeric arguments in process) after catching a signal, before calling
rl_cleanup_after_signal(). */
void
rl_free_line_state ()
{
register HIST_ENTRY *entry;
rl_free_undo_list ();
entry = current_history ();
if (entry)
entry->data = (char *)NULL;
_rl_kill_kbd_macro ();
rl_clear_message ();
_rl_reset_argument ();
}
#endif /* HANDLE_SIGNALS */
/* **************************************************************** */
/* */
/* SIGINT Management */
/* */
/* **************************************************************** */
#if defined (HAVE_POSIX_SIGNALS)
static sigset_t sigint_set, sigint_oset;
static sigset_t sigwinch_set, sigwinch_oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
static int sigint_oldmask;
static int sigwinch_oldmask;
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
static int sigint_blocked;
static int sigwinch_blocked;
/* Cause SIGINT to not be delivered until the corresponding call to
release_sigint(). */
void
_rl_block_sigint ()
{
if (sigint_blocked)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&sigint_set);
sigemptyset (&sigint_oset);
sigaddset (&sigint_set, SIGINT);
sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigint_oldmask = sigblock (sigmask (SIGINT));
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sighold (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 1;
}
/* Allow SIGINT to be delivered. */
void
_rl_release_sigint ()
{
if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (sigint_oldmask);
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sigrelse (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 0;
}
/* Cause SIGWINCH to not be delivered until the corresponding call to
release_sigwinch(). */
void
_rl_block_sigwinch ()
{
if (sigwinch_blocked)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&sigwinch_set);
sigemptyset (&sigwinch_oset);
sigaddset (&sigwinch_set, SIGWINCH);
sigprocmask (SIG_BLOCK, &sigwinch_set, &sigwinch_oset);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigwinch_oldmask = sigblock (sigmask (SIGWINCH));
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sighold (SIGWINCH);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigwinch_blocked = 1;
}
/* Allow SIGWINCH to be delivered. */
void
_rl_release_sigwinch ()
{
if (sigwinch_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (sigwinch_oldmask);
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sigrelse (SIGWINCH);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigwinch_blocked = 0;
}
/* **************************************************************** */
/* */
/* Echoing special control characters */
/* */
/* **************************************************************** */
void
rl_echo_signal_char (sig)
int sig;
{
char cstr[3];
int cslen, c;
if (_rl_echoctl == 0 || _rl_echo_control_chars == 0)
return;
switch (sig)
{
case SIGINT: c = _rl_intr_char; break;
#if defined (SIGQUIT)
case SIGQUIT: c = _rl_quit_char; break;
#endif
#if defined (SIGTSTP)
case SIGTSTP: c = _rl_susp_char; break;
#endif
default: return;
}
if (CTRL_CHAR (c) || c == RUBOUT)
{
cstr[0] = '^';
cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
cstr[cslen = 2] = '\0';
}
else
{
cstr[0] = c;
cstr[cslen = 1] = '\0';
}
_rl_output_some_chars (cstr, cslen);
}
+9 -2
View File
@@ -296,7 +296,8 @@ _rl_get_screen_size (tty, ignore_env)
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (ignore_env == 0)
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
@@ -346,7 +347,13 @@ rl_reset_screen_size ()
{
_rl_get_screen_size (fileno (rl_instream), 0);
}
void
_rl_sigwinch_resize_terminal ()
{
_rl_get_screen_size (fileno (rl_instream), 1);
}
void
rl_resize_terminal ()
{
+739
View File
@@ -0,0 +1,739 @@
/* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
#include "rltty.h"
#include "tcap.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
#if defined (__MINGW32__)
# include <windows.h>
# include <wincon.h>
static void _win_get_screensize PARAMS((int *, int *));
#endif
#if defined (__EMX__)
static void _emx_get_screensize PARAMS((int *, int *));
#endif
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
/* If the calling application sets this to a non-zero value, readline will
use the $LINES and $COLUMNS environment variables to set its idea of the
window size before interrogating the kernel. */
int rl_prefer_env_winsize = 0;
/* **************************************************************** */
/* */
/* Terminal and Termcap */
/* */
/* **************************************************************** */
static char *term_buffer = (char *)NULL;
static char *term_string_buffer = (char *)NULL;
static int tcap_initialized;
#if !defined (__linux__) && !defined (NCURSES_VERSION)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif /* __EMX__ || NEED_EXTERN_PC */
char PC, *BC, *UP;
#endif /* !__linux__ && !NCURSES_VERSION */
/* Some strings to control terminal actions. These are output by tputs (). */
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. */
char *_rl_term_im;
char *_rl_term_ei;
char *_rl_term_ic;
char *_rl_term_ip;
char *_rl_term_IC;
/* How to delete characters. */
char *_rl_term_dc;
char *_rl_term_DC;
char *_rl_term_forward_char;
/* How to go up a line. */
char *_rl_term_up;
/* A visible bell; char if the terminal can be made to flash the screen. */
static char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap = -1;
/* Non-zero means that this terminal has a meta key. */
static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static char *_rl_term_mm;
static char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
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 char *_rl_term_ks;
static char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
static char *_rl_term_kh;
static char *_rl_term_kH;
static char *_rl_term_at7; /* @7 */
/* Delete key */
static char *_rl_term_kD;
/* Insert key */
static char *_rl_term_kI;
/* Cursor control */
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
static void bind_termcap_arrow_keys PARAMS((Keymap));
/* Variables that hold the screen dimensions, used by the display code. */
int _rl_screenwidth, _rl_screenheight, _rl_screenchars;
/* Non-zero means the user wants to enable the keypad. */
int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
#if defined (__EMX__)
static void
_emx_get_screensize (swp, shp)
int *swp, *shp;
{
int sz[2];
_scrsize (sz);
if (swp)
*swp = sz[0];
if (shp)
*shp = sz[1];
}
#endif
#if defined (__MINGW32__)
static void
_win_get_screensize (swp, shp)
int *swp, *shp;
{
HANDLE hConOut;
CONSOLE_SCREEN_BUFFER_INFO scr;
hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
if (hConOut != INVALID_HANDLE_VALUE)
{
if (GetConsoleScreenBufferInfo (hConOut, &scr))
{
*swp = scr.dwSize.X;
*shp = scr.srWindow.Bottom - scr.srWindow.Top + 1;
}
}
}
#endif
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
non-null serve to check whether or not we have initialized termcap. */
void
_rl_get_screen_size (tty, ignore_env)
int tty, ignore_env;
{
char *ss;
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
int wr, wc;
wr = wc = -1;
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
_emx_get_screensize (&wc, &wr);
#elif defined (__MINGW32__)
_win_get_screensize (&wc, &wr);
#endif
if (ignore_env || rl_prefer_env_winsize == 0)
{
_rl_screenwidth = wc;
_rl_screenheight = wr;
}
else
_rl_screenwidth = _rl_screenheight = -1;
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
is unset. If we prefer the environment, check it first before
assigning the value returned by the kernel. */
if (_rl_screenwidth <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
_rl_screenwidth = atoi (ss);
if (_rl_screenwidth <= 0)
_rl_screenwidth = wc;
#if !defined (__DJGPP__)
if (_rl_screenwidth <= 0 && term_string_buffer)
_rl_screenwidth = tgetnum ("co");
#endif
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
is unset. */
if (_rl_screenheight <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("LINES")))
_rl_screenheight = atoi (ss);
if (_rl_screenheight <= 0)
_rl_screenheight = wr;
#if !defined (__DJGPP__)
if (_rl_screenheight <= 0 && term_string_buffer)
_rl_screenheight = tgetnum ("li");
#endif
}
/* If all else fails, default to 80x24 terminal. */
if (_rl_screenwidth <= 1)
_rl_screenwidth = 80;
if (_rl_screenheight <= 0)
_rl_screenheight = 24;
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
if (ignore_env == 0)
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
_rl_set_screen_size (rows, cols)
int rows, cols;
{
if (_rl_term_autowrap == -1)
_rl_init_terminal_io (rl_terminal_name);
if (rows > 0)
_rl_screenheight = rows;
if (cols > 0)
{
_rl_screenwidth = cols;
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
}
if (rows > 0 || cols > 0)
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
rl_set_screen_size (rows, cols)
int rows, cols;
{
_rl_set_screen_size (rows, cols);
}
void
rl_get_screen_size (rows, cols)
int *rows, *cols;
{
if (rows)
*rows = _rl_screenheight;
if (cols)
*cols = _rl_screenwidth;
}
void
rl_reset_screen_size ()
{
_rl_get_screen_size (fileno (rl_instream), 0);
}
void
_rl_sigwinch_resize_terminal ()
{
_rl_get_screen_size (fileno (rl_instream), 1);
}
void
rl_resize_terminal ()
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (_rl_echoing_p)
{
if (CUSTOM_REDISPLAY_FUNC ())
rl_forced_update_display ();
else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
_rl_redisplay_after_sigwinch ();
}
}
struct _tc_string {
const char * const tc_var;
char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "DC", &_rl_term_DC },
{ "IC", &_rl_term_IC },
{ "ce", &_rl_term_clreol },
{ "cl", &_rl_term_clrpag },
{ "cr", &_rl_term_cr },
{ "dc", &_rl_term_dc },
{ "ei", &_rl_term_ei },
{ "ic", &_rl_term_ic },
{ "im", &_rl_term_im },
{ "kD", &_rl_term_kD }, /* delete */
{ "kH", &_rl_term_kH }, /* home down ?? */
{ "kI", &_rl_term_kI }, /* insert */
{ "kd", &_rl_term_kd },
{ "ke", &_rl_term_ke }, /* end keypad mode */
{ "kh", &_rl_term_kh }, /* home */
{ "kl", &_rl_term_kl },
{ "kr", &_rl_term_kr },
{ "ks", &_rl_term_ks }, /* start keypad mode */
{ "ku", &_rl_term_ku },
{ "le", &_rl_term_backspace },
{ "mm", &_rl_term_mm },
{ "mo", &_rl_term_mo },
{ "nd", &_rl_term_forward_char },
{ "pc", &_rl_term_pc },
{ "up", &_rl_term_up },
{ "vb", &_rl_visible_bell },
{ "vs", &_rl_term_vs },
{ "ve", &_rl_term_ve },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
/* Read the desired terminal capability strings into BP. The capabilities
are described in the TC_STRINGS table. */
static void
get_term_capabilities (bp)
char **bp;
{
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
#endif
tcap_initialized = 1;
}
int
_rl_init_terminal_io (terminal_name)
const char *terminal_name;
{
const char *term;
char *buffer;
int tty, tgetent_ret;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = (char *)NULL;
tty = rl_instream ? fileno (rl_instream) : 0;
if (term == 0)
term = "dumb";
/* I've separated this out for later work on not calling tgetent at all
if the calling application has supplied a custom redisplay function,
(and possibly if the application has supplied a custom input function). */
if (CUSTOM_REDISPLAY_FUNC())
{
tgetent_ret = -1;
}
else
{
if (term_string_buffer == 0)
term_string_buffer = (char *)xmalloc(2032);
if (term_buffer == 0)
term_buffer = (char *)xmalloc(4080);
buffer = term_string_buffer;
tgetent_ret = tgetent (term_buffer, term);
}
if (tgetent_ret <= 0)
{
FREE (term_string_buffer);
FREE (term_buffer);
buffer = term_buffer = term_string_buffer = (char *)NULL;
_rl_term_autowrap = 0; /* used by _rl_get_screen_size */
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
#if defined (__EMX__)
_emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
_rl_screenwidth--;
#else /* !__EMX__ */
_rl_get_screen_size (tty, 0);
#endif /* !__EMX__ */
}
/* Defaults. */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
_rl_screenwidth = 79;
_rl_screenheight = 24;
}
/* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
_rl_term_cr = "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_kI = _rl_term_kD = (char *)NULL;
_rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = 0;
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC = '\0';
BC = _rl_term_backspace = "\b";
UP = _rl_term_up;
return 0;
}
get_term_capabilities (&buffer);
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = _rl_term_backspace;
UP = _rl_term_up;
if (!_rl_term_cr)
_rl_term_cr = "\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
_rl_get_screen_size (tty, 0);
/* "An application program can assume that the terminal can do
character insertion if *any one of* the capabilities `IC',
`im', `ic' or `ip' is provided." But we can't do anything if
only `ip' is provided, so... */
_rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = tgetflag ("km") != 0;
if (term_has_meta == 0)
_rl_term_mm = _rl_term_mo = (char *)NULL;
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
bind_termcap_arrow_keys (emacs_standard_keymap);
#if defined (VI_MODE)
bind_termcap_arrow_keys (vi_movement_keymap);
bind_termcap_arrow_keys (vi_insertion_keymap);
#endif /* VI_MODE */
return 0;
}
/* Bind the arrow key sequences from the termcap description in MAP. */
static void
bind_termcap_arrow_keys (map)
Keymap map;
{
Keymap xkeymap;
xkeymap = _rl_keymap;
_rl_keymap = map;
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_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_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
_rl_keymap = xkeymap;
}
char *
rl_get_termcap (cap)
const char *cap;
{
register int i;
if (tcap_initialized == 0)
return ((char *)NULL);
for (i = 0; i < NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);
}
return ((char *)NULL);
}
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */
int
rl_reset_terminal (terminal_name)
const char *terminal_name;
{
_rl_screenwidth = _rl_screenheight = 0;
_rl_init_terminal_io (terminal_name);
return 0;
}
/* A function for the use of tputs () */
#ifdef _MINIX
void
_rl_output_character_function (c)
int c;
{
putc (c, _rl_out_stream);
}
#else /* !_MINIX */
int
_rl_output_character_function (c)
int c;
{
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
const char *string;
int count;
{
fwrite (string, 1, count, _rl_out_stream);
}
/* Move the cursor back. */
int
_rl_backspace (count)
int count;
{
register int i;
if (_rl_term_backspace)
for (i = 0; i < count; i++)
tputs (_rl_term_backspace, 1, _rl_output_character_function);
else
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
}
/* Move to the start of the next line. */
int
rl_crlf ()
{
#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER || __MINT__ */
putc ('\n', _rl_out_stream);
return 0;
}
/* Ring the terminal bell. */
int
rl_ding ()
{
if (_rl_echoing_p)
{
switch (_rl_bell_preference)
{
case NO_BELL:
default:
break;
case VISIBLE_BELL:
if (_rl_visible_bell)
{
tputs (_rl_visible_bell, 1, _rl_output_character_function);
break;
}
/* FALLTHROUGH */
case AUDIBLE_BELL:
fprintf (stderr, "\007");
fflush (stderr);
break;
}
return (0);
}
return (-1);
}
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
/* */
/* **************************************************************** */
void
_rl_enable_meta_key ()
{
#if !defined (__DJGPP__)
if (term_has_meta && _rl_term_mm)
tputs (_rl_term_mm, 1, _rl_output_character_function);
#endif
}
void
_rl_control_keypad (on)
int on;
{
#if !defined (__DJGPP__)
if (on && _rl_term_ks)
tputs (_rl_term_ks, 1, _rl_output_character_function);
else if (!on && _rl_term_ke)
tputs (_rl_term_ke, 1, _rl_output_character_function);
#endif
}
/* **************************************************************** */
/* */
/* Controlling the Cursor */
/* */
/* **************************************************************** */
/* Set the cursor appropriately depending on IM, which is one of the
insert modes (insert or overwrite). Insert mode gets the normal
cursor. Overwrite mode gets a very visible cursor. Only does
anything if we have both capabilities. */
void
_rl_set_cursor (im, force)
int im, force;
{
if (_rl_term_ve && _rl_term_vs)
{
if (force || im != rl_insert_mode)
{
if (im == RL_IM_OVERWRITE)
tputs (_rl_term_vs, 1, _rl_output_character_function);
else
tputs (_rl_term_ve, 1, _rl_output_character_function);
}
}
}
+1 -1
View File
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 7
#define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
+1 -1
View File
@@ -1,2 +1,2 @@
# Set of available languages.
en@quot en@boldquot af bg ca cs de eo es et fi fr ga hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
+5316
View File
File diff suppressed because it is too large Load Diff
+710 -1433
View File
File diff suppressed because it is too large Load Diff
+445 -26
View File
@@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: bash 4.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-28 22:09-0500\n"
"PO-Revision-Date: 2011-03-14 19:41+0100\n"
"PO-Revision-Date: 2011-03-20 12:53+0100\n"
"Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
"Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
"Language: pl\n"
@@ -677,8 +677,8 @@ msgstr ""
" -N\tRotacja stosu czyni±ca jego wierzcho³kiem N-ty katalog (licz±c\n"
" \tod prawej strony listy wypisywanej przez `dirs', pocz±wszy od zera).\n"
" \n"
" dir\tUmieszczenie DIR na wierzcho³ku stosu i uczynienie go nowym\n"
" \tbie¿±cym katalogiem roboczym.\n"
" katalog\tUmieszczenie KATALOGU na wierzcho³ku stosu i uczynienie go\n"
" \tnowym bie¿±cym katalogiem roboczym.\n"
" \n"
" Zawarto¶æ stosu katalogów mo¿na zobaczyæ za pomoc± polecenia `dirs'."
@@ -724,7 +724,7 @@ msgstr ""
#: builtins/read.def:252
#, c-format
msgid "%s: invalid timeout specification"
msgstr "%s: nieprawid³owo okre¶lony timeout"
msgstr "%s: nieprawid³owo okre¶lony limit czasu"
#: builtins/read.def:588
#, c-format
@@ -1455,7 +1455,7 @@ msgstr "deskryptor pliku poza zakresem"
#: redir.c:178
#, c-format
msgid "%s: ambiguous redirect"
msgstr "%s: nieojednoznaczne przekierowanie"
msgstr "%s: niejednoznaczne przekierowanie"
#: redir.c:182
#, c-format
@@ -2100,7 +2100,7 @@ msgstr "let arg [arg ...]"
#: builtins.c:136
msgid "read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]"
msgstr "read [-ers] [-a tablica] [-d separator] [-i tekst] [-n lznaków] [-N lznaków] [-p zachêta] [-t czas] [-u fd] [nazwa ...]"
msgstr "read [-ers] [-a tablica] [-d separator] [-i tekst] [-n liczba] [-N liczba] [-p zachêta] [-t czas] [-u fd] [nazwa ...]"
#: builtins.c:138
msgid "return [n]"
@@ -2380,7 +2380,8 @@ msgstr ""
" ich warto¶ci.\n"
" -s Wypisanie sekwencji klawiszy wywo³uj±cych makra oraz\n"
" ich warto¶ci w postaci nadaj±cej siê do u¿ycia jako\n"
" dane wej¶ciowe. -V Wypisanie nazw zmiennych i ich warto¶ci.\n"
" dane wej¶ciowe.\n"
" -V Wypisanie nazw zmiennych i ich warto¶ci.\n"
" -v Wypisanie nazw zmiennych i ich warto¶ci w postaci\n"
" nadaj±cej siê do u¿ycia jako dane wej¶ciowe.\n"
" -q nazwa-funkcji Okre¶lenie, które klawisze wywo³uj± zadan± funkcjê.\n"
@@ -2475,7 +2476,8 @@ msgstr ""
" ¶ladu stosu.\n"
" \n"
" Warto¶æ WYRA¯ENIA okre¶la o ile ramek wywo³añ wzglêdem bie¿±cej ramki\n"
" nale¿y siê cofn±æ; numer najwy¿szej ramki to 0. \n"
" nale¿y siê cofn±æ; numer najwy¿szej ramki to 0.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Polecenie zwraca 0, chyba ¿e pow³oka nie wykonuje funkcji lub WYRA¯ENIE\n"
" jest nieprawid³owe."
@@ -2522,7 +2524,7 @@ msgstr ""
" \n"
" Gdy katalog nie zostanie znaleziony, a ustawiona jest zmienna pow³oki\n"
" `cdable_vars', to nastêpuje próba u¿ycia podanej nazwy jako nazwy zmiennej.\n"
" Je¶li zmienna ta ma warto¶æ, to jako KATALOG jest u¿ywana jej wartosæ.\n"
" Je¶li zmienna ta ma warto¶æ, to jako KATALOG jest u¿ywana jej wartoæ.\n"
" \n"
" Opcje:\n"
" -L\twymuszenie ¶ledzenia dowi±zañ symbolicznych\n"
@@ -2776,7 +2778,7 @@ msgid ""
msgstr ""
"Wypisanie argumentów na standardowym wyj¶ciu.\n"
" \n"
" Wypisanie na standardowym wyj¶ciu ARGumentów oraz znaku koñca linii.\n"
" Wypisanie na standardowym wyj¶ciu argumentów ARG oraz znaku koñca linii.\n"
" \n"
" Opcje:\n"
" -n\tniedo³±czanie znaku koñca linii\n"
@@ -2818,7 +2820,7 @@ msgid ""
msgstr ""
"Wypisanie argumentów na standardowym wyj¶ciu.\n"
" \n"
" Wypisanie na standardowym wyj¶ciu ARGumentów i znaku koñca linii.\n"
" Wypisanie na standardowym wyj¶ciu argumentów ARG i znaku koñca linii.\n"
" \n"
" Opcje:\n"
" -n\tniedo³±czanie znaku koñca linii\n"
@@ -2889,7 +2891,7 @@ msgid ""
msgstr ""
"Wykonanie argumentów jako polecenia pow³oki.\n"
" \n"
" Po³±czenie ARGumentów w pojedynczy ³añcuch, u¿ycie rezultatu jako\n"
" Po³±czenie argumentów ARG w pojedynczy ³añcuch, u¿ycie rezultatu jako\n"
" wej¶cia dla pow³oki i wykonanie wynikowych poleceñ.\n"
" \n"
" Stan wyj¶ciowy:\n"
@@ -2936,6 +2938,43 @@ msgid ""
" Returns success if an option is found; fails if the end of options is\n"
" encountered or an error occurs."
msgstr ""
"Analiza opcji z argumentów.\n"
" \n"
" Polecenie getopts jest u¿ywane przez procedury pow³oki przy analizowaniu\n"
" parametrów pozycyjnych jako opcji.\n"
" \n"
" £AÑCUCH-OPCJI zawiera litery opcji, które maj± byæ rozpoznane; je¶li po\n"
" literze nastêpuje dwukropek, opcja wymaga argumentu, który powinien byæ\n"
" oddzielony od opcji spacj±.\n"
" \n"
" Przy ka¿dym wywo³aniu getopts umieszcza nastêpn± opcjê w zmiennej pow³oki\n"
" $nazwa, inicjuj±c j±, je¶li nie istnieje; natomiast indeks nastêpnego\n"
" argumentu do przetworzenia jest umieszczany w zmiennej pow³oki OPTIND\n"
" OPTIND jest inicjowany warto¶ci± 1 przy ka¿dym wywo³aniu pow³oki lub\n"
" skryptu pow³oki. Je¶li opcja wymaga argumentu, getopts umieszcza ten\n"
" argument w zmiennej pow³oki OPTARG.\n"
" \n"
" getopts zg³asza b³êdy na jeden z dwóch sposobów. Je¶li pierwszy znak\n"
" £AÑCUCHA-OPCJI jest dwukropkiem, getopts wykorzystuje ciche zg³aszanie\n"
" b³êdów. W tym trybie komunikaty b³êdów nie s± wypisywane. Je¶li napotkana\n"
" zostanie b³êdna opcja, getopts umieszcza znak opcji w OPTARG. Je¶li\n"
" nie znaleziono wymaganego argumentu, getopts umieszcza znak ':' w NAZWIE\n"
" i ustawia OPTARG na napotkany znak opcji. Je¶li getopts nie jest w trybie\n"
" cichym i napotkana zostanie b³êdna opcja, getopts umieszcza znak '?'\n"
" w NAZWIE i anuluje OPTARG. Je¶li nie znaleziono wymaganego argumentu,\n"
" w NAZWIE umieszczany jest znak '?', OPTARG jest anulowany i wypisywany\n"
" jest komunikat diagnostyczny.\n"
" \n"
" Je¶li zmienna pow³oki OPTERR ma warto¶æ 0, getopts wy³±cza wypisywanie\n"
" komunikatów b³êdów, nawet je¶li pierwszym znakiem £AÑCUCHA-OPCJI nie jest\n"
" dwukropek. OPTERR domy¶lnie ma warto¶æ 1.\n"
" \n"
" Polecenie getopts normalnie przetwarza parametry pozycyjne ($0 - $9), ale\n"
" je¶li podano wiêcej argumentów, s± one przetwarzane zamiast nich.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, je¶li napotkano opcjê; fa³sz, je¶li wyst±pi koniec\n"
" opcji lub b³±d."
#: builtins.c:673
msgid ""
@@ -3026,7 +3065,7 @@ msgid ""
msgstr ""
"Wy¶wietlanie lub wykonywanie poleceñ z listy historii.\n"
" \n"
" fc s³u¿y do wypisywania, edycji i pomownego uruchamiania poleceñ z listy\n"
" fc s³u¿y do wypisywania, edycji i ponownego uruchamiania poleceñ z listy\n"
" historii. PIERWSZY i OSTATNI jako liczby okre¶laj± zakres lub PIERWSZY\n"
" jako napis oznacza najpó¼niej wykonywane polecenie zaczynaj±ce siê od tego\n"
" napisu.\n"
@@ -3035,7 +3074,7 @@ msgstr ""
" -e NAZWA-ED\tokre¶la edytor, który ma byæ u¿ywany. Domy¶lnymi\n"
" \twarto¶ciami s±: najpierw FCEDIT, potem EDITOR, a na koñcu vi\n"
" -l\twypisywanie wierszy zamiast ich edycji\n"
" -n\tniewypisysanie numerów wierszy\n"
" -n\tniewypisywanie numerów wierszy\n"
" -r\todwrócenie kolejno¶ci wierszy (czyni±c najnowsze wypisane\n"
" \tpolecenie pierwszym)\n"
" \n"
@@ -3044,7 +3083,8 @@ msgstr ""
" \n"
" Przydatnym aliasem korzystaj±cym z tego jest r='fc -s' tak, ¿e napisanie\n"
" `r cc' uruchamia ostatnie polecenie zaczynaj±ce siê od `cc', a napisanie\n"
" `r' uruchamia ponownie ostatnie polecenie. \n"
" `r' uruchamia ponownie ostatnie polecenie.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda lub stan wykonanego polecenia; warto¶æ niezerowa\n"
" w przypadku b³êdu."
@@ -3113,6 +3153,26 @@ msgid ""
" Exit Status:\n"
" Returns success unless NAME is not found or an invalid option is given."
msgstr ""
"Zapamiêtanie lub wypisanie po³o¿enia programów.\n"
" \n"
" Okre¶lenie i zapamiêtanie pe³nej ¶cie¿ki ka¿dego polecenia NAZWA. Je¶li\n"
" nie podano argumentów, wy¶wietlane s± informacje o zapamiêtanych\n"
" poleceniach.\n"
" \n"
" Opcje:\n"
" -d\t\tzapomnienie po³o¿enia ka¿dej NAZWY\n"
" -l\t\twypisanie w formacie do wykorzystania jako wej¶cie\n"
" -p ¶cie¿ka\tu¿ycie ¦CIE¯KI jako pe³nej ¶cie¿ki NAZWY\n"
" -r\t\tzapomnienie wszystkich pamiêtanych po³o¿eñ\n"
" -t\t\twypisanie pamiêtanych po³o¿eñ ka¿dej NAZWY poprzedzaj±c\n"
" \t\tka¿de po³o¿enie odpowiedni± NAZW¡, je¶li podano wiele NAZW\n"
" Argumenty:\n"
" NAZWA\t\tKa¿da nazwa jest wyszukiwana w $PATH i dodawana do listy\n"
" \t\tpamiêtanych poleceñ.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e nie znaleziono NAZWY lub podano b³êdn±\n"
" opcjê."
#: builtins.c:797
msgid ""
@@ -3134,6 +3194,24 @@ msgid ""
" Exit Status:\n"
" Returns success unless PATTERN is not found or an invalid option is given."
msgstr ""
"Wy¶wietlenie informacji o poleceniach wbudowanych.\n"
" \n"
" Wy¶wietlenie krótkiego przegl±du poleceñ wbudowanych. Je¶li podano\n"
" WZORZEC, wypisywany jest szczegó³owy opis wszystkich poleceñ pasuj±cych do\n"
" WZORCA, w przeciwnym wypadku - lista tematów.\n"
" \n"
" Opcje:\n"
" -d\twypisanie krótkiego opisu ka¿dego tematu\n"
" -m\twy¶wietlenie sposobu u¿ycia w formacie zbli¿onym do stron man\n"
" -s\twypisanie tylko krótkiej informacji o sk³adni dla ka¿dego\n"
" \ttematu pasuj±cego do WZORCA\n"
" \n"
" Argumenty:\n"
" WZORZEC\tWzorzec okre¶laj±cy temat pomocy\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e WZORCA nie znaleziono lub podano b³êdn±\n"
" opcjê."
#: builtins.c:821
msgid ""
@@ -3167,6 +3245,38 @@ msgid ""
" Exit Status:\n"
" Returns success unless an invalid option is given or an error occurs."
msgstr ""
"Wy¶wietlanie i modyfikowanie listy historii.\n"
" \n"
" Wy¶wietlanie listy historii z numerami linii z oznaczeniem ka¿dej\n"
" zmodyfikowanej linii przedrostkiem `*'. Podanie argumentu N wypisuje\n"
" tylko ostatnich N wpisów.\n"
" \n"
" Opcje:\n"
" -c\twyczyszczenie listy historii poprzez usuniêcie wszystkich wpisów\n"
" -d offset\tusuniêcie wpisu historii o podanym OFFSECIE\n"
" \n"
" -a\tdo³±czenie linii historii z tej sesji do pliku historii\n"
" -n\todczyt wszystkich jeszcze nie przeczytanych linii z pliku\n"
" \thistorii\n"
" -r\todczyt pliku historii i do³±czenie zawarto¶ci do listy historii\n"
" -w\tzapis bie¿±cej historii do pliku historii\n"
" \n"
" -p\trozwiniêcie wg historii ka¿dego ARG i wypisanie wyniku bez\n"
" \tzapisywania go na li¶cie historii\n"
" -s\tdo³±czenie wszystkich ARG do listy historii jako pojedynczych\n"
" \twpisów\n"
" \n"
" Je¶li podano PLIK, jest u¿ywany jako plik historii. W przeciwnym wypadku\n"
" u¿ywany jest $HISTFILE, a je¶li ta zmienna nie jest ustawiona -\n"
" ~/.bash_history.\n"
" \n"
" Je¶li zmienna $HISTTIMEFORMAT jest ustawiona i niepusta, jej warto¶æ jest\n"
" u¿ywana jako ³añcuch formatuj±cy dla strftime(3) do wypisywania momentu\n"
" czasu powi±zanego z ka¿dym wypisywanym wpisem. W przeciwnym wypadku czas\n"
" nie jest wypisywany.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub wyst±pi b³±d."
#: builtins.c:857
msgid ""
@@ -3205,8 +3315,8 @@ msgstr ""
" -s\tograniczenie wyj¶cia do zadañ zatrzymanych\n"
" \n"
" Przy podaniu -x, uruchamiane jet polecenie podane POLECENIE po zast±pieniu\n"
" ka¿dej z wystêpuj±cych w ARGumentach specyfikacji zadañ numerem PID procesu\n"
" wiod±cego danego zadania.\n"
" ka¿dej z wystêpuj±cych w argumentach ARG specyfikacji zadañ numerem PID\n"
" procesu wiod±cego danego zadania.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub wyst±pi b³±d.\n"
@@ -3278,7 +3388,8 @@ msgstr ""
" Kill jest poleceniem wewnêtrznym z dwóch powodów: umo¿liwia korzystanie\n"
" z identyfikatorów zadañ zamiast numerów PID oraz, w przypadku osi±gniêcia\n"
" ograniczenia na liczbê procesów, nie powoduje potrzeby uruchamiania\n"
" dodatkowego procesu, aby jaki¶ zabiæ. \n"
" dodatkowego procesu, aby jaki¶ zabiæ.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracany jest sukces, chyba ¿e podano b³êdn± opcjê lub wyst±pi b³±d."
@@ -3327,7 +3438,7 @@ msgid ""
msgstr ""
"Obliczanie wyra¿eñ arytmetycznych.\n"
" \n"
" Obliczenie ka¿dego ARGumentu jako wyra¿enia arytmetycznego. Obliczenia\n"
" Obliczenie ka¿dego argumentu ARG jako wyra¿enia arytmetycznego. Obliczenia\n"
" s± wykonywane dla liczb ca³kowitych o sta³ej d³ugo¶ci bez sprawdzania\n"
" przepe³nienia, jednak¿e dzielenie przez 0 jest przechwytywane i oznaczane\n"
" jako b³±d. Poni¿sza lista operatorów jest pogrupowana na poziomy\n"
@@ -3409,6 +3520,46 @@ msgid ""
" The return code is zero, unless end-of-file is encountered, read times out,\n"
" or an invalid file descriptor is supplied as the argument to -u."
msgstr ""
"Odczyt wiersza ze standardowego wej¶cia i podzia³ go na pola.\n"
" \n"
" Odczytanie wiersza ze standardowego wej¶cia lub deskryptora FD (je¶li\n"
" podano opcjê -u). Wiersz jest dzielony na pola wg regu³ podzia³u na s³owa,\n"
" pierwsze s³owo jest przypisywane pierwszej NAZWIE, drugie - drugiej NAZWIE\n"
" itd.; wszystkie pozosta³e s³owa s± przypisywane ostatniej NAZWIE. Jako\n"
" ograniczniki s³ów s± rozpoznawane tylko znaki ze zmiennej $IFS.\n"
" \n"
" Je¶li nie podano NAZW, odczytany wiersz jest zapisywany w zmiennej REPLY.\n"
" \n"
" Opcje:\n"
" -a tablica\tprzypisanie odczytanych s³ów do indeksów sekwencyjnych\n"
" \t\tzmiennej tablicowej TABLICA, pocz±wszy od zera\n"
" -d ogr\tkontynuacja do odczytu pierwszego znaku OGR zamiast znaku nowej\n"
" \t\tlinii\n"
" -e\t\tu¿ycie Readline'a do odczytania wiersza w pow³oce interaktywnej\n"
" -o tekst\tu¿ycie TEKSTU jako pocz±tkowego tekstu dla Readline'a\n"
" -n liczba\tpowrót po odczycie LICZBY znaków zamiast oczekiwania na\n"
" \t\tznak nowej linii; ogranicznik jest honorowany, je¶li odczytano mniej\n"
" \t\tni¿ podana LICZBA znaków przed ogranicznikiem\n"
" -N liczba\tpowrót tylko po odczycie dok³adnie podanej LICZBY znaków,\n"
" \t\tchyba ¿e zostanie napotkany EOF lub op³ynie czas; ograniczniki s±\n"
" \t\tignorowane\n"
" -p zachêta\twypisanie ³añcucha ZACHÊTY bez koñcowego znaku nowej linii\n"
" \t\tprzed prób± odczytu\n"
" -r\t\twy³±czenie interpretowania odwrotnych uko¶ników jako przedrostka\n"
" \t\tznaków specjalnych\n"
" -s\t\tbez wypisywania wej¶cia pochodz±cego z terminala\n"
" -t czas\tzakoñczenie i zwrócenie niepowodzenia, je¶li nie zostanie\n"
" \t\todczytany ca³y wiersz przed up³yniêciem podanego CZASU (w sekundach).\n"
" \t\tWarto¶æ zmiennej TMOUT jest domy¶lnym limitem czasu. CZAS mo¿e byæ\n"
" \t\tu³amkowy. Przy warto¶ci 0 odczyt powiedzie siê tylko wtedy, gdy\n"
" \t\twej¶cie jest dostêpne na podanym deskryptorze. Kod (stan) wyj¶ciowy\n"
" \t\tw przypadku osi±gniêcia limitu czasu jest wiêkszy ni¿ 128\n"
" -u fd\t\todczyt z deskryptora pliku FD zamiast ze standardowego wej¶cia\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e zostanie napotkany koniec pliku lub\n"
" osi±gniêty limit czasu albo podano nieprawid³owy deskryptor dla argumentu\n"
" -u."
#: builtins.c:1014
msgid ""
@@ -3528,10 +3679,10 @@ msgstr ""
" -f Wy³±czenie generowania nazw plików (globbing).\n"
" -h Pamiêtanie po³o¿enia znalezionych poleceñ.\n"
" -k Umieszczanie w ¶rodowisku polecenia wszystkich argumentów\n"
" o postaci przypisania, nie tylko tych, które poprzedzaja nazwê\n"
" o postaci przypisania, nie tylko tych, które poprzedzaj± nazwê\n"
" polecenia.\n"
" -m W³±czenie kontroli zadañ.\n"
" -n Czytanie poleceñ, lecz niewykonywanie ich.\n"
" -n Czytanie poleceñ bez wykonywania ich.\n"
" -o nazwa-opcji\n"
" Ustawienie zmiennej odpowiadaj±cej nazwa-opcji:\n"
" allexport to samo, co -a\n"
@@ -3620,6 +3771,22 @@ msgid ""
" Exit Status:\n"
" Returns success unless an invalid option is given or a NAME is read-only."
msgstr ""
"Anulowanie warto¶ci i atrybutów zmiennych i funkcji pow³oki.\n"
" \n"
" Usuniêcie zmiennych i funkcji o podanych NAZWACH.\n"
" \n"
" Opcje:\n"
" -f\tpotraktowanie wszystkich NAZW jako funkcji pow³oki\n"
" -v\tpotraktowanie wszystkich NAZW jako zmiennych pow³oki\n"
" \n"
" Bez opcji unset próbuje najpierw anulowaæ definicjê zmiennej, a je¶li to\n"
" siê nie powiedzie, próbuje anulowaæ definicjê funkcji.\n"
" \n"
" Niektórych zmiennych nie mo¿na usun±æ - p. `readonly'.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub NAZWA jest tylko do\n"
" odczytu."
#: builtins.c:1132
msgid ""
@@ -3638,6 +3805,21 @@ msgid ""
" Exit Status:\n"
" Returns success unless an invalid option is given or NAME is invalid."
msgstr ""
"Ustawienie atrybutu eksportowania dla zmiennych pow³oki.\n"
" \n"
" Zaznaczenie ka¿dej NAZWY do automatycznego eksportowania do ¶rodowiska\n"
" pó¼niej wywo³ywanych poleceñ. Je¶li podano WARTO¦Æ, jest ona przypisywana\n"
" przed eksportowaniem.\n"
" \n"
" Opcje:\n"
" -f\tdzia³anie na funkcjach pow³oki\n"
" -n\tusuniêcie atrybutu eksportowania z ka¿dej NAZWY\n"
" -p\twy¶wietlenie listy wszystkich eksportowanych zmiennych i funkcji\n"
" \n"
" Argument `--' koñczy dalsze przetwarzanie opcji.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano nieprawid³ow± opcjê lub NAZWÊ."
#: builtins.c:1151
msgid ""
@@ -3658,6 +3840,22 @@ msgid ""
" Exit Status:\n"
" Returns success unless an invalid option is given or NAME is invalid."
msgstr ""
"Oznaczenie zmiennych pow³oki jako niezmiennych.\n"
" \n"
" Oznaczenie ka¿dej NAZWY jako tylko do odczytu; warto¶ci tych NAZW nie mog±\n"
" byæ zmieniane przez pó¼niejsze podstawienia. Je¶li podano WARTO¦Æ, jest\n"
" ona przypisywana przed oznaczeniem jako tylko do odczytu.\n"
" \n"
" Opcje:\n"
" -a\tdzia³anie na zmiennych tablicowych indeksowanych\n"
" -A\tdzia³anie na zmiennych tablicowych asocjacyjnych\n"
" -f\tdzia³anie na funkcjach pow³oki\n"
" -p\twy¶wietlenie listy wszystkich zmiennych i funkcji tylko do odczytu\n"
" \n"
" Argument `--' wy³±cza dalsze przetwarzanie opcji.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano nieprawid³ow± opcjê lub NAZWÊ."
#: builtins.c:1172
msgid ""
@@ -3695,7 +3893,8 @@ msgstr ""
" Odczytanie i uruchomienie poleceñ z PLIKU w bie¿±cej pow³oce. Do\n"
" znalezienia katalogu zawieraj±cego PLIK u¿ywane s± ¶cie¿ki zawarte\n"
" w $PATH. Je¶li podane zostan± jakiekolwiek ARGUMENTY, staj± siê\n"
" parametrami pozycyjnymi podczas uruchomienia PLIKU. \n"
" parametrami pozycyjnymi podczas uruchomienia PLIKU.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracany jest stan ostatnio wykonanego polecenia z PLIKU lub b³±d, je¶li\n"
" PLIKU nie uda³o siê odczytaæ."
@@ -3983,7 +4182,7 @@ msgstr ""
" \"kill -sygna³ $$\".\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdny SYGNAL lub b³êdn± opcjê."
" Zwracana jest prawda, chyba ¿e podano b³êdny SYGNA£ lub b³êdn± opcjê."
#: builtins.c:1368
msgid ""
@@ -4013,6 +4212,32 @@ msgid ""
" Exit Status:\n"
" Returns success if all of the NAMEs are found; fails if any are not found."
msgstr ""
"Wy¶wietlenie informacji o rodzaju polecenia.\n"
" \n"
" Okre¶lenie, w jaki sposób by³aby interpretowana ka¿da NAZWA w przypadku\n"
" u¿ycia jako polecenie.\n"
" \n"
" Opcje:\n"
" -a\twy¶wietlenie wszystkich po³o¿eñ zawieraj±cych program wykonywalny\n"
" \to podanej NAZWIE; obejmuje aliasy, polecenia wbudowane i funkcje tylko\n"
" \tje¶li nie podano dodatkowo opcji `-p'\n"
" -f\tpominiêcie wyszukiwania funkcji pow³oki\n"
" -P\twymuszenie wyszukiwania w PATH ka¿dej nazwy, nawet je¶li jest\n"
" \taliasem, poleceniem wbudowanym lub funkcj± i zwrócenie nazwy pliku na\n"
" \tdysku\n"
" -p\tzwrócenie nazwy pliku na dysku lub niczego, je¶li `type -t NAZWA'\n"
" \tnie zwróci³oby `file'.\n"
" -t\tzwrócenie pojedynczego s³owa: `alias', `keyword', `function',\n"
" \t`builtin', `file' lub `', je¶li nazwa jest odpowiednio: aliasem,\n"
" \tzarezerwowanym s³owem kluczowym pow³oki, funkcj± pow³oki, poleceniem\n"
" \twbudowanym pow³oki, plikiem na dysku lub nie zostanie znaleziona\n"
" \n"
" Argumenty:\n"
" NAZWA\tNazwa polecenia do zinterpretowania.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, je¶li ka¿da NAZWA zostanie znaleziona; fa³sz, je¶li\n"
" którakolwiek nie zostanie znaleziona."
#: builtins.c:1399
msgid ""
@@ -4112,6 +4337,22 @@ msgid ""
" Exit Status:\n"
" Returns success unless MODE is invalid or an invalid option is given."
msgstr ""
"Wy¶wietlanie i ustawianie maski uprawnieñ plików.\n"
" \n"
" Ustawienie maski uprawnieñ tworzonych plików na UPRAWNIENIA. Je¶li\n"
" pominiêto UPRAWNIENIA, wypisywana jest aktualna warto¶æ maski.\n"
" \n"
" Je¶li UPRAWNIENIA zaczynaj± siê od cyfry, s± interpretowane jako liczba\n"
" ósemkowa; w przeciwnym wypadku jako ³añcuch symbolicznych uprawnieñ,\n"
" jak w poleceniu chmod(1).\n"
" \n"
" Opcje:\n"
" -p\tje¶li pominiêto UPRAWNIENIA, wypisywanie w formie nadaj±cej siê\n"
" \tdo ponownego u¿ycia jako wej¶cie\n"
" -S\twyj¶cie w postaci symbolicznej; bez tej opcji jest ósemkowe\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdne uprawnienia lub b³êdn± opcjê."
#: builtins.c:1464
msgid ""
@@ -4127,6 +4368,17 @@ msgid ""
" Returns the status of ID; fails if ID is invalid or an invalid option is\n"
" given."
msgstr ""
"Oczekiwanie na zakoñczenie zadania i zwrócenie stanu (kodu) wyj¶cia.\n"
" \n"
" Oczekiwanie na proces o identyfikatorze ID, który mo¿e byæ numerem PID\n"
" lub okre¶leniem zadania i zg³oszenie jego stanu (kodu) zakoñczenia.\n"
" Je¶li nie podano ID, polecenie oczekuje na wszystkie aktualnie aktywne\n"
" procesy potomne i zwraca prawdê. Je¶li ID jest okre¶leniem zadania,\n"
" oczekuje na wszystkie procesy w potoku przetwarzania danego zadania.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracany jest stan zakoñczenia ID; niepowodzenie, je¶li ID jest\n"
" nieprawid³owe lub podano b³êdn± opcjê."
#: builtins.c:1482
msgid ""
@@ -4551,6 +4803,59 @@ msgid ""
" HISTIGNORE\tA colon-separated list of patterns used to decide which\n"
" \t\tcommands should be saved on the history list.\n"
msgstr ""
"Popularne zmienne pow³oki i ich zastosowanie.\n"
" \n"
" BASH_VERSION\tInformacja o wersji tego Basha.\n"
" CDPATH\tRozdzielona dwukropkami lista katalogów do wyszukiwania\n"
" \t\tkatalogów podanych jako argumenty `cd'.\n"
" GLOBIGNORE\tRozdzielona dwukropkami lista wzorców nazw plików\n"
" \t\tdo ignorowania przy rozwijaniu ¶cie¿ek.\n"
" HISTFILE\tNazwa pliku, w którym zapisywana jest historia poleceñ.\n"
" HISTFILESIZE\tMaksymalna liczba linii w tym pliku.\n"
" HISTSIZE\tMaksymalna liczba linii historii, do której ma dostêp\n"
" \t\tdzia³aj±ca pow³oka.\n"
" HOME\tPe³na ¶cie¿ka do katalogu logowania.\n"
" HOSTNAME\tNazwa bie¿±cego hosta.\n"
" HOSTTYPE\tRodzaj procesora, na jakim dzia³a ta wersja Basha.\n"
" IGNOREEOF\tSterowanie akcj± pow³oki w przypadku odebrania znaku\n"
" \t\tEOF jako jedynego wej¶cia. Je¶li zmienna jest ustawiona,\n"
" \t\tjej warto¶ci± jest liczba znaków EOF, które mog± wyst±piæ\n"
" \t\tw pustym wierszu przed zakoñczeniem pow³oki (domy¶lnie 10).\n"
" \t\tJe¶li nie jest ustawiona, EOF oznacza koniec wej¶cia.\n"
" MACHTYPE\t£añcuch opisuj±cy bie¿±cy system, na jakim dzia³a Bash.\n"
" MAILCHECK\tOkre¶lenie jak czêsto (w sekundach) Bash ma sprawdzaæ\n"
" \t\tobecno¶æ nowej poczty.\n"
" MAILPATH\tRozdzielona dwukropkami lista nazw plików, w których\n"
" \t\tBash ma sprawdzaæ obecno¶æ nowej poczty.\n"
" OSTYPE\tWersja Uniksa, na której dzia³a ta wersja Basha.\n"
" PATH\tRozdzielona dwukropkami lista katalogów do przeszukiwania\n"
" \t\tprzy wyszukiwaniu poleceñ.\n"
" PROMPT_COMMAND\tPolecenie do wykonania przed wypisaniem ka¿dego\n"
" \t\tg³ównego napisu zachêty.\n"
" PS1\t\tG³ówny napis zachêty.\n"
" PS2\t\tDrugorzêdny napis zachêty.\n"
" PWD\t\tPe³na ¶cie¿ka do bie¿±cego katalogu.\n"
" SHELLOPTS\tRozdzielona dwukropkami lista w³±czonych opcji pow³oki.\n"
" TERM\tNazwa typu bie¿±cego terminala.\n"
" TIMEFORMAT\tFormat wyj¶ciowy do statystyk czasu wy¶wietlanych przez\n"
" \t\tpolecenie wbudowane `time'.\n"
" auto_resume\tWarto¶æ niepusta oznacza, ¿e s³owo polecenia wystêpuj±ce\n"
" \t\tw linii jako jedyne jest najpierw wyszukiwane na li¶cie aktualnie\n"
" \t\tzatrzymanych zadañ. Je¶li tam zostanie znalezione, to zadanie\n"
" \t\tjest wznawiane jako pierwszoplanowe. Warto¶æ `exact' oznacza, ¿e\n"
" \t\ts³owo polecenia musi dok³adnie pasowaæ do polecenia na li¶cie\n"
" \t\tzadañ zatrzymanych. Warto¶æ `substring' oznacza, ¿e s³owo\n"
" \t\tpolecenia musi pasowaæ do podci±gu zadania. Ka¿da inna warto¶æ\n"
" \t\toznacza, ¿e polecenie musi byæ przedrostkiem zatrzymanego\n"
" \t\tzadania.\n"
" histchars\tZnaki steruj±ce rozwijaniem wg historii i szybkim\n"
" \t\tpodstawianiem. Pierwszy znak jest znakiem podstawiania\n"
" \t\thistorii, zwykle `!'. Drugi jest znakiem \"szybkiego podstawienia\",\n"
" \t\tzwykle `^'. Trzeci znak jest znakiem \"komentarza historii\",\n"
" \t\tzwykle `#'.\n"
" HISTIGNORE\tRozdzielona dwukropkami lista wzorców u¿ywanych przy\n"
" \t\tdecydowaniu, które polecenia powinny byæ zapisywane na li¶cie\n"
" \t\thistorii.\n"
#: builtins.c:1770
msgid ""
@@ -4599,8 +4904,8 @@ msgstr ""
" -N\tRotacja stosu czyni±ca jego wierzcho³kiem N-ty katalog (licz±c\n"
" \tod prawej strony listy wypisywanej przez `dirs', pocz±wszy od zera).\n"
" \n"
" dir\tUmieszczenie DIR na wierzcho³ku stosu i uczynienie go nowym\n"
" \tbie¿±cym katalogiem roboczym.\n"
" KATALOG\tUmieszczenie KATALOGU na wierzcho³ku stosu i uczynienie go\n"
" \tnowym bie¿±cym katalogiem roboczym.\n"
" \n"
" Zawarto¶æ stosu katalogów mo¿na zobaczyæ za pomoc± polecenia `dirs'.\n"
" \n"
@@ -4698,7 +5003,7 @@ msgstr ""
" \tkatalogów wzglêdem katalogu domowego\n"
" -p\twypisanie katalogów ze stosu w osobnych wierszach\n"
" -v\twypisanie katalogów ze stosu w osobnych wierszach, poprzedzaj±c\n"
" \tka¿dy jego pozych± na stosie\n"
" \tka¿dy jego pozycj± na stosie\n"
" \n"
" Argumenty:\n"
" +N\tWypisanie N-tej pozycji licz±c od lewej strony listy wypisywanej\n"
@@ -4729,6 +5034,21 @@ msgid ""
" Returns success if OPTNAME is enabled; fails if an invalid option is\n"
" given or OPTNAME is disabled."
msgstr ""
"Ustawianie i anulowanie opcji pow³oki.\n"
" \n"
" Zmiana ustawienia ka¿dej z NAZWY-OPCJI. Bez argumentów bêd±cych opcjami,\n"
" wypisywane s± wszystkie opcje pow³oki z zaznaczeniem w³±czonych.\n"
" \n"
" Opcje:\n"
" -o\tograniczenie NAZW-OPCJI do u¿ywanych z `set -o'\n"
" -p\twypisanie opcji pow³oki z okre¶leniem stanu\n"
" -q\tpominiêcie wyj¶cia\n"
" -s\tw³±czenie (ustawienie) ka¿dej NAZWY-OPCJI\n"
" -u\twy³±czenie (anulowanie) ka¿dej NAZWY-OPCJI\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda je¶li NAZWA-OPCJI jest w³±czona; niepowodzenie, je¶li\n"
" podano b³êdn± opcjê lub NAZWA-OPCJI jest wy³±czona."
#: builtins.c:1884
msgid ""
@@ -4756,6 +5076,31 @@ msgid ""
" Returns success unless an invalid option is given or a write or assignment\n"
" error occurs."
msgstr ""
"Formatowanie i wypisanie ARGUMENTÓW zgodnie z FORMATEM.\n"
" \n"
" Opcje:\n"
" -v ZMIENNA\tprzypisanie wyj¶cia do podanej ZMIENNEJ pow³oki zamiast\n"
" \t\twypisywania na standardowym wyj¶ciu\n"
" \n"
" FORMAT jest ³añcuchem znakowym zawieraj±cym trzy rodzaje obiektów:\n"
" zwyk³e znaki, które s± kopiowane na standardowe wyj¶cie; znaki sekwencji\n"
" steruj±cych, które s± przekszta³cane i kopiowane na standardowe wyj¶cie;\n"
" oraz sekwencje formatuj±ce, z których ka¿da powoduje wypisanie kolejnego\n"
" argumentu.\n"
" \n"
" Poza standardowymi sekwencjami formatuj±cymi opisanymi w printf(1) oraz\n"
" printf(3), printf interpretuje:\n"
" \n"
" %b\trozwiniêcie sekwencji z odwrotnym uko¶nikiem w odpowiadaj±cym\n"
" \targumencie\n"
" %q\tcytowanie argumentu w sposób umo¿liwiaj±cy u¿ycie na wej¶ciu\n"
" \tpow³oki\n"
" %(fmt)T wypisanie ³añcucha daty-czasu otrzymanego z u¿ycia FMT jako\n"
" ³añcucha formatuj±cego dla strftime(3)\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub zapis albo\n"
" przypisanie zakoñczy siê niepowodzeniem."
#: builtins.c:1913
msgid ""
@@ -4781,6 +5126,26 @@ msgid ""
" Exit Status:\n"
" Returns success unless an invalid option is supplied or an error occurs."
msgstr ""
"Okre¶lenie sposobu dope³niania argumentów przez Readline.\n"
" \n"
" Okre¶lenie dla ka¿dej NAZWY sposobu dope³niania argumentów. Je¶li nie\n"
" podano opcji, wypisywane s± istniej±ce specyfikacje dope³niania w sposób\n"
" pozwalaj±cy na ich ponowne u¿ycie jako wej¶cie.\n"
" \n"
" Opcje:\n"
" -p\twypisanie istniej±cych dope³nieñ w formacie do ponownego u¿ycia\n"
" -r\tusuniêcie specyfikacji dope³niania dla ka¿dej NAZWY lub, je¶li\n"
" \tnie podano NAZW, wszystkich specyfikacji dope³niania\n"
" -D\tstosowanie dope³niania i akcji domy¶lnie dla poleceñ bez\n"
" \tokre¶lonych ¿adnych konkretnych regu³ dope³niania\n"
" -E\tstosowanie dope³niania i akcji dla \"pustych\" poleceñ -\n"
" \tpróby dope³nienia w pustej linii\n"
" \n"
" Przy próbie dope³nienia akcje s± wykonywane w kolejno¶ci takiej, jak\n"
" wielkie litery wymienione powy¿ej. Opcja -D ma priorytet nad -E.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub wyst±pi b³±d."
#: builtins.c:1941
msgid ""
@@ -4829,6 +5194,30 @@ msgid ""
" Returns success unless an invalid option is supplied or NAME does not\n"
" have a completion specification defined."
msgstr ""
"Zmiana lub wy¶wietlenie opcji dope³niania.\n"
" \n"
" Zmiana opcji dope³niania dla ka¿dej NAZWY lub, je¶li nie podano NAZW,\n"
" aktualnie wykonywanego dope³niania. Je¶li nie podano OPCJI, wypisanie\n"
" opcji dope³niania dla ka¿dej NAZWY lub bie¿±cej specyfikacji dope³niania.\n"
" \n"
" Opcje:\n"
" \t-o opcja\tUstawienie podanej OPCJI dope³niania dla ka¿dej NAZWY\n"
" \t-D\t\tZmiana opcji dla \"domy¶lnego\" dope³niania polecenia\n"
" \t-E\t\tZmiana opcji dla dope³niania \"pustego\" polecenia\n"
" \n"
" U¿ycie `+o' zamiast `-o' wy³±cza podan± opcjê.\n"
" \n"
" Argumenty:\n"
" \n"
" Ka¿da NAZWA odnosi siê do polecenia, dla którego specyfikacja dope³niania\n"
" musi byæ wcze¶niej zdefiniowana przy u¿yciu polecenia wbudowanego\n"
" `complete'. Je¶li nie podano NAZW, compopt musi byæ wywo³ane z funkcji\n"
" aktualnie generuj±cej dope³nienia, wtedy zmieniane s± opcje dla aktualnie\n"
" wykonywanego generatora dope³nieñ.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub NAZWA nie ma\n"
" zdefiniowanej specyfikacji dope³niania."
#: builtins.c:1986
msgid ""
@@ -4862,6 +5251,36 @@ msgid ""
" Returns success unless an invalid option is given or ARRAY is readonly or\n"
" not an indexed array."
msgstr ""
"Odczyt linii ze standardowego wej¶cia do zmiennej tablicowej indeksowanej.\n"
" \n"
" Odczyt linii ze standardowego wej¶cia (lub deskryptora FD, je¶li podano\n"
" opcjê -u) do zmiennej tablicowej indeksowanej TABLICA. Zmienna MAPFILE\n"
" jest domy¶ln± TABLIC¡.\n"
" \n"
" Opcje:\n"
" -n liczba\tSkopiowanie maksymalnie podanej LICZBY linii. Je¶li LICZBA\n"
" \twynosi 0, kopiowane s± wszystkie linie.\n"
" -O pocz±tek\tRozpoczêcie wpisywania do TABLICY od indeksu POCZ¡TKU.\n"
" \tDomy¶lny indeks wynosi 0.\n"
" -s liczba\tPominiêcie pierwszych LICZBA odczytanych linii.\n"
" -t\t\tUsuniêcie koñcowego znaku koñca linii z ka¿dej wczytanej linii.\n"
" -u fd\t\tOdczyt linii z deskryptora FD zamiast standardowego wej¶cia.\n"
" -C wywo³anie\tObliczenie WYWO£ANIA po odczycie ka¿dego CO-ILE linii.\n"
" -c CO-OLE\tLiczba linii do wczytania miêdzy ka¿dym WYWO£ANIEM.\n"
" \n"
" Argumenty:\n"
" TABLICA\t\tNazwa zmiennej tablicowej do u¿ycia na dane z pliku.\n"
" \n"
" Je¶li podano -C bez -c, domy¶lnym krokiem jest 5000. Podczas obliczania\n"
" WYWO£ANIA jest przekazywany indeks do nastêpnego elementu tablicy, który\n"
" ma byæ przypisany oraz - jako kolejne argumenty - linia do przypisania.\n"
" \n"
" Je¶li nie podano jawnie pocz±tku, mapfile czy¶ci TABLICÊ przed\n"
" przypisywaniem.\n"
" \n"
" Stan wyj¶ciowy:\n"
" Zwracana jest prawda, chyba ¿e podano b³êdn± opcjê lub TABLICA jest tylko\n"
" do odczytu, lub nie jest tablic± indeksowan±."
#: builtins.c:2020
msgid ""
+78 -8
View File
@@ -3,13 +3,13 @@
# This file is distributed under the same license as the bash package.
# Primož PETERLIN <primozz.peterlin@gmail.com>, 2011.
#
# $Id: bash-4.2.sl.po,v 1.4 2011/03/16 22:05:29 peterlin Exp $
# $Id: bash-4.2.sl.po,v 1.5 2011/03/27 20:33:04 peterlin Exp $
msgid ""
msgstr ""
"Project-Id-Version: bash 4.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-28 22:09-0500\n"
"PO-Revision-Date: 2011-03-16 23:05+0100\n"
"PO-Revision-Date: 2011-03-27 22:32+0200\n"
"Last-Translator: Primož PETERLIN <primozz.peterlin@gmail.com>\n"
"Language-Team: Slovenian <translation-team-sl@lists.sourceforge.net>\n"
"Language: sl\n"
@@ -20,7 +20,7 @@ msgstr ""
#: arrayfunc.c:50
msgid "bad array subscript"
msgstr ""
msgstr "slab indeks polja"
#: arrayfunc.c:313 builtins/declare.def:487
#, c-format
@@ -40,7 +40,7 @@ msgstr "%s: ni mogoče dodeliti neštevilčnemu indeksu"
#: arrayfunc.c:518
#, c-format
msgid "%s: %s: must use subscript when assigning associative array"
msgstr ""
msgstr "%s: %s: pri dodeljevanju asociativnega polja je treba uporabiti indeks"
#: bashhist.c:387
#, c-format
@@ -49,7 +49,7 @@ msgstr "%s: ni mogoče ustvariti: %s"
#: bashline.c:3498
msgid "bash_execute_unix_command: cannot find keymap for command"
msgstr ""
msgstr "bash_execute_unix_command: bližnjice za ukaz ni mogoče najti"
#: bashline.c:3584
#, c-format
@@ -78,7 +78,7 @@ msgstr "urejanje vrstice ni omogočeno"
#: builtins/bind.def:206
#, c-format
msgid "`%s': invalid keymap name"
msgstr ""
msgstr "»%s«: neveljavno ime preslikave tipkovnice"
#: builtins/bind.def:245
#, c-format
@@ -98,12 +98,12 @@ msgstr "»%s«: neznano ime funkcije"
#: builtins/bind.def:303
#, c-format
msgid "%s is not bound to any keys.\n"
msgstr ""
msgstr "%s ni prirejen nobeni tipki.\n"
#: builtins/bind.def:307
#, c-format
msgid "%s can be invoked via "
msgstr ""
msgstr "%s je mogoče poklicati prek "
#: builtins/break.def:77 builtins/break.def:117
msgid "loop count"
@@ -119,6 +119,9 @@ msgid ""
" \n"
" Without EXPR, returns "
msgstr ""
"Vrne kontekst trenutnega klica podprograma.\n"
"\n"
" Če IZRAZ ni podan, vrne "
#: builtins/cd.def:235
msgid "HOME not set"
@@ -2351,6 +2354,18 @@ msgid ""
" Returns 0 unless the shell is not executing a shell function or EXPR\n"
" is invalid."
msgstr ""
"Vrne kontekst trenutnega klica podprograma.\n"
"\n"
" Če IZRAZ ni podan, vrne \"$line $filename\". Če je IZRAZ podan, vrne\n"
" \"$line $subroutine $filename\"; to dodatno informacijo je mogoče uporabiti\n"
" za sledenje sklada.\n"
"\n"
" Vrednost IZRAZA določa, za koliko okvirov klicev glede na trenutnega se\n"
" vrnemo; vrhnji okvir nosi številko 0.\n"
"\n"
" Izhodni status:\n"
" Vrne se vrednost 0, razen če ukazna lupina ne izvaja funkcije ukazne\n"
" lupine, ali pa če je IZRAZ neveljaven."
#: builtins.c:383
msgid ""
@@ -2381,6 +2396,31 @@ msgid ""
" Returns 0 if the directory is changed, and if $PWD is set successfully when\n"
" -P is used; non-zero otherwise."
msgstr ""
"Zamenjaj delovni imenik ukazne lupine.\n"
"\n"
" Trenutni imenik zamenjaj s podanim IMENIKOM. Privzeti IMENIK je vrednost\n"
" lupinske spremenljivke HOME.\n"
"\n"
" Iskalna pot za iskanje imenika, ki vsebuje podani IMENIK, je določena z\n"
" lupinsko spremenljivko CDPATH. Imeniki, navedeni v CDPATH, so ločeni z\n"
" dvopičjem (:). Prazno ime imenika pomeni trenitni imenik. Če se podani\n"
" IMENIK začne s poševnico (/), spremenljivka CDPATH nima nobenega vpliva.\n"
"\n"
" Če imenika ni mogoče najti, vklopljena pa je lupinska izbira »cdable_vars«,\n"
" se podana beseda obravnava kot ime spremenljivke. Če je tej spremenljivki\n"
" podana vrednost, se ta vrednost uporabi za IMENIK.\n"
"\n"
" Izbire:\n"
" -L\tvedno se sledi simbolnim povezavam\n"
" -P\tuporabi se fizična struktura imenikov brez sledenja simbolnim\n"
" povezavam\n"
" -e\tče je podana izbira -P in trenutnega delovnega imenika ni\n"
"\t\tmogoče ugotoviti, zaključi z ne-ničelnim statusom\n"
"\n"
" Izhodni status:\n"
" Vrne se vrednost 0 če je bil imenik zamenjan, ter če je bila lupinska\n"
" spremenljivka $PWD uspešno posodobljena pri izbiri -P; sicer ne-ničelna\n"
" vrednost."
#: builtins.c:414
msgid ""
@@ -2397,6 +2437,18 @@ msgid ""
" Returns 0 unless an invalid option is given or the current directory\n"
" cannot be read."
msgstr ""
"Izpiše ime trenutnega delovnega imenika.\n"
"\n"
" Izbire:\n"
" -L\tizpiše vrednost lupinske spremenljivke $PWD, če ta vsebuje\n"
"\t\time trenutnega delovnega imenika\n"
" -P\tizpiše fizični imenik brez simbolnih povezav\n"
"\n"
" Privzeto se »pwd« obnaša, kot bi bila podana izbira »-L«.\n"
"\n"
" Izhodni status:\n"
" Vrne se 0, razen če je podana izbira neveljavna ali če trenutnega imenika\n"
" ni mogoče prebrati."
#: builtins.c:431
msgid ""
@@ -2407,6 +2459,12 @@ msgid ""
" Exit Status:\n"
" Always succeeds."
msgstr ""
"Prazen ukaz.\n"
"\n"
" Brez učinka; ta ukaz ne napravi ničesar.\n"
"\n"
" Izhodni status:\n"
" Vedno uspel."
#: builtins.c:442
msgid ""
@@ -2415,6 +2473,10 @@ msgid ""
" Exit Status:\n"
" Always succeeds."
msgstr ""
"Vrni uspeli status.\n"
"\n"
" Izhodni status:\n"
" Vedno uspel."
#: builtins.c:451
msgid ""
@@ -2423,6 +2485,10 @@ msgid ""
" Exit Status:\n"
" Always fails."
msgstr ""
"Vrni neuspeli status.\n"
"\n"
" Izhodni status:\n"
" Vedno neuspel."
#: builtins.c:460
msgid ""
@@ -2651,6 +2717,10 @@ msgid ""
" Exits the shell with a status of N. If N is omitted, the exit status\n"
" is that of the last command executed."
msgstr ""
"Izidi iz ukazne lupine.\n"
"\n"
" Zaključi ukazno lupino z izhodnim statusom N. Če N ni podan, je izhodni\n"
" status enak izhodnemu statusu nazadnje izvajanega ukaza."
#: builtins.c:703
msgid ""
+18 -6
View File
@@ -131,7 +131,8 @@ static REDIRECT *deferred_heredocs;
static int group_command_nesting;
/* A buffer to indicate the indirection level (PS4) when set -x is enabled. */
static char indirection_string[100];
static char *indirection_string = 0;
static int indirection_stringsiz = 0;
/* Print COMMAND (a command tree) on standard output. */
void
@@ -417,10 +418,12 @@ indirection_level_string ()
register int i, j;
char *ps4;
char ps4_firstc[MB_LEN_MAX+1];
int ps4_firstc_len, ps4_len;
int ps4_firstc_len, ps4_len, ineed;
indirection_string[0] = '\0';
ps4 = get_string_value ("PS4");
if (indirection_string == 0)
indirection_string = xmalloc (indirection_stringsiz = 100);
indirection_string[0] = '\0';
if (ps4 == 0 || *ps4 == '\0')
return (indirection_string);
@@ -446,8 +449,17 @@ indirection_level_string ()
ps4_firstc[0] = ps4[0];
ps4_firstc[ps4_firstc_len = 1] = '\0';
#endif
for (i = j = 0; ps4_firstc[0] && j < indirection_level && i < 99; i += ps4_firstc_len, j++)
/* Dynamically resize indirection_string so we have room for everything
and we don't have to truncate ps4 */
ineed = (ps4_firstc_len * indirection_level) + strlen (ps4);
if (ineed > indirection_stringsiz - 1)
{
indirection_stringsiz = ineed + 1;
indirection_string = xrealloc (indirection_string, indirection_stringsiz);
}
for (i = j = 0; ps4_firstc[0] && j < indirection_level && i < indirection_stringsiz - 1; i += ps4_firstc_len, j++)
{
if (ps4_firstc_len == 1)
indirection_string[i] = ps4_firstc[0];
@@ -455,7 +467,7 @@ indirection_level_string ()
memcpy (indirection_string+i, ps4_firstc, ps4_firstc_len);
}
for (j = ps4_firstc_len; *ps4 && ps4[j] && i < 99; i++, j++)
for (j = ps4_firstc_len; *ps4 && ps4[j] && i < indirection_stringsiz - 1; i++, j++)
indirection_string[i] = ps4[j];
indirection_string[i] = '\0';
+1552
View File
File diff suppressed because it is too large Load Diff
+14 -4
View File
@@ -1,7 +1,7 @@
/* trap.c -- Not the trap command, but useful functions for manipulating
those objects. The trap command is in builtins/trap.def. */
/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -176,7 +176,7 @@ initialize_traps ()
}
}
#ifdef INCLUDE_UNUSED
#ifdef DEBUG
/* Return a printable representation of the trap handler for SIG. */
static char *
trap_handler_string (sig)
@@ -276,6 +276,8 @@ run_pending_traps ()
if (catch_flag == 0) /* simple optimization */
return;
itrace("run_pending_traps: ");
catch_flag = 0;
/* Preserve $? when running trap. */
@@ -387,6 +389,8 @@ trap_handler (sig)
SIGRETURN (0);
}
itrace("trap_handler: sig = %d", sig);
if ((sig >= NSIG) ||
(trap_list[sig] == (char *)DEFAULT_SIG) ||
(trap_list[sig] == (char *)IGNORE_SIG))
@@ -940,14 +944,20 @@ run_interrupt_trap ()
/* Free all the allocated strings in the list of traps and reset the trap
values to the default. Intended to be called from subshells that want
to complete work done by reset_signal_handlers upon execution of a
subsequent `trap' command that changes a signal's disposition. */
subsequent `trap' command that changes a signal's disposition. We need
to make sure that we duplicate the behavior of
reset_or_restore_signal_handlers and not change the disposition of signals
that are set to be ignored. */
void
free_trap_strings ()
{
register int i;
for (i = 0; i < BASH_NSIG; i++)
free_trap_string (i);
{
if (trap_list[i] != (char *)IGNORE_SIG)
free_trap_string (i);
}
trap_list[DEBUG_TRAP] = trap_list[EXIT_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL;
}
+1129
View File
File diff suppressed because it is too large Load Diff