Bash-5.3-rc1 release

This commit is contained in:
Chet Ramey
2025-04-07 12:36:49 -04:00
parent ee9645c4a0
commit c8f067a967
147 changed files with 11100 additions and 51295 deletions
+81 -8
View File
@@ -1,3 +1,74 @@
This document details the changes between this version, bash-5.3-rc1, and
the previous version, bash-5.3-beta.
1. Changes to Bash
a. Fixed a bug where backslash did not quote multibyte characters in some
cases.
b. Requesting the length of an element of an unset array is a fatal error
when `set -u' is enabled and the subscript is not `@' or `*'.
c. Prompt expansion now quotes the results of \U.
d. Changes to `set -e' exit behavior in posix mode, since POSIX now says to
exit as if executing the `exit builtin with no arguments'.
e. Fixes to the `exec' builtin to undo redirections if it is given a command
name to execute and the exection fails, but the shell does not exit. This
is POSIX interp 1896.
f. Fixed a bug that resulted in `wait' setting $? to 255 in some cases when
waiting for a specific PID.
g. Fixed a bug involving redirections to the file descriptor bash is using to
read a script.
h. In POSIX mode, `kill' returns a failure status if any of the PID/job
arguments are not found or if sending the signal fails.
i. Fixed a bug that caused an invalid brace sequence expression to mess up
expansion of an enclosing brace expansion.
j. Fixed a bug in command printing that output the wrong default file
descriptor for the <> redirection.
k. User-specified subshells (`(...)') now update BASH_COMMAND in the subshell.
l. Fixed a display bug with the `help -m' and loadable builtins.
m. Fixed a potential file descriptor leak when trying to use a pipe for a
here document.
n. Fix a bug with multiple assignment statements preceding a simple command
containing nofork comsubs.
o. Fix a potential bug that could result in a NULL buffered stream even with
a valid input file descriptor.
2. Changes to Readline
a. Fixed a bug that allowed a history search to change the current history
list position.
b. Fixed a bug that allowed ^G to retain a saved command to execute.
c. Updates to new export-completions command to allow filename suffixes.
d. Fixed a redisplay bug with prompts containing multiple sequences of
invisible characters that are longer than the screen width.
3. New Features in Bash
a. There is a new `fltexpr' loadable builtin to perform floating-point
arithmetic similarly to `let'.
4. New Features in Readline
a. Readline can reset its idea of the screen dimensions when executing after
a SIGCONT.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.3-beta, and
the previous version, bash-5.3-alpha.
@@ -152,7 +223,7 @@ l. There is a new `bash_source_fullpath' shopt option, which makes bash put
at configure time.
m. Posix mode now forces job notifications to occur when the new edition of
POSIX specifes (since it now specifies them).
POSIX specifies (since it now specifies them).
n. Interactive shells don't print job notifications while sourcing scripts.
@@ -325,7 +396,7 @@ vv. Fixed a bug that caused unset not to remove a function named a[b] if
ww. Posix mode doesn't perform function lookup for function names containing
a slash.
xx. <( and >( can now be used in funtion names.
xx. <( and >( can now be used in function names.
yy. Fixed a bug that caused tilde expansion not to be performed on some
array subscripts.
@@ -451,7 +522,7 @@ oooo. If the cd builtin uses $OLDPWD, allow it to use $CDPATH if the user has
set it to something that's not a full pathname.
pppp. The test builtin only supports the optional argument to -t if parsing
an expression with more than four aguments and not in posix mode.
an expression with more than four arguments and not in posix mode.
qqqq. Changes to filename quoting and rewriting to deal with NFC and NFD
Unicode forms (primarily for macOS).
@@ -618,7 +689,7 @@ a. Fixed a bug in clearing the visible line structure before redisplay.
b. Fix a bug where setlocale(3) returning NULL caused a crash.
c. Fixed signal checking in callback mode to handle signals that arrive before
readline restore's the application's signal handlers.
readline restores the application's signal handlers.
d. Fixed a bug with word completion where the directory name needs to be
dequoted and tilde-expanded.
@@ -675,7 +746,7 @@ u. Call the filename rewrite hook on the word being completed before comparing
strings.
v. Fix infinite recursion that can happen if someone binds a key that doesn't
have a different upper and lower case represenation to do-lowercase-version.
have a different upper and lower case representation to do-lowercase-version.
w. Check for non-ANSI (dumb) terminals a little more thoroughly.
@@ -718,12 +789,12 @@ j. `trap' has a new -P option that prints the trap action associated with each
signal argument.
k. The `command' builtin preceding a declaration builtin (e.g., `declare')
preserves the special asisgnment statement parsing for the declation
preserves the special assignment statement parsing for the declation
builtin. This is a new POSIX requirement.
l. `printf' uses the `alternate form' for %q and %Q to force single quoting.
m. `printf' now interprets %ls (%S) and %lc (%C)nas referring to wide strings
m. `printf' now interprets %ls (%S) and %lc (%C) as referring to wide strings
and characters, respectively, when in a multibyte locale.
n. The shell can be compiled with a different default value for the
@@ -817,6 +888,8 @@ i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former
case, anything bound to quoted-insert) to quote characters in the search
string.
j. There is a new rl_print_keybinding function that prints the key bindings
for a single bindable function specified by name.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-release, and
the previous version, bash-5.2-rc4.
@@ -1883,7 +1956,7 @@ n. The `test -N' operator uses nanosecond timestamp granularity if it's
available.
o. Bash posix mode now treats assignment statements preceding shell function
definitions the same as in its default mode, since POSIX has changed and
calls the same as in its default mode, since POSIX has changed and
no longer requires those assignments to persist after the function returns
(POSIX interp 654).
-31
View File
@@ -1,31 +0,0 @@
The version of bash in this directory has been compiled on the
following systems:
By chet:
SunOS 4.1.4
SunOS 5.5
BSDI BSD/OS 2.1
FreeBSD 2.2
NetBSD 1.2
AIX 4.2
AIX 4.1.4
HP/UX 9.05, 10.01, 10.10, 10.20
Linux 2.0.29 (libc 5.3.12)
Linux 2.0.4 (libc 5.3.12)
By other testers:
SCO ODT 2.0
SCO 3.2v5.0, 3.2v4.2
SunOS 5.3
SunOS 5.5
BSD/OS 2.1
FreeBSD 2.2
SunOS 4.1.3
Irix 5.3
Irix 6.2
Linux 2.0 (unknown distribution)
Digital OSF/1 3.2
GNU Hurd 0.1
SVR4.2
-339
View File
@@ -1,339 +0,0 @@
Date: Tue, 06 Feb 2007 16:06:58 -0500
From: Steve Grubb <sgrubb@redhat.com>
Subject: Re: bash and linux audit
To: chet.ramey@case.edu
Organization: Red Hat
OK, I released audit 1.4 Sunday which has the logging function for user
commands. It produces audit events like this:
type=USER_CMD msg=audit(01/30/2007 18:23:45.793:143) : user pid=22862 uid=root
auid=root subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023
msg='cwd=/root/test dir cmd=ls -l (terminal=tty1 res=success)'
diff -urp bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
--- bash-3.2.orig/config-bot.h 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/config-bot.h 2007-01-20 11:59:23.000000000 -0500
@@ -97,6 +97,11 @@
# define RESTRICTED_SHELL_NAME "rbash"
#endif
+/* If the shell is called by this name, it will become audited. */
+#if defined (AUDIT_SHELL)
+# define AUDIT_SHELL_NAME "aubash"
+#endif
+
/***********************************************************/
/* Make sure feature defines have necessary prerequisites. */
/***********************************************************/
diff -urp bash-3.2.orig/config.h.in bash-3.2/config.h.in
--- bash-3.2.orig/config.h.in 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/config.h.in 2007-01-20 11:59:23.000000000 -0500
@@ -81,6 +81,11 @@
flag. */
#undef RESTRICTED_SHELL
+/* Define AUDIT_SHELL if you want the generated shell to audit all
+ actions performed by root account. The shell thus generated can become
+ audited by being run with the name "aubash". */
+#undef AUDIT_SHELL
+
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
shell builtin "foo", even if it has been disabled with "enable -n foo". */
#undef DISABLED_BUILTINS
diff -urp bash-3.2.orig/configure.in bash-3.2/configure.in
--- bash-3.2.orig/configure.in 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/configure.in 2007-01-20 11:59:23.000000000 -0500
@@ -162,6 +162,7 @@ opt_history=yes
opt_bang_history=yes
opt_dirstack=yes
opt_restricted=yes
+opt_audit=yes
opt_process_subst=yes
opt_prompt_decoding=yes
opt_select=yes
@@ -195,8 +196,8 @@ dnl a minimal configuration turns everyt
dnl added individually
if test $opt_minimal_config = yes; then
opt_job_control=no opt_alias=no opt_readline=no
- opt_history=no opt_bang_history=no opt_dirstack=no
- opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
+ opt_history=no opt_bang_history=no opt_dirstack=no opt_restricted=no
+ opt_audit=no opt_process_subst=no opt_prompt_decoding=no
opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
@@ -227,6 +228,7 @@ AC_ARG_ENABLE(progcomp, AC_HELP_STRING([
AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
+AC_ARG_ENABLE(audit, AC_HELP_STRING([--enable-audit], [enable an audited shell]), opt_audit=$enableval)
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
@@ -254,6 +256,10 @@ fi
if test $opt_restricted = yes; then
AC_DEFINE(RESTRICTED_SHELL)
fi
+if test $opt_audit = yes; then
+AC_DEFINE(AUDIT_SHELL)
+AUDIT_LIB='-laudit'
+fi
if test $opt_process_subst = yes; then
AC_DEFINE(PROCESS_SUBSTITUTION)
fi
@@ -355,6 +361,8 @@ AC_SUBST(HELPDIRDEFINE)
AC_SUBST(HELPINSTALL)
AC_SUBST(HELPSTRINGS)
+AC_SUBST(AUDIT_LIB)
+
echo ""
echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
echo ""
diff -urp bash-3.2.orig/doc/bash.1 bash-3.2/doc/bash.1
--- bash-3.2.orig/doc/bash.1 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/doc/bash.1 2007-01-20 11:59:23.000000000 -0500
@@ -155,6 +155,12 @@ single-character options to be recognize
.PP
.PD 0
.TP
+.B \-\-audit
+The shell logs all commands run by the root user (see
+.SM
+.B "AUDIT SHELL"
+below).
+.TP
.B \-\-debugger
Arrange for the debugger profile to be executed before the shell
starts.
@@ -8770,6 +8776,17 @@ turns off any restrictions in the shell
script.
.\" end of rbash.1
.if \n(zY=1 .ig zY
+.SH "AUDIT SHELL"
+.zY
+.PP
+If
+.B bash
+is started with the name
+.BR aubash ,
+or the
+.B \-\-audit
+option is supplied at invocation, the shell logs all commands issued by the root user to the audit system.
+.if \n(zY=1 .ig zY
.SH "SEE ALSO"
.PD 0
.TP
diff -urp bash-3.2.orig/eval.c bash-3.2/eval.c
--- bash-3.2.orig/eval.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/eval.c 2007-01-20 11:59:23.000000000 -0500
@@ -45,6 +45,11 @@
# include "bashhist.h"
#endif
+#if defined (AUDIT_SHELL)
+# include <libaudit.h>
+# include <errno.h>
+#endif
+
extern int EOF_reached;
extern int indirection_level;
extern int posixly_correct;
@@ -58,6 +63,38 @@ extern int rpm_requires;
static void send_pwd_to_eterm __P((void));
static sighandler alrm_catcher __P((int));
+#if defined (AUDIT_SHELL)
+static int audit_fd = -1;
+
+static int
+audit_start ()
+{
+ audit_fd = audit_open ();
+ if (audit_fd < 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int
+audit (cmd, result)
+ char *cmd;
+ int result;
+{
+ int rc;
+
+ if (audit_fd < 0)
+ return 0;
+
+ rc = audit_log_user_command (audit_fd, AUDIT_USER_CMD, cmd,
+ NULL, !result);
+ close (audit_fd);
+ audit_fd = -1;
+ return rc;
+}
+#endif
+
+
/* Read and execute commands until EOF is reached. This assumes that
the input source has already been initialized. */
int
@@ -145,7 +182,25 @@ reader_loop ()
executing = 1;
stdin_redir = 0;
+#if defined (AUDIT_SHELL)
+ if (audited && interactive_shell && getuid () == 0)
+ {
+ if (audit_start () < 0)
+ {
+ if (errno != EINVAL && errno != EPROTONOSUPPORT &&
+ errno != EAFNOSUPPORT)
+ return EXECUTION_FAILURE;
+ }
+ }
+#endif
+
execute_command (current_command);
+#if defined (AUDIT_SHELL)
+ {
+ extern char *shell_input_line;
+ audit (shell_input_line, last_command_exit_value);
+ }
+#endif
exec_done:
QUIT;
diff -urp bash-3.2.orig/externs.h bash-3.2/externs.h
--- bash-3.2.orig/externs.h 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/externs.h 2007-01-20 12:05:00.000000000 -0500
@@ -77,6 +77,10 @@ extern int shell_is_restricted __P((char
extern int maybe_make_restricted __P((char *));
#endif
+#if defined (AUDIT_SHELL)
+extern int maybe_make_audited __P((char *));
+#endif
+
extern void unset_bash_input __P((int));
extern void get_current_user_info __P((void));
diff -urp bash-3.2.orig/flags.c bash-3.2/flags.c
--- bash-3.2.orig/flags.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/flags.c 2007-01-20 11:59:23.000000000 -0500
@@ -142,6 +142,12 @@ int restricted = 0; /* currently restri
int restricted_shell = 0; /* shell was started in restricted mode. */
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+/* Non-zero means that this shell is audited. An audited shell records
+ each command that the root user executes. */
+int audited = 0; /* shell was started in audit mode. */
+#endif /* AUDIT_SHELL */
+
/* Non-zero means that this shell is running in `privileged' mode. This
is required if the shell is to run setuid. If the `-p' option is
not supplied at startup, and the real and effective uids or gids
diff -urp bash-3.2.orig/flags.h bash-3.2/flags.h
--- bash-3.2.orig/flags.h 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/flags.h 2007-01-20 11:59:23.000000000 -0500
@@ -66,6 +66,10 @@ extern int restricted;
extern int restricted_shell;
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+extern int audited;
+#endif /* AUDIT_SHELL */
+
extern int *find_flag __P((int));
extern int change_flag __P((int, int));
extern char *which_set_flags __P((void));
Only in bash-3.2: .made
diff -urp bash-3.2.orig/Makefile.in bash-3.2/Makefile.in
--- bash-3.2.orig/Makefile.in 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/Makefile.in 2007-01-20 11:59:23.000000000 -0500
@@ -366,6 +366,8 @@ MALLOC_LIBRARY = @MALLOC_LIBRARY@
MALLOC_LDFLAGS = @MALLOC_LDFLAGS@
MALLOC_DEP = @MALLOC_DEP@
+AUDIT_LIB = @AUDIT_LIB@
+
ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h $(ALLOC_LIBSRC)/shmalloc.h \
$(ALLOC_LIBSRC)/imalloc.h $(ALLOC_LIBSRC)/mstats.h \
$(ALLOC_LIBSRC)/table.h $(ALLOC_LIBSRC)/watch.h
@@ -386,7 +388,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.
$(BASHINCDIR)/ocache.h
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
- $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS)
+ $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS) $(AUDIT_LIB)
LIBDEP = $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
$(TILDE_DEP) $(MALLOC_DEP)
diff -urp bash-3.2.orig/parse.y bash-3.2/parse.y
--- bash-3.2.orig/parse.y 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/parse.y 2007-01-20 11:59:23.000000000 -0500
@@ -258,7 +258,7 @@ int need_here_doc;
/* Where shell input comes from. History expansion is performed on each
line when the shell is interactive. */
-static char *shell_input_line = (char *)NULL;
+char *shell_input_line = (char *)NULL;
static int shell_input_line_index;
static int shell_input_line_size; /* Amount allocated for shell_input_line. */
static int shell_input_line_len; /* strlen (shell_input_line) */
diff -urp bash-3.2.orig/shell.c bash-3.2/shell.c
--- bash-3.2.orig/shell.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/shell.c 2007-01-20 12:04:23.000000000 -0500
@@ -240,6 +240,9 @@ struct {
#if defined (RESTRICTED_SHELL)
{ "restricted", Int, &restricted, (char **)0x0 },
#endif
+#if defined (AUDIT_SHELL)
+ { "audit", Int, &audited, (char **)0x0 },
+#endif
{ "verbose", Int, &echo_input_at_read, (char **)0x0 },
{ "version", Int, &do_version, (char **)0x0 },
{ "wordexp", Int, &wordexp_only, (char **)0x0 },
@@ -644,6 +647,10 @@ main (argc, argv, env)
maybe_make_restricted (shell_name);
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+ maybe_make_audited (shell_name);
+#endif
+
if (wordexp_only)
{
startup_state = 3;
@@ -1143,6 +1150,29 @@ maybe_make_restricted (name)
}
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+/* Perhaps make this shell an `audited' one, based on NAME. If the
+ basename of NAME is "aubash", then this shell is audited. The
+ name of the audited shell is a configurable option, see config.h.
+ In an audited shell, all actions performed by root will be logged
+ to the audit system.
+ Do this also if `audited' is already set to 1 maybe the shell was
+ started with --audit. */
+int
+maybe_make_audited (name)
+ char *name;
+{
+ char *temp;
+
+ temp = base_pathname (name);
+ if (*temp == '-')
+ temp++;
+ if (audited || (STREQ (temp, AUDIT_SHELL_NAME)))
+ audited = 1;
+ return (audited);
+}
+#endif /* AUDIT_SHELL */
+
/* Fetch the current set of uids and gids and return 1 if we're running
setuid or setgid. */
static int
+331
View File
@@ -10772,3 +10772,334 @@ lib/readline/isearch.c
-----
CHANGES,NEWS
- updated for bash-5.3-beta
12/15
-----
lib/readline/histexpand.c
- get_history_event: make sure we don't change history_offset whether
the search succeeds or fails, don't set it to history_length.
Callers don't expect to have the history offset changed out from
under them.
Fixes bug reported by Grisha Levit <grishalevit@gmail.com>
12/16
-----
lib/readline/util.c
- _rl_abort_internal: make sure to clear _rl_command_to_execute
Report and patch from Grisha Levit <grishalevit@gmail.com>
tests/printf7.sub,tests/cond-regexp2.sub
- accommodate different error messages across different systems
1/2/2025
--------
tests/run-all, tests/run-minimal
- BASHOPTS: unset or unexport as appropriate, same as SHELLOPTS
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
1/9
---
subst.c
- string_extract_verbatim: take into account the fact that CTLESC can
quote multibyte characters; use ADVANCE_CHAR instead of increment
Fixes bug reported by jktseug@gmail.com
1/10
----
expr.c
- expr_bind_variable,expr_streval: suppress additional expansion if
called by the `let' builtin, whether or not array_expand_once is set
- expr_skipsubscript: suppress expansion while parsing subscripts
whether array_expand_once is set or not
Still have to change tests if this goes final
These are all conditional on shell_compatibility_level > 51
From a bug-bash post by Greg Wooledge <greg@wooledge.org>
1/14
----
lib/readline/complete.c
- _rl_export_completions: use print_filename instead of fprintf to
display the possible completions so slashes and file types can
be included
From a patch from Matthew Tromp <matthewktromp@gmail.com>
1/15
----
examples/loadables/fltexpr.c
- fltexpr: new loadable builtin to do floating-point arithmetic
expression evaluation and optionally print the result
1/16
----
builtins/printf.def
- getarg(), advancearg(): cosmetic changes to make it easier to
implement %N$ format specifiers in the future
1/18
----
subst.c
- array_length_reference: requesting the length of an element of an
unset variable using array syntax is a fatal error when `set -u'
is enabled and the subscript is not `@' or `*'.
Inspired by a report from Ian Kelling <iank@fsf.org>
1/20
----
parse.y
- decode_prompt_string: since Debian has made the spectaculary bad call
to allow arbitrary characters in usernames, protect the results of
the \u expansion in the same way as \[Ww] and \[Hh] (externally-
controlled data)
From https://savannah.gnu.org/patch/?10496
1/21
----
eval.c
- reader_loop: if we longjmp with ERREXIT, don't reset any local
function contexts in posix mode, since POSIX says to exit as if
executing the `exit builtin with no arguments'. Revision of change
from 7/2022.
From a report by Ivan Shapovalov <intelfx@intelfx.name> in 11/2024
lib/readline/display.c
- rl_redisplay: after calling update_line, when putting the cursor
where it needs to be and reprinting part of the line with the
prompt that contains invisible characters, make sure we start to
output characters at the portion in the prompt buffer that begins
on the current line and only offset by the number of invisible
characters on the current line, and set _rl_last_c_pos accordingly
in both multibyte and singlebyte locales.
Fixes bug reported by Andreas Schwab <schwab@linux-m68k.org>
1/22
----
execute_cmd.c
- execute_builtin_or_function: if we're executing the exec builtin,
and there are redirections, let exec_builtin handle disposing of
redirection_undo_list if there is no program name to execute, so
it's still there if exec returns and doesn't exit the shell.
Then we can manage disposing of exec_redirection_undo_list and
letting the redirections be undone as normal.
This is POSIX interp 1896, with modifications from
https://www.austingroupbugs.net/view.php?id=1896#c7037
builtins/exec.def
- exec_builtin: dispose of redirection_undo_list and set it to NULL
if there is no program name operand; let execute_builtin_or_function
clean it up
1/23
----
lib/readline/terminal.c
- _rl_tcgetwinsize,_rl_tcsetwinsize: function wrappers for tcgetwinsize/
tcsetwinsize with fallbacks to ioctl if those functions aren't
available
- _rl_get_screensize: use _rl_tcgetwinsize
lib/readline/rlwinsize.h
- _rl_tcgetwinsize,_rl_tcsetwinsize: extern function declarations
lib/readine/rltty.c
- set_winsize: use _rl_tcgetwinsize/_rl_tcsetwinsize
- set_winsize: if _rl_tcgetwinsize succeeds, use the values to set
readline's idea of the screen size via _rl_set_screen_size
Inspired by a discussion with Olav Mørkrid <omega@funker.no>
1/24
----
lib/readline/signals.c
- _rl_handling_signal: new private variable, set to the signal we're
currently handling in _rl_signal_handler (SIGWINCH) or
_rl_handle_signal (all others). Only valid if RL_STATE_SIGHANDLER
is set
lib/readline/rlprivate.h
- _rl_handling_signal: new extern declaration
lib/readline/rltty.c
- set_winsize: only set readline's idea of the screen size if we're
executing in a signal handler context and handling SIGTSTP and the
application has indicated that it doesn't want the environment
variables LINES and COLUMNS to have priority (rl_prefer_env_winsize)
1/30
----
jobs.c
- wait_for_single_pid: if wait_for returns -1/ECHILD, make sure to
return 257 just as if the child was not found, optionally printing
an error message if JWAIT_PERROR is supplied
From a discussion with Ian <saturns_rings@protonmail.com>
2/8
---
redir.c
- do_redirection_internal: keep track of whether the redirector fd
was active with a new variable. Not used yet, should be optimized
out.
- add_undo_fd_redirect: new undo function using r_move_input so we
don't need a dup redir and a separate close redir to undo. Not
used yet
- do_redirection_internal: only call check_bash_input if we're
creating an undo list and not running one
command.h
- OUTPUT_REDIRECT: add r_output_force
input.c
- check_bash_input: if we dup the bash input fd to another in
save_bash_input, return that fd. Continue to return -1 on error
and 0 if we don't do anything but sync
execute_cmd.c
- execute_null_command: force a subshell if any of the redirections
involve the bash input buffered fd.
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
2/10
----
examples/loadables/chmod.c
- chmod: new loadable builtin, inspired by zhixu.liu@gmail.com in
https://savannah.gnu.org/patch/?10499
2/11
----
builtins/kill.def
- kill_builtin: in posix mode, return a failure status if any of the
pid/job arguments are not found or sending the signal fails. This
is consistent with
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/kill.html#tag_20_64_14
2/12
----
braces.c
- brace_gobbler: take a new argument in which to return the type of
brace expansion (comma or sequence) we think we've found; change
all callers
- brace_expand: even if we find a BRACE_ARG_SEPARATOR, don't try to
perform expansion if brace_gobbler doesn't think we have a
BRACE_COMMA expansion
- valid_seqterm: new function, performs minimal validation on a
sequence expansion, used to skip over invalid sequence expressions
in brace_expand
- brace_expand: call valid_seqterm if brace_gobbler finds a BRACE_SEQ
expansion
Inspired by report from Robert Elz <kre@munnari.oz.au>
2/13
----
doc/bash.1,doc/bashref.texi
- clarified the handling of double quotes in EXPRESSION in
(( EXPRESSION )) and $(( EXPRESSION )) to say that only unescaped
double quotes are removed
expr.c
- expr_bind_variable,expr_streval: revert change from 1/10 that
suppresses additional expansion when called by the `let' builtin,
tag for possible inclusion in a future release when I can look
at parallel changes to ((...)) and $((...)) (and probably
declare 'a[" "]=12' or similar)
2/14
----
lib/sh/zmapfd.c,externs.h
- zmapfd: now returns ssize_t in case of large files when size_t is
larger than int
builtins/evalfile.c,builtins/help.def
- zmapfd: changed callers
print_cmd.c
- print_redirection: the default file descriptor for <> is 0
Report and fix from Emanuele Torre <torreemanuele6@gmail.com>
2/18
----
configure.ac
- check for d_type member of struct dirent for future use
2/24
----
doc/bash.1,doc/bashref.texi
- document the word expansions performed on indexed array subscripts
and assoc array keys
- document the possibility and effect of empty strings on arithmetic
evaluation for substring expansion, arithmetic expansion, operands
to the the [[ command's arithmetic operators, the expression in
the (( compound command, and indexed array subscripts
2/24
----
execute_cmd.c
- execute_command_internal: if executing a (...) subshell, make sure
to update BASH_COMMAND before exiting on an error return from the
subshell with -e set
Report from Max Bowsher <maxbowsher@gmail.com>
3/3
---
redir.c
- here_document_to_fd: if we are trying to use a pipe for a here
document, but the F_GETPIPE_SZ fcntl returns a value shorter than
the here document length, make sure to close the pipe file descriptors
builtins/ulimit.def
- pipesize: use pathconf and _PC_PIPE_BUF if available
3/8
---
braces.c
- brace_expand: make sure to call valid_seqterm with the right length
so that text[tlen] == '}'
3/10
----
builtins/help.def
- show_manpage: if the first line of long_doc doesn't contain a
newline, e.g., if it's a loadable builtin, add one so there's the
usual space between NAME and SYNOPSIS
m4/codeset.m4
- define HAVE_NL_LANGINFO
lib/sh/strftime.c
- updates for locale-awareness
3/14
----
lib/termcap/termcap.c,lib/termcap/tparam.c
- updates for ISO C
3/17
----
configure.ac
- update release to rc1, update CHANGES and NEWS
3/19
----
lib/readline/rlmbutil.h
- _rl_wcwidth: make sure wchar_t constants have an `L' prefix
3/24
----
subst.c
- function_substitute: set temporary_env to NULL (we've already
set up an unwind-protect for it) before pushing the context, so
pop_context doesn't free it out from underneath the caller.
Report from Emanuele Torre <torreemanuele6@gmail.com>
3/27
----
shell.c
- set_bash_input: if the call to with_input_from_buffered_stream does
not result in a valid buffer corresponding to the file descriptor,
print an error message and set last_command_exit_value
From a report in https://savannah.gnu.org/patch/?10512
4/3
---
lib/sh/gettimeofday.c
- updated from version in gnulib
[bash-5.3-rc1 frozen]
-449
View File
@@ -1,449 +0,0 @@
From jwe@che.utexas.edu Wed Sep 21 17:23:40 1994
Flags: 10
Return-Path: jwe@che.utexas.edu
Received: from po.CWRU.Edu (root@po.CWRU.Edu [129.22.4.2]) by odin.INS.CWRU.Edu with ESMTP (8.6.8.1+cwru/CWRU-2.1-ins)
id RAA04010; Wed, 21 Sep 1994 17:23:39 -0400 (from jwe@che.utexas.edu for <chet@odin.INS.CWRU.Edu>)
Received: from life.ai.mit.edu (life.ai.mit.edu [128.52.32.80]) by po.CWRU.Edu with SMTP (8.6.8.1+cwru/CWRU-2.2)
id RAA02121; Wed, 21 Sep 1994 17:23:28 -0400 (from jwe@che.utexas.edu for <chet@po.cwru.edu>)
Received: from schoch.che.utexas.edu by life.ai.mit.edu (4.1/AI-4.10) for chet@po.cwru.edu id AA09989; Wed, 21 Sep 94 17:23:17 EDT
Received: from localhost (jwe@localhost) by schoch.che.utexas.edu (8.6.8.1/8.6) with SMTP id QAA05737; Wed, 21 Sep 1994 16:22:01 -0500
Message-Id: <199409212122.QAA05737@schoch.che.utexas.edu>
To: march@tudor.com
Cc: bug-bash@prep.ai.mit.edu
Subject: Re: Completion feature possible?
In-Reply-To: Your message of 21 Sep 94 13:30:22 EDT
Date: Wed, 21 Sep 94 16:22:00 EDT
From: John Eaton <jwe@che.utexas.edu>
Gregory F. March <march@tudor.com> wrote:
: I was having a discussion about MH with one of my friends the other
: day and I got to thinking that the +folder/subfolder scheme for naming
: mail folders is a real pain because completion doesn't work on
: them. Someone then mentioned that zsh (I think) has the ability to
: specify how to complete (I guess where to look for the files) for
: different prefixes. Bash right now knows about '@', '~', and '$' (any
: others?). It would be really helpful if one could define something
: like:
:
: completion '+' "$HOME/Mail"
:
: in a config file someplace. Would this be easy? Is there a list of
: TODO item that someone might want to add this to?
It would be nice to have a general completion feature like this.
Until that happens, maybe you will find the following patch useful.
It makes MH folder name completion work with bash. The diffs are
relative to version 1.14.2.
I realize that changes to readline.c and and complete.c are not good
since they add some MH-specific stuff to the readline code and not to
bash, but when I first wrote this, I had no idea what else to do.
Chet, would you consider adding this if it were cleaned up a bit?
Made optional with cpp conditionals?
This feature has been very useful to me for the last several years
(since about 1.05 or 1.06, I think).
Thanks,
--
John W. Eaton | 4.3BSD is not perfect. -- Leffler, et al. (1989).
jwe@che.utexas.edu |
-------------------------------cut here-------------------------------
diff -rc bash-1.14.2/bashline.c bash-1.14.2.local/bashline.c
*** bash-1.14.2/bashline.c Wed Aug 3 09:32:45 1994
--- bash-1.14.2.local/bashline.c Wed Sep 21 15:39:04 1994
***************
*** 58,63 ****
--- 58,64 ----
static char *hostname_completion_function ();
static char *command_word_completion_function ();
static char *command_subst_completion_function ();
+ static char *mh_folder_completion_function ();
static void snarf_hosts_from_file (), add_host_name ();
static void sort_hostname_list ();
***************
*** 90,95 ****
--- 91,98 ----
bash_complete_username_internal (),
bash_complete_hostname (), bash_possible_hostname_completions (),
bash_complete_hostname_internal (),
+ bash_complete_mh_folder (), bash_possible_mh_folder_completions (),
+ bash_complete_mh_folder_internal (),
bash_complete_variable (), bash_possible_variable_completions (),
bash_complete_variable_internal (),
bash_complete_command (), bash_possible_command_completions (),
***************
*** 134,140 ****
rl_terminal_name = get_string_value ("TERM");
rl_instream = stdin;
rl_outstream = stderr;
! rl_special_prefixes = "$@";
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "Bash";
--- 137,143 ----
rl_terminal_name = get_string_value ("TERM");
rl_instream = stdin;
rl_outstream = stderr;
! rl_special_prefixes = "$@+";
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "Bash";
***************
*** 193,198 ****
--- 196,207 ----
rl_bind_key_in_map ('@', bash_possible_hostname_completions,
emacs_ctlx_keymap);
+ rl_add_defun ("complete-mh-folder", bash_complete_mh_folder, META('+'));
+ rl_add_defun ("possible-mh-folder-completions",
+ bash_possible_mh_folder_completions, -1);
+ rl_bind_key_in_map ('+', bash_possible_mh_folder_completions,
+ emacs_ctlx_keymap);
+
rl_add_defun ("complete-variable", bash_complete_variable, -1);
rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap);
rl_add_defun ("possible-variable-completions",
***************
*** 656,661 ****
--- 665,677 ----
if (!matches && *text == '@')
matches = completion_matches (text, hostname_completion_function);
+ /* Another one. Why not? If the word starts in '+', then look for
+ matching mh folders for completion first. */
+ if (!matches && *text == '+')
+ {
+ matches = completion_matches (text, mh_folder_completion_function);
+ }
+
/* And last, (but not least) if this word is in a command position, then
complete over possible command names, including aliases, functions,
and command names. */
***************
*** 1077,1082 ****
--- 1093,1185 ----
return ((char *)NULL);
}
+ /* How about a completion function for mh folders? */
+ static char *
+ mh_folder_completion_function (text, state)
+ int state;
+ char *text;
+ {
+ extern int rl_filename_completion_desired;
+
+ extern char *get_mh_path ();
+
+ static char *mh_path = (char *)NULL;
+ static int len;
+ static int istate;
+ static char *val;
+ char *hint;
+
+ static char *mh_folder_hint = (char *)NULL;
+
+ /* If we don't have any state, make some. */
+ if (!state)
+ {
+ val = (char *)NULL;
+
+ if (mh_path)
+ free (mh_path);
+
+ mh_path = get_mh_path ();
+ if (!mh_path && !(hint[1] == '/' || hint[1] == '.'))
+ return ((char *)NULL);
+
+ len = strlen (mh_path);
+ }
+
+ if (mh_folder_hint)
+ free (mh_folder_hint);
+
+ hint = text;
+ if (*hint == '+')
+ hint++;
+
+ mh_folder_hint = (char *)xmalloc (2 + len + strlen (hint));
+ if (*hint == '/' || *hint == '.') {
+ len = -1;
+ sprintf (mh_folder_hint, "%s", hint);
+ } else
+ sprintf (mh_folder_hint, "%s/%s", mh_path, hint);
+
+ istate = (val != (char *)NULL);
+
+ again:
+ val = filename_completion_function (mh_folder_hint, istate);
+ istate = 1;
+
+ if (!val)
+ {
+ return ((char *)NULL);
+ }
+ else
+ {
+ char *ptr = val + len + 1, *temp;
+ struct stat sb;
+ int status = stat (val, &sb);
+
+ if (status != 0)
+ return ((char *)NULL);
+
+ if ((sb.st_mode & S_IFDIR) == S_IFDIR)
+ {
+ temp = (char *)xmalloc (2 + strlen (ptr));
+ *temp = '+';
+ strcpy (temp + 1, ptr);
+
+ free (val);
+ val = "";
+
+ rl_filename_completion_desired = 1;
+
+ return (temp);
+ }
+ else
+ {
+ free (val);
+ }
+ goto again;
+ }
+ }
+
/* History and alias expand the line. */
static char *
history_expand_line_internal (line)
***************
*** 1628,1633 ****
--- 1731,1773 ----
{
bash_specific_completion
(what_to_do, (Function *)username_completion_function);
+ }
+
+ static void
+ bash_complete_mh_folder (ignore, ignore2)
+ int ignore, ignore2;
+ {
+ bash_complete_mh_folder_internal (TAB);
+ }
+
+ static void
+ bash_possible_mh_folder_completions (ignore, ignore2)
+ int ignore, ignore2;
+ {
+ bash_complete_mh_folder_internal ('?');
+ }
+
+ static void
+ bash_complete_mh_folder_internal (what_to_do)
+ int what_to_do;
+ {
+ Function *orig_func;
+ CPPFunction *orig_attempt_func;
+ char *orig_rl_completer_word_break_characters;
+ extern char *rl_completer_word_break_characters;
+
+ orig_func = rl_completion_entry_function;
+ orig_attempt_func = rl_attempted_completion_function;
+ orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
+ rl_completion_entry_function = (Function *)mh_folder_completion_function;
+ rl_attempted_completion_function = (CPPFunction *)NULL;
+ rl_completer_word_break_characters = " \t\n\"\'";
+
+ rl_complete_internal (what_to_do);
+
+ rl_completion_entry_function = orig_func;
+ rl_attempted_completion_function = orig_attempt_func;
+ rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
}
static void
Only in bash-1.14.2.local: bashline.c.orig
diff -rc bash-1.14.2/lib/readline/complete.c bash-1.14.2.local/lib/readline/complete.c
*** bash-1.14.2/lib/readline/complete.c Tue Jul 26 12:59:57 1994
--- bash-1.14.2.local/lib/readline/complete.c Wed Sep 21 15:41:19 1994
***************
*** 733,751 ****
if (rl_filename_completion_desired)
{
struct stat finfo;
! char *filename = tilde_expand (matches[0]);
! if ((stat (filename, &finfo) == 0) && S_ISDIR (finfo.st_mode))
{
! if (rl_line_buffer[rl_point] != '/')
! rl_insert_text ("/");
}
! else
{
! if (rl_point == rl_end)
! rl_insert_text (temp_string);
}
- free (filename);
}
else
{
--- 733,768 ----
if (rl_filename_completion_desired)
{
struct stat finfo;
! char *tilde_expand ();
! char *plus_expand ();
! char *filename = (char *) NULL;
! switch (*matches[0])
{
! case '+':
! filename = plus_expand (matches[0]);
! break;
! case '~':
! default:
! filename = tilde_expand (matches[0]);
! break;
}
!
! if (filename)
{
! if ((stat (filename, &finfo) == 0)
! && S_ISDIR (finfo.st_mode))
! {
! if (rl_line_buffer[rl_point] != '/')
! rl_insert_text ("/");
! }
! else
! {
! if (rl_point == rl_end)
! rl_insert_text (temp_string);
! }
! free (filename);
}
}
else
{
Only in bash-1.14.2.local/lib/readline: diffs
diff -rc bash-1.14.2/lib/readline/readline.c bash-1.14.2.local/lib/readline/readline.c
*** bash-1.14.2/lib/readline/readline.c Fri Aug 12 12:47:46 1994
--- bash-1.14.2.local/lib/readline/readline.c Wed Sep 21 15:36:07 1994
***************
*** 23,28 ****
--- 23,29 ----
#define READLINE_LIBRARY
#include <stdio.h>
+ #include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#if !defined (NO_SYS_FILE)
***************
*** 3518,3523 ****
--- 3519,3616 ----
}
#endif /* TEST */
+
+ #define cr_whitespace(c) ((c) == '\r' || (c) == '\n' || whitespace(c))
+
+ char *
+ get_mh_path ()
+ {
+ static FILE *fp = (FILE *)NULL;
+ char buf[512]; /* XXX */
+ char profile[512]; /* XXX */
+ char *bp;
+ char *temp_home;
+ char *temp_path;
+
+ temp_home = (char *)getenv ("HOME");
+ if (!temp_home)
+ return ((char *)NULL);
+
+ strcpy (profile, temp_home);
+ strcat (profile, "/.mh_profile");
+
+ if (fp)
+ fclose (fp);
+
+ fp = fopen (profile, "r");
+ if (fp == (FILE *)NULL)
+ return ((char *)NULL);
+
+ while (fgets (buf, 512, fp) != (char *)NULL) /* XXX */
+ {
+ if ((bp = strstr (buf, "Path:")) != (char *)NULL)
+ {
+ bp += 5;
+ while (whitespace (*bp))
+ bp++;
+
+ if (*bp == '\0')
+ return ((char *)NULL);
+
+ temp_path = (char *)xmalloc (3 + strlen (bp) + strlen (temp_home));
+
+ strcpy (temp_path, temp_home);
+ strcat (temp_path, "/");
+ strcat (temp_path, bp);
+
+ bp = temp_path;
+
+ while (!(cr_whitespace (*bp)))
+ bp++;
+
+ *bp = '\0';
+
+ return temp_path;
+ }
+ }
+
+ return ((char *)NULL);
+ }
+
+ /* Expand FILENAME if it begins with a plus. This always returns
+ a new string. */
+ char *
+ plus_expand (filename)
+ char *filename;
+ {
+ static char *dirname = (char *)NULL;
+
+ if (filename && *filename == '+')
+ {
+ char *mh_path = get_mh_path ();
+
+ if (filename[1] == '/' || filename[1] == '.')
+ {
+ dirname = (char *)xmalloc (1 + strlen (filename));
+
+ strcpy(dirname, filename+1);
+
+ return dirname;
+ }
+
+ if (mh_path)
+ {
+ dirname = (char *)xmalloc (1 + strlen (filename) + strlen (mh_path));
+
+ strcpy (dirname, mh_path);
+ strcat (dirname, "/");
+ strcat (dirname, filename+1);
+
+ return dirname;
+ }
+ }
+ return (char *)NULL;
+ }
/*
+331
View File
@@ -10772,3 +10772,334 @@ lib/readline/isearch.c
-----
CHANGES,NEWS
- updated for bash-5.3-beta
12/15
-----
lib/readline/histexpand.c
- get_history_event: make sure we don't change history_offset whether
the search succeeds or fails, don't set it to history_length.
Callers don't expect to have the history offset changed out from
under them.
Fixes bug reported by Grisha Levit <grishalevit@gmail.com>
12/16
-----
lib/readline/util.c
- _rl_abort_internal: make sure to clear _rl_command_to_execute
Report and patch from Grisha Levit <grishalevit@gmail.com>
tests/printf7.sub,tests/cond-regexp2.sub
- accommodate different error messages across different systems
1/2/2025
--------
tests/run-all, tests/run-minimal
- BASHOPTS: unset or unexport as appropriate, same as SHELLOPTS
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
1/9
---
subst.c
- string_extract_verbatim: take into account the fact that CTLESC can
quote multibyte characters; use ADVANCE_CHAR instead of increment
Fixes bug reported by jktseug@gmail.com
1/10
----
expr.c
- expr_bind_variable,expr_streval: suppress additional expansion if
called by the `let' builtin, whether or not array_expand_once is set
- expr_skipsubscript: suppress expansion while parsing subscripts
whether array_expand_once is set or not
Still have to change tests if this goes final
These are all conditional on shell_compatibility_level > 51
From a bug-bash post by Greg Wooledge <greg@wooledge.org>
1/14
----
lib/readline/complete.c
- _rl_export_completions: use print_filename instead of fprintf to
display the possible completions so slashes and file types can
be included
From a patch from Matthew Tromp <matthewktromp@gmail.com>
1/15
----
examples/loadables/fltexpr.c
- fltexpr: new loadable builtin to do floating-point arithmetic
expression evaluation and optionally print the result
1/16
----
builtins/printf.def
- getarg(), advancearg(): cosmetic changes to make it easier to
implement %N$ format specifiers in the future
1/18
----
subst.c
- array_length_reference: requesting the length of an element of an
unset variable using array syntax is a fatal error when `set -u'
is enabled and the subscript is not `@' or `*'.
Inspired by a report from Ian Kelling <iank@fsf.org>
1/20
----
parse.y
- decode_prompt_string: since Debian has made the spectaculary bad call
to allow arbitrary characters in usernames, protect the results of
the \u expansion in the same way as \[Ww] and \[Hh] (externally-
controlled data)
From https://savannah.gnu.org/patch/?10496
1/21
----
eval.c
- reader_loop: if we longjmp with ERREXIT, don't reset any local
function contexts in posix mode, since POSIX says to exit as if
executing the `exit builtin with no arguments'. Revision of change
from 7/2022.
From a report by Ivan Shapovalov <intelfx@intelfx.name> in 11/2024
lib/readline/display.c
- rl_redisplay: after calling update_line, when putting the cursor
where it needs to be and reprinting part of the line with the
prompt that contains invisible characters, make sure we start to
output characters at the portion in the prompt buffer that begins
on the current line and only offset by the number of invisible
characters on the current line, and set _rl_last_c_pos accordingly
in both multibyte and singlebyte locales.
Fixes bug reported by Andreas Schwab <schwab@linux-m68k.org>
1/22
----
execute_cmd.c
- execute_builtin_or_function: if we're executing the exec builtin,
and there are redirections, let exec_builtin handle disposing of
redirection_undo_list if there is no program name to execute, so
it's still there if exec returns and doesn't exit the shell.
Then we can manage disposing of exec_redirection_undo_list and
letting the redirections be undone as normal.
This is POSIX interp 1896, with modifications from
https://www.austingroupbugs.net/view.php?id=1896#c7037
builtins/exec.def
- exec_builtin: dispose of redirection_undo_list and set it to NULL
if there is no program name operand; let execute_builtin_or_function
clean it up
1/23
----
lib/readline/terminal.c
- _rl_tcgetwinsize,_rl_tcsetwinsize: function wrappers for tcgetwinsize/
tcsetwinsize with fallbacks to ioctl if those functions aren't
available
- _rl_get_screensize: use _rl_tcgetwinsize
lib/readline/rlwinsize.h
- _rl_tcgetwinsize,_rl_tcsetwinsize: extern function declarations
lib/readine/rltty.c
- set_winsize: use _rl_tcgetwinsize/_rl_tcsetwinsize
- set_winsize: if _rl_tcgetwinsize succeeds, use the values to set
readline's idea of the screen size via _rl_set_screen_size
Inspired by a discussion with Olav Mørkrid <omega@funker.no>
1/24
----
lib/readline/signals.c
- _rl_handling_signal: new private variable, set to the signal we're
currently handling in _rl_signal_handler (SIGWINCH) or
_rl_handle_signal (all others). Only valid if RL_STATE_SIGHANDLER
is set
lib/readline/rlprivate.h
- _rl_handling_signal: new extern declaration
lib/readline/rltty.c
- set_winsize: only set readline's idea of the screen size if we're
executing in a signal handler context and handling SIGTSTP and the
application has indicated that it doesn't want the environment
variables LINES and COLUMNS to have priority (rl_prefer_env_winsize)
1/30
----
jobs.c
- wait_for_single_pid: if wait_for returns -1/ECHILD, make sure to
return 257 just as if the child was not found, optionally printing
an error message if JWAIT_PERROR is supplied
From a discussion with Ian <saturns_rings@protonmail.com>
2/8
---
redir.c
- do_redirection_internal: keep track of whether the redirector fd
was active with a new variable. Not used yet, should be optimized
out.
- add_undo_fd_redirect: new undo function using r_move_input so we
don't need a dup redir and a separate close redir to undo. Not
used yet
- do_redirection_internal: only call check_bash_input if we're
creating an undo list and not running one
command.h
- OUTPUT_REDIRECT: add r_output_force
input.c
- check_bash_input: if we dup the bash input fd to another in
save_bash_input, return that fd. Continue to return -1 on error
and 0 if we don't do anything but sync
execute_cmd.c
- execute_null_command: force a subshell if any of the redirections
involve the bash input buffered fd.
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
2/10
----
examples/loadables/chmod.c
- chmod: new loadable builtin, inspired by zhixu.liu@gmail.com in
https://savannah.gnu.org/patch/?10499
2/11
----
builtins/kill.def
- kill_builtin: in posix mode, return a failure status if any of the
pid/job arguments are not found or sending the signal fails. This
is consistent with
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/kill.html#tag_20_64_14
2/12
----
braces.c
- brace_gobbler: take a new argument in which to return the type of
brace expansion (comma or sequence) we think we've found; change
all callers
- brace_expand: even if we find a BRACE_ARG_SEPARATOR, don't try to
perform expansion if brace_gobbler doesn't think we have a
BRACE_COMMA expansion
- valid_seqterm: new function, performs minimal validation on a
sequence expansion, used to skip over invalid sequence expressions
in brace_expand
- brace_expand: call valid_seqterm if brace_gobbler finds a BRACE_SEQ
expansion
Inspired by report from Robert Elz <kre@munnari.oz.au>
2/13
----
doc/bash.1,doc/bashref.texi
- clarified the handling of double quotes in EXPRESSION in
(( EXPRESSION )) and $(( EXPRESSION )) to say that only unescaped
double quotes are removed
expr.c
- expr_bind_variable,expr_streval: revert change from 1/10 that
suppresses additional expansion when called by the `let' builtin,
tag for possible inclusion in a future release when I can look
at parallel changes to ((...)) and $((...)) (and probably
declare 'a[" "]=12' or similar)
2/14
----
lib/sh/zmapfd.c,externs.h
- zmapfd: now returns ssize_t in case of large files when size_t is
larger than int
builtins/evalfile.c,builtins/help.def
- zmapfd: changed callers
print_cmd.c
- print_redirection: the default file descriptor for <> is 0
Report and fix from Emanuele Torre <torreemanuele6@gmail.com>
2/18
----
configure.ac
- check for d_type member of struct dirent for future use
2/24
----
doc/bash.1,doc/bashref.texi
- document the word expansions performed on indexed array subscripts
and assoc array keys
- document the possibility and effect of empty strings on arithmetic
evaluation for substring expansion, arithmetic expansion, operands
to the the [[ command's arithmetic operators, the expression in
the (( compound command, and indexed array subscripts
2/24
----
execute_cmd.c
- execute_command_internal: if executing a (...) subshell, make sure
to update BASH_COMMAND before exiting on an error return from the
subshell with -e set
Report from Max Bowsher <maxbowsher@gmail.com>
3/3
---
redir.c
- here_document_to_fd: if we are trying to use a pipe for a here
document, but the F_GETPIPE_SZ fcntl returns a value shorter than
the here document length, make sure to close the pipe file descriptors
builtins/ulimit.def
- pipesize: use pathconf and _PC_PIPE_BUF if available
3/8
---
braces.c
- brace_expand: make sure to call valid_seqterm with the right length
so that text[tlen] == '}'
3/10
----
builtins/help.def
- show_manpage: if the first line of long_doc doesn't contain a
newline, e.g., if it's a loadable builtin, add one so there's the
usual space between NAME and SYNOPSIS
m4/codeset.m4
- define HAVE_NL_LANGINFO
lib/sh/strftime.c
- updates for locale-awareness
3/14
----
lib/termcap/termcap.c,lib/termcap/tparam.c
- updates for ISO C
3/17
----
configure.ac
- update release to rc1, update CHANGES and NEWS
3/19
----
lib/readline/rlmbutil.h
- _rl_wcwidth: make sure wchar_t constants have an `L' prefix
3/24
----
subst.c
- function_substitute: set temporary_env to NULL (we've already
set up an unwind-protect for it) before pushing the context, so
pop_context doesn't free it out from underneath the caller.
Report from Emanuele Torre <torreemanuele6@gmail.com>
3/27
----
shell.c
- set_bash_input: if the call to with_input_from_buffered_stream does
not result in a valid buffer corresponding to the file descriptor,
print an error message and set last_command_exit_value
From a report in https://savannah.gnu.org/patch/?10512
4/3
---
lib/sh/gettimeofday.c
- updated from version in gnulib
[bash-5.3-rc1 frozen]
+7
View File
@@ -533,6 +533,7 @@ m4/timespec.m4 f
m4/bison.m4 f
m4/c-bool.m4 f
m4/codeset.m4 f
m4/d-type.m4 f
m4/extern-inline.m4 f
m4/fcntl-o.m4 f
m4/flexmember.m4 f
@@ -645,6 +646,8 @@ po/ru.po f
po/sk.gmo f
po/sk.po f
po/sl.gmo f
po/sq.po f
po/sq.gmo f
po/sr.po f
po/sr.gmo f
po/sl.po f
@@ -782,7 +785,9 @@ examples/loadables/getconf.h f
examples/loadables/getconf.c f
examples/loadables/fdflags.c f
examples/loadables/finfo.c f
examples/loadables/fltexpr.c f
examples/loadables/cat.c f
examples/loadables/chmod.c f
examples/loadables/csv.c f
examples/loadables/dsv.c f
examples/loadables/kv.c f
@@ -963,6 +968,7 @@ tests/arith6.sub f
tests/arith7.sub f
tests/arith8.sub f
tests/arith9.sub f
tests/arith10.sub f
tests/array.tests f
tests/array.right f
tests/array1.sub f
@@ -1178,6 +1184,7 @@ tests/exec13.sub f
tests/exec14.sub f
tests/exec15.sub f
tests/exec16.sub f
tests/exec17.sub f
tests/exp.tests f
tests/exp.right f
tests/exp1.sub f
-24
View File
@@ -1,24 +0,0 @@
#
# Master Manifest file for documentation-only distribution
#
doc d
MANIFEST.doc f
doc/article.ps f
doc/rose94.ps f
doc/bash.ps f
doc/bashbug.ps f
doc/builtins.ps f
doc/rbash.ps f
doc/bashref.ps f
doc/bashref.dvi f
doc/bash.0 f
doc/bashbug.0 f
doc/builtins.0 f
doc/rbash.0 f
doc/article.txt f
doc/bash.html f
doc/bashref.html f
doc/article.pdf f
doc/bash.pdf f
doc/bashref.pdf f
doc/rose94.pdf f
+2 -1
View File
@@ -1,6 +1,6 @@
# Makefile for bash-5.3, version 5.8
#
# Copyright (C) 1996-2024 Free Software Foundation, Inc.
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1182,6 +1182,7 @@ expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h flags.h execute_cmd.h
expr.o: ${BASHINCDIR}/chartypes.h
expr.o: assoc.h ${BASHINCDIR}/ocache.h ${BASHINCDIR}/typemax.h
expr.o: $(DEFSRC)/common.h $(DEFDIR)/builtext.h
findcmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h
findcmd.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h
findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
+16 -7
View File
@@ -29,12 +29,12 @@ j. `trap' has a new -P option that prints the trap action associated with each
signal argument.
k. The `command' builtin preceding a declaration builtin (e.g., `declare')
preserves the special asisgnment statement parsing for the declation
preserves the special asisgnment statement parsing for the declaration
builtin. This is a new POSIX requirement.
l. `printf' uses the `alternate form' for %q and %Q to force single quoting.
m. `printf' now interprets %ls (%S) and %lc (%C)nas referring to wide strings
m. `printf' now interprets %ls (%S) and %lc (%C) as referring to wide strings
and characters, respectively, when in a multibyte locale.
n. The shell can be compiled with a different default value for the
@@ -129,7 +129,7 @@ pp. There is a new `bash_source_fullpath' shopt option, which makes bash put
at configure time.
qq. Posix mode now forces job notifications to occur when the new edition of
POSIX specifes (since it now specifies them).
POSIX specifies (since it now specifies them).
rr. Interactive shells don't print job notifications while sourcing scripts.
@@ -143,6 +143,9 @@ uu. If `exit' is run in a trap and not supplied an exit status argument, it
`top level' and would cause the trap to end (that is, not in a subshell).
This is from Posix interp 1602.
vv. There is a new `fltexpr' builtin to perform floating-point arithmetic
similarly to `let'.
2. New Features in Readline
a. Output a newline if there is no prompt and readline reads an empty line.
@@ -175,18 +178,24 @@ i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former
case, anything bound to quoted-insert) to quote characters in the search
string.
j. Documentation has been significantly updated.
j. There is a new rl_print_keybinding function that prints the key bindings
for a single bindable function specified by name.
k. New `force-meta-prefix' bindable variable, which forces the use of ESC as
k. Documentation has been significantly updated.
l. New `force-meta-prefix' bindable variable, which forces the use of ESC as
the meta prefix when using "\M-" in key bindings instead of overloading
convert-meta.
l. The default value for `readline-colored-completion-prefix' no longer has a
m. The default value for `readline-colored-completion-prefix' no longer has a
leading `.'; the original report was based on a misunderstanding.
m. There is a new bindable command, `export-completions', which writes the
n. There is a new bindable command, `export-completions', which writes the
possible completions for a word to the standard output in a defined format.
o. Readline can reset its idea of the screen dimensions when executing after
a SIGCONT.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-5.2 since
the release of bash-5.1. As always, the manual page (doc/bash.1) is
+24 -19
View File
@@ -45,7 +45,7 @@ editing commands were left out due to objections.
Although Bash is an implementation of the POSIX shell specification,
there are areas where the Bash default behavior differs from the
specification. The Bash “posix mode” changes the Bash behavior in these
areas so that it conforms more closely to the standard.
areas so that it conforms more strictly to the standard.
Starting Bash with the --posix command-line option or executing set
-o posix while Bash is running will cause Bash to conform more closely
@@ -55,7 +55,7 @@ by POSIX in areas where the Bash default differs.
When invoked as sh, Bash enters POSIX mode after reading the startup
files.
The following list is what's changed when 'POSIX mode' is in effect:
The following list is what's changed when POSIX mode is in effect:
1. Bash ensures that the POSIXLY_CORRECT variable is set.
@@ -180,7 +180,7 @@ The following list is what's changed when 'POSIX mode' is in effect:
double-quoted string, even if the histexpand option is enabled.
31. When printing shell function definitions (e.g., by type), Bash
does not print the function keyword unless necessary.
does not print the function reserved word unless necessary.
32. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
@@ -289,72 +289,77 @@ The following list is what's changed when 'POSIX mode' is in effect:
58. The kill builtin does not accept signal names with a SIG
prefix.
59. The printf builtin uses double (via strtod) to convert
59. The kill builtin returns a failure status if any of the pid or
job arguments are invalid or if sending the specified signal to any
of them fails. In default mode, kill returns success if the
signal was successfully sent to any of the specified processes.
60. The printf builtin uses double (via strtod) to convert
arguments corresponding to floating point conversion specifiers,
instead of long double if it's available. The L length
modifier forces printf to use long double if it's available.
60. The pwd builtin verifies that the value it prints is the same as
61. The pwd builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the -P option.
61. The read builtin may be interrupted by a signal for which a trap
62. The read builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
read, the trap handler executes and read returns an exit status
greater than 128.
62. When the set builtin is invoked without options, it does not
63. When the set builtin is invoked without options, it does not
display shell function names and definitions.
63. When the set builtin is invoked without options, it displays
64. When the set builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
64. The test builtin compares strings using the current locale when
65. The test builtin compares strings using the current locale when
evaluating the < and > binary operators.
65. The test builtin's -t unary primary requires an argument.
66. The test builtin's -t unary primary requires an argument.
Historical versions of test made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
66. The trap builtin displays signal names without the leading
67. The trap builtin displays signal names without the leading
SIG.
67. The trap builtin doesn't check the first argument for a possible
68. The trap builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use - as the first argument.
68. trap -p without arguments displays signals whose dispositions
69. trap -p without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
69. The type and command builtins will not report a non-executable
70. The type and command builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in $PATH.
70. The ulimit builtin uses a block size of 512 bytes for the -c
71. The ulimit builtin uses a block size of 512 bytes for the -c
and -f options.
71. The unset builtin with the -v option specified returns a fatal
72. The unset builtin with the -v option specified returns a fatal
error if it attempts to unset a readonly or non-unsettable
variable, which causes a non-interactive shell to exit.
72. When asked to unset a variable that appears in an assignment
73. When asked to unset a variable that appears in an assignment
statement preceding the command, the unset builtin attempts to
unset a variable of the same name in the current or previous scope
as well. This implements the required "if an assigned variable is
further modified by the utility, the modifications made by the
utility shall persist" behavior.
73. The arrival of SIGCHLD when a trap is set on SIGCHLD does not
74. The arrival of SIGCHLD when a trap is set on SIGCHLD does not
interrupt the wait builtin and cause it to return immediately.
The trap command is run once for each child that exits.
74. Bash removes an exited background process's status from the list
75. Bash removes an exited background process's status from the list
of such statuses after the wait builtin returns it.
There is other POSIX behavior that Bash does not implement by default
Vendored
+1 -1
View File
@@ -3,7 +3,7 @@ dnl Bash specific tests
dnl
dnl Some derived from PDKSH 5.1.3 autoconf tests
dnl
dnl Copyright (C) 1987-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1987-2025 Free Software Foundation, Inc.
dnl
dnl
+2 -2
View File
@@ -1,6 +1,6 @@
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
/* Copyright (C) 2001-2024 Free Software Foundation, Inc.
/* Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -916,7 +916,7 @@ assign_array_var_from_string (SHELL_VAR *var, char *value, int flags)
return var;
nlist = expand_compound_array_assignment (var, value, flags);
/* This is were we set ASS_NOEXPAND and ASS_ONEWORD if we need to, since
/* This is where we set ASS_NOEXPAND and ASS_ONEWORD if we need to, since
expand_compound_array_assignment performs word expansions. Honors
array_expand_once; allows @ and * as associative array keys. */
aflags = flags | (array_expand_once ? ASS_NOEXPAND : 0) | ASS_ALLOWALLSUB;
+84 -17
View File
@@ -1,6 +1,6 @@
/* braces.c -- code for doing word expansion in curly braces. */
/* Copyright (C) 1987-2020,2022-2024 Free Software Foundation, Inc.
/* Copyright (C) 1987-2020,2022-2025 Free Software Foundation, Inc.
`
This file is part of GNU Bash, the Bourne Again SHell.
@@ -61,6 +61,11 @@ extern int errno;
#define BRACE_SEQ_SPECIFIER ".."
/* What kind of brace expansion do we think we have? brace_gobbler() decides. */
#define BRACE_COMMA 0x01
#define BRACE_SEQ 0x02
#define BRACE_NONE 0x04
extern int asprintf (char **, const char *, ...) __attribute__((__format__ (printf, 2, 3)));
/* Basic idea:
@@ -75,9 +80,10 @@ extern int asprintf (char **, const char *, ...) __attribute__((__format__ (prin
/* The character which is used to separate arguments. */
static const int brace_arg_separator = ',';
static int brace_gobbler (char *, size_t, int *, int);
static int brace_gobbler (char *, size_t, int *, int *, int);
static char **expand_amble (char *, size_t, int);
static char **expand_seqterm (char *, size_t);
static int valid_seqterm (char *, size_t);
static char **mkseq (intmax_t, intmax_t, intmax_t, int, size_t);
static char **array_concat (char **, char **);
@@ -97,12 +103,12 @@ dump_result (a)
char **
brace_expand (char *text)
{
register int start;
int start;
size_t tlen;
char *preamble, *postamble, *amble;
size_t alen;
char **tack, **result;
int i, j, c, c1;
int i, j, c, c1, etype;
DECLARE_MBSTATE;
@@ -110,13 +116,13 @@ brace_expand (char *text)
tlen = strlen (text);
i = 0;
#if defined (CSH_BRACE_COMPAT)
c = brace_gobbler (text, tlen, &i, '{'); /* } */
c = brace_gobbler (text, tlen, &i, (int *)NULL, '{'); /* } */
#else
/* Make sure that when we exit this loop, c == 0 or text[i] begins a
valid brace expansion sequence. */
do
{
c = brace_gobbler (text, tlen, &i, '{'); /* } */
c = brace_gobbler (text, tlen, &i, (int *)NULL, '{'); /* } */
if (i >= tlen)
break;
c1 = c;
@@ -125,7 +131,16 @@ brace_expand (char *text)
if (c)
{
start = j = i + 1; /* { */
c = brace_gobbler (text, tlen, &j, '}');
c = brace_gobbler (text, tlen, &j, &etype, '}');
#if 1
/* One alternative is to perform validity checking on the sequence
terms here. If the sequence expression is invalid, we just skip
over the open brace and go on, leaving other brace expressions in
the candidate sequence expression to be expanded. */
if (etype == BRACE_SEQ && valid_seqterm (text + start, j - start) == 0)
c = 0;
#endif
if (c == 0) /* it's not */
{
i++;
@@ -160,7 +175,7 @@ brace_expand (char *text)
/* Find the amble. This is the stuff inside this set of braces. */
start = ++i;
c = brace_gobbler (text, tlen, &i, '}');
c = brace_gobbler (text, tlen, &i, &etype, '}');
/* What if there isn't a matching close brace? */
if (c == 0)
@@ -206,8 +221,8 @@ brace_expand (char *text)
#if defined (SHELL)
INITIALIZE_MBSTATE;
/* If the amble does not contain an unquoted BRACE_ARG_SEPARATOR, then
just return without doing any expansion. */
/* If the amble does not contain an unquoted BRACE_ARG_SEPARATOR, and we
think we have a BRACE_COMMA-separated sequence, then do no expansion. */
j = 0;
while (amble[j])
{
@@ -218,14 +233,19 @@ brace_expand (char *text)
continue;
}
if (amble[j] == brace_arg_separator)
if (amble[j] == brace_arg_separator && etype == BRACE_COMMA)
break;
ADVANCE_CHAR (amble, alen, j);
}
if (amble[j] == 0)
/* If we think we have a sequence expression, try to expand it. */
if (amble[j] == 0 && etype == BRACE_SEQ)
{
/* The other alternative (see call to valid_seqterm() above) is to
perform the validity checking in expand_seqterm(). If we do this,
and the sequence isn't valid, we just treat the entire candidate
sequence expansion as a single unexpanded string. */
tack = expand_seqterm (amble, alen);
if (tack)
goto add_tack;
@@ -293,7 +313,7 @@ expand_amble (char *text, size_t tlen, int flags)
c = 1;
while (c)
{
c = brace_gobbler (text, tlen, &i, brace_arg_separator);
c = brace_gobbler (text, tlen, &i, (int *)NULL, brace_arg_separator);
#if defined (SHELL)
tem = substring (text, start, i);
#else
@@ -455,6 +475,44 @@ mkseq (intmax_t start, intmax_t end, intmax_t incr, int type, size_t width)
return (result);
}
/* For now. */
static int
valid_seqterm (char *text, size_t tlen)
{
char *t, *lhs, *rhs;
int lhs_t, rhs_t;
int c;
c = text[tlen]; /* XXX - text[tlen] == RBRACE */
text[tlen] = '\0'; /* don't be tricked by something later in the string */
t = strstr (text, BRACE_SEQ_SPECIFIER);
text[tlen] = c;
if (t == 0)
return 0; /* invalid */
lhs = text;
rhs = t + sizeof(BRACE_SEQ_SPECIFIER) - 1;
/*{*/
if (lhs[0] == BRACE_SEQ_SPECIFIER[0] || rhs[0] == '}')
return 0; /* invalid */
/* Now figure out whether LHS and RHS are integers or letters. Both
sides have to match. Minimal checking here, just enough to throw out the
obvious invalid candidates. */
lhs_t = (ISDIGIT (lhs[0]) || ((lhs[0] == '+' || lhs[0] == '-') && ISDIGIT (lhs[1]))) ? ST_INT :
(ISALPHA (lhs[0]) && lhs[1] == '.') ? ST_CHAR : ST_BAD;
rhs_t = (ISDIGIT (rhs[0]) || ((rhs[0] == '+' || rhs[0] == '-') && ISDIGIT (rhs[1]))) ? ST_INT :
/*{*/ (ISALPHA (rhs[0]) && (rhs[1] == '}' || rhs[1] == '.')) ? ST_CHAR : ST_BAD;
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
return 0; /* invalid */
return 1;
}
static char **
expand_seqterm (char *text, size_t tlen)
{
@@ -577,9 +635,9 @@ expand_seqterm (char *text, size_t tlen)
an inner set of braces.
*/
static int
brace_gobbler (char *text, size_t tlen, int *indx, int satisfy)
brace_gobbler (char *text, size_t tlen, int *indx, int *typep, int satisfy)
{
register int i, c, quoted, level, commas, pass_next;
int i, c, quoted, level, commas, pass_next, btype;
#if defined (SHELL)
size_t si;
char *t;
@@ -587,6 +645,7 @@ brace_gobbler (char *text, size_t tlen, int *indx, int satisfy)
DECLARE_MBSTATE;
level = quoted = pass_next = 0;
btype = BRACE_NONE;
#if defined (CSH_BRACE_COMPAT)
commas = 1;
#else
@@ -719,10 +778,16 @@ comsub:
level--;
#if !defined (CSH_BRACE_COMPAT)
else if (satisfy == '}' && c == brace_arg_separator && level == 0)
commas++;
{
btype = BRACE_COMMA;
commas++;
}
else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) &&
text[i+2] != satisfy && level == 0)
commas++;
{
btype = BRACE_SEQ;
commas++;
}
#endif
#if defined (SHELL)
@@ -733,6 +798,8 @@ comsub:
}
*indx = i;
if (typep)
*typep = btype;
return (c);
}
+7 -6
View File
@@ -1,7 +1,7 @@
This file is exec.def, from which is created exec.c.
It implements the builtin "exec" in Bash.
Copyright (C) 1987-2021,2022,2024 Free Software Foundation, Inc.
Copyright (C) 1987-2021,2022,2024,2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -128,12 +128,13 @@ exec_builtin (WORD_LIST *list)
}
list = loptend;
/* First, let the redirections remain. */
dispose_redirects (redirection_undo_list);
redirection_undo_list = (REDIRECT *)NULL;
/* First, let the redirections remain if exec is called without operands */
if (list == 0)
return (EXECUTION_SUCCESS);
{
dispose_redirects (redirection_undo_list);
redirection_undo_list = (REDIRECT *)NULL;
return (EXECUTION_SUCCESS);
}
#if defined (RESTRICTED_SHELL)
if (restricted)
+21 -4
View File
@@ -1,7 +1,7 @@
This file is help.def, from which is created help.c.
It implements the builtin "help" in Bash.
Copyright (C) 1987-2024 Free Software Foundation, Inc.
Copyright (C) 1987-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -245,7 +245,8 @@ show_longdoc (int i)
static void
show_desc (char *name, int i)
{
register int j, r;
int j;
ssize_t r;
char * const *doc, *line;
int fd, usefile;
@@ -258,8 +259,13 @@ show_desc (char *name, int i)
if (fd < 0)
return;
r = zmapfd (fd, &line, doc[0]);
if (r < 0)
{
builtin_error ("%s: %s: %s", doc[0], _("read error"), strerror (errno));
free (line);
line = (char *)NULL;
}
close (fd);
/* XXX - handle errors if zmapfd returns < 0 */
}
else
line = doc ? doc[0] : (char *)NULL;
@@ -281,6 +287,7 @@ static void
show_manpage (char *name, int i)
{
register int j;
ssize_t r;
char * const *doc;
char *line;
int fd, usefile;
@@ -293,7 +300,13 @@ show_manpage (char *name, int i)
fd = open_helpfile (doc[0]);
if (fd < 0)
return;
zmapfd (fd, &line, doc[0]);
r = zmapfd (fd, &line, doc[0]);
if (r < 0)
{
builtin_error ("%s: %s: %s", doc[0], _("read error"), strerror (errno));
free (line);
line = (char *)NULL;
}
close (fd);
}
else
@@ -308,6 +321,10 @@ show_manpage (char *name, int i)
if (line[j] == '\n')
break;
}
/* If the line doesn't end with a newline, e.g., if it's a loadable builtin,
add one. */
if (line[j] != '\n')
putchar ('\n');
printf ("\n");
/* SYNOPSIS */
+12 -1
View File
@@ -1,7 +1,7 @@
This file is history.def, from which is created history.c.
It implements the builtin "history" in Bash.
Copyright (C) 1987-2024 Free Software Foundation, Inc.
Copyright (C) 1987-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -298,6 +298,11 @@ history_builtin (WORD_LIST *list)
result = read_history (filename);
history_lines_in_file = history_lines_read_from_file;
/* history_lines_in_file = where_history () + history_base - 1; */
#if 0
/* Report read errors from the history library. */
if (result > 0)
builtin_error ("%s: %s: %s", filename, _("read error"), strerror (errno));
#endif
}
else if (flags & NFLAG) /* Read `new' history from file. */
{
@@ -312,6 +317,12 @@ history_builtin (WORD_LIST *list)
history_lines_in_file = history_lines_read_from_file;
/* history_lines_in_file = where_history () + history_base - 1; */
#if 0
/* Report read errors from the history library. */
if (result > 0)
builtin_error ("%s: %s: %s", filename, _("read error"), strerror (errno));
#endif
/* If we're rewriting the history file at shell exit rather than just
appending the lines from this session to it, the question is whether
we reset history_lines_this_session to 0, losing any history entries
-80
View File
@@ -1,80 +0,0 @@
This file is inlib.def, from which is created inlib.c.
It implements the Apollo-specific builtin "inlib" in Bash.
Copyright (C) 1987-2002 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/>.
$PRODUCES inlib.c
#include <config.h>
#include <stdio.h>
#include "../shell.h"
$BUILTIN inlib
$FUNCTION inlib_builtin
$DEPENDS_ON apollo
$SHORT_DOC inlib pathname [pathname...]
Install user-supplied library.
Install a user-supplied library specified by pathname in the current
shell process. The library is used to resolve external references
in programs and libraries loaded after its installation. Note
that the library is not loaded into the address space unless it is
needed to resolve an external reference. The list of inlibed
libraries is passed to all children of the current shell.
Exit Status:
Returns success unless PATHNAME is not found or an error occurs.
$END
#if defined (apollo)
#include <apollo/base.h>
#include <apollo/loader.h>
inlib_builtin (list)
WORD_LIST *list;
{
status_$t status;
int return_value;
short len;
if (!list)
{
builtin_usage ();
return (EX_USAGE);
}
return_value = EXECUTION_SUCCESS;
while (list)
{
len = (short)strlen (list->word->word);
loader_$inlib (list->word->word, len, &status);
if (status.all != status_$ok)
{
builtin_error (_("%s: inlib failed"), list->word->word);
return_value = EXECUTION_FAILURE;
}
list = list->next;
}
return (return_value);
}
#endif /* apollo */
+8 -3
View File
@@ -84,7 +84,7 @@ static void kill_error (pid_t, int);
int
kill_builtin (WORD_LIST *list)
{
int sig, any_succeeded, listing, saw_signal, dflags;
int sig, any_succeeded, any_failed, listing, saw_signal, dflags;
char *sigspec, *word;
pid_t pid;
intmax_t pid_value;
@@ -96,7 +96,7 @@ kill_builtin (WORD_LIST *list)
}
CHECK_HELPOPT (list);
any_succeeded = listing = saw_signal = 0;
any_succeeded = any_failed = listing = saw_signal = 0;
sig = SIGTERM;
sigspec = "TERM";
@@ -199,6 +199,7 @@ use_sigspec:
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
any_failed++;
CONTINUE_OR_FAIL;
}
else
@@ -247,6 +248,7 @@ use_sigspec:
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
any_failed++;
CONTINUE_OR_FAIL;
}
else
@@ -262,7 +264,10 @@ use_sigspec:
list = list->next;
}
return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
if (posixly_correct)
return ((any_failed == 0) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
else
return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
static void
+87 -49
View File
@@ -1,7 +1,7 @@
This file is printf.def, from which is created printf.c.
It implements the builtin "printf" in Bash.
Copyright (C) 1997-2024 Free Software Foundation, Inc.
Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -242,6 +242,12 @@ static char *vbuf, *vname;
static size_t vbsize;
static size_t vblen;
/* printf format numbered argument support */
static char **narg_argv;
static int narg_argc;
static int narg_maxind;
static int narg_curind;
static intmax_t tw;
static char *conv_buf;
@@ -1329,16 +1335,32 @@ mklong (char *str, char *modifiers, size_t mlen)
return (conv_buf);
}
static inline char *
getarg (void)
{
return (garglist ? garglist->word->word : 0);
}
static inline void
advancearg (void)
{
garglist = garglist->next;
}
static int
getchr (void)
{
int ret;
char *arg;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return ('\0');
ret = (int)garglist->word->word[0];
garglist = garglist->next;
ret = (int)arg[0];
advancearg ();
return ret;
}
@@ -1347,11 +1369,11 @@ getstr (void)
{
char *ret;
if (garglist == 0)
ret = getarg ();
if (ret == 0)
return ("");
ret = garglist->word->word;
garglist = garglist->next;
advancearg ();
return ret;
}
@@ -1379,23 +1401,25 @@ static int
getint (int overflow_retval)
{
intmax_t ret;
char *ep;
char *ep, *arg;
int overflow;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
if (arg[0] == '\'' || arg[0] == '"')
return asciicode ();
errno = 0;
ret = strtoimax (garglist->word->word, &ep, 0);
ret = strtoimax (arg, &ep, 0);
if (overflow = (errno == ERANGE) || (ret < INT_MIN || ret > INT_MAX))
errno = ERANGE; /* force errno */
chk_converror (garglist->word->word, ep);
chk_converror (arg, ep);
garglist = garglist->next;
advancearg ();
return (overflow ? overflow_retval : (int)ret);
}
@@ -1403,20 +1427,22 @@ static intmax_t
getintmax (void)
{
intmax_t ret;
char *ep;
char *ep, *arg;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
if (arg[0] == '\'' || arg[0] == '"')
return asciicode ();
errno = 0;
ret = strtoimax (garglist->word->word, &ep, 0);
ret = strtoimax (arg, &ep, 0);
chk_converror (garglist->word->word, ep);
chk_converror (arg, ep);
garglist = garglist->next;
advancearg ();
return (ret);
}
@@ -1424,20 +1450,22 @@ static uintmax_t
getuintmax (void)
{
uintmax_t ret;
char *ep;
char *ep, *arg;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
if (arg[0] == '\'' || arg[0] == '"')
return asciicode ();
errno = 0;
ret = strtoumax (garglist->word->word, &ep, 0);
ret = strtoumax (arg, &ep, 0);
chk_converror (garglist->word->word, ep);
chk_converror (arg, ep);
garglist = garglist->next;
advancearg ();
return (ret);
}
@@ -1445,20 +1473,22 @@ static double
getdouble (void)
{
double ret;
char *ep;
char *ep, *arg;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
if (arg[0] == '\'' || arg[0] == '"')
return asciicode ();
errno = 0;
ret = strtod (garglist->word->word, &ep);
ret = strtod (arg, &ep);
chk_converror (garglist->word->word, ep);
chk_converror (arg, ep);
garglist = garglist->next;
advancearg ();
return (ret);
}
@@ -1466,20 +1496,22 @@ static floatmax_t
getfloatmax (void)
{
floatmax_t ret;
char *ep;
char *ep, *arg;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return (0);
if (garglist->word->word[0] == '\'' || garglist->word->word[0] == '"')
if (arg[0] == '\'' || arg[0] == '"')
return asciicode ();
errno = 0;
ret = strtofltmax (garglist->word->word, &ep);
ret = strtofltmax (arg, &ep);
chk_converror (garglist->word->word, ep);
chk_converror (arg, ep);
garglist = garglist->next;
advancearg ();
return (ret);
}
@@ -1488,23 +1520,25 @@ static intmax_t
asciicode (void)
{
register intmax_t ch;
char *arg;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t slen, mblength;
#endif
DECLARE_MBSTATE;
arg = getarg ();
#if defined (HANDLE_MULTIBYTE)
slen = strlen (garglist->word->word+1);
slen = strlen (arg+1);
wc = 0;
mblength = mbrtowc (&wc, garglist->word->word+1, slen, &state);
mblength = mbrtowc (&wc, arg+1, slen, &state);
if (MB_INVALIDCH (mblength) == 0)
ch = wc; /* XXX */
else
#endif
ch = (unsigned char)garglist->word->word[1];
ch = (unsigned char)arg[1];
garglist = garglist->next;
advancearg ();
return (ch);
}
@@ -1515,16 +1549,18 @@ getwidestr (size_t *lenp)
wchar_t *ws;
const char *mbs;
size_t slen, mblength;
char *arg;
DECLARE_MBSTATE;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
{
if (lenp)
*lenp = 0;
return NULL;
}
mbs = garglist->word->word;
mbs = arg;
slen = strlen (mbs);
ws = (wchar_t *)xmalloc ((slen + 1) * sizeof (wchar_t));
mblength = mbsrtowcs (ws, &mbs, slen + 1, &state);
@@ -1535,13 +1571,13 @@ getwidestr (size_t *lenp)
{
int i;
for (i = 0; i < slen; i++)
ws[i] = (wchar_t)garglist->word->word[i];
ws[i] = (wchar_t)arg[i];
ws[slen] = L'\0';
if (lenp)
*lenp = slen;
}
garglist = garglist->next;
advancearg ();
return (ws);
}
@@ -1550,17 +1586,19 @@ getwidechar (void)
{
wchar_t wc;
size_t slen, mblength;
char *arg;
DECLARE_MBSTATE;
if (garglist == 0)
arg = getarg ();
if (arg == 0)
return L'\0';
wc = 0;
mblength = mbrtowc (&wc, garglist->word->word, locale_mb_cur_max, &state);
mblength = mbrtowc (&wc, arg, locale_mb_cur_max, &state);
if (MB_INVALIDCH (mblength))
wc = (wchar_t)garglist->word->word[0];
wc = (wchar_t)arg[0];
garglist = garglist->next;
advancearg ();
return (wc);
}
+2 -2
View File
@@ -1,7 +1,7 @@
This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
Copyright (C) 1994-2024 Free Software Foundation, Inc.
Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -70,7 +70,7 @@ $END
#define UNSETOPT 0
#define SETOPT 1
#define OPTFMT "%-15s\t%s\n"
#define OPTFMT "%-20s\t%s\n"
extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames;
extern int cdable_vars, mail_warning, source_uses_path;
+17 -2
View File
@@ -1,7 +1,7 @@
This file is ulimit.def, from which is created ulimit.c.
It implements the builtin "ulimit" in Bash.
Copyright (C) 1987-2024 Free Software Foundation, Inc.
Copyright (C) 1987-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -157,7 +157,9 @@ extern int errno;
# define RLIMIT_FILESIZE 256
#endif
#define RLIMIT_PIPESIZE 257
#ifndef RLIMIT_PIPESIZE
# define RLIMIT_PIPESIZE 257
#endif
#ifdef RLIMIT_NOFILE
# define RLIMIT_OPENFILES RLIMIT_NOFILE
@@ -673,9 +675,22 @@ filesize (RLIMTYPE *valuep)
#endif
}
/* The longtime problem here is that PIPE_BUF has atomicity restrictions, and
is not the true pipe capacity. Only a few systems can retrieve this at
runtime. */
static int
pipesize (RLIMTYPE *valuep)
{
#if defined (HAVE_PATHCONF) && defined (_PC_PIPE_BUF)
long r;
r = pathconf (".", _PC_PIPE_BUF);
if (r >= 0)
{
*valuep = (RLIMTYPE) r;
return 0;
}
#endif
#if defined (PIPE_BUF)
/* This is defined on Posix systems. */
*valuep = (RLIMTYPE) PIPE_BUF;
+5 -1
View File
@@ -283,7 +283,11 @@ start_op:
perm |= S_IWUGO;
break;
case 'X':
/* for chmod, this includes S_ISDIR but that doesn't make sense here */
/* for chmod, this includes S_ISDIR but that doesn't make sense for umask */
#if defined (S_IFDIR)
if (this_shell_builtin != umask_builtin && (initial_bits & S_IFDIR) == 0)
break;
#endif
if ((initial_bits & S_IXUGO) == 0)
break; /* no-op if original mask doesn't include execute bits */
/* FALLTHROUGH */
+1 -1
View File
@@ -49,7 +49,7 @@ enum r_instruction {
(ri == r_output_direction || ri == r_err_and_out)
#define OUTPUT_REDIRECT(ri) \
(ri == r_output_direction || ri == r_input_output || ri == r_err_and_out || ri == r_append_err_and_out)
(ri == r_output_direction || ri == r_input_output || ri == r_err_and_out || ri == r_append_err_and_out || ri == r_output_force)
#define INPUT_REDIRECT(ri) \
(ri == r_input_direction || ri == r_inputa_direction || ri == r_input_output)
+2
View File
@@ -434,6 +434,8 @@
#undef HAVE_STRUCT_DIRENT_D_NAMLEN
#undef HAVE_STRUCT_DIRENT_D_TYPE
#undef TIOCSTAT_IN_SYS_IOCTL
#undef FIONREAD_IN_SYS_IOCTL
Vendored
+69 -19
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.074.
# From configure.ac for Bash 5.3, version 5.076.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for bash 5.3-beta.
# Generated by GNU Autoconf 2.72 for bash 5.3-rc1.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -605,8 +605,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.3-beta'
PACKAGE_STRING='bash 5.3-beta'
PACKAGE_VERSION='5.3-rc1'
PACKAGE_STRING='bash 5.3-rc1'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1465,7 +1465,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures bash 5.3-beta to adapt to many kinds of systems.
'configure' configures bash 5.3-rc1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1531,7 +1531,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.3-beta:";;
short | recursive ) echo "Configuration of bash 5.3-rc1:";;
esac
cat <<\_ACEOF
@@ -1739,7 +1739,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.3-beta
bash configure 5.3-rc1
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2417,7 +2417,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.3-beta, which was
It was created by bash $as_me 5.3-rc1, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3216,7 +3216,7 @@ ac_config_headers="$ac_config_headers config.h buildconf.h"
BASHVERS=5.3
RELSTATUS=beta
RELSTATUS=rc1
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -6922,6 +6922,12 @@ fi
# d-type.m4
# serial 12
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
printf %s "checking for an ANSI C-conforming const... " >&6; }
@@ -9222,8 +9228,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9225: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9226: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9231: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9232: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9249,7 +9255,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9252: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9258: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9427,7 +9433,7 @@ fi
fi
fi
echo "$as_me:9430: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9436: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -9674,8 +9680,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9677: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9678: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9683: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9684: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9701,7 +9707,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9704: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9710: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9879,7 +9885,7 @@ fi
fi
fi
echo "$as_me:9882: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9888: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -13461,6 +13467,8 @@ fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5
printf "%s\n" "$am_cv_langinfo_codeset" >&6; }
if test $am_cv_langinfo_codeset = yes; then
printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h
printf "%s\n" "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
@@ -20005,6 +20013,48 @@ printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d_type member in directory struct" >&5
printf %s "checking for d_type member in directory struct... " >&6; }
if test ${gl_cv_struct_dirent_d_type+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
int
main (void)
{
struct dirent dp; dp.d_type = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
gl_cv_struct_dirent_d_type=yes
else case e in #(
e) gl_cv_struct_dirent_d_type=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_struct_dirent_d_type" >&5
printf "%s\n" "$gl_cv_struct_dirent_d_type" >&6; }
if test $gl_cv_struct_dirent_d_type = yes; then
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct winsize in sys/ioctl.h and termios.h" >&5
printf %s "checking for struct winsize in sys/ioctl.h and termios.h... " >&6; }
if test ${bash_cv_struct_winsize_header+y}
@@ -23589,7 +23639,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.3-beta, which was
This file was extended by bash $as_me 5.3-rc1, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23657,7 +23707,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
bash config.status 5.3-beta
bash config.status 5.3-rc1
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
+5 -3
View File
@@ -5,7 +5,7 @@ dnl report bugs to chet.ramey@case.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2024 Free Software Foundation, Inc.
# Copyright (C) 1987-2025 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.3, version 5.074])dnl
AC_REVISION([for Bash 5.3, version 5.076])dnl
define(bashvers, 5.3)
define(relstatus, beta)
define(relstatus, rc1)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -778,6 +778,7 @@ m4_include([m4/glibc21.m4])
m4_include([m4/host-cpu-c-abi.m4])
m4_include([m4/c-bool.m4])
m4_include([m4/d-type.m4])
dnl C compiler characteristics
AC_C_CONST
@@ -1079,6 +1080,7 @@ BASH_STRUCT_TERMIO_LDISC
BASH_STRUCT_DIRENT_D_INO
BASH_STRUCT_DIRENT_D_FILENO
BASH_STRUCT_DIRENT_D_NAMLEN
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
BASH_STRUCT_WINSIZE
BASH_STRUCT_TIMEVAL
AC_CHECK_MEMBERS([struct stat.st_blocks])
-1161
View File
File diff suppressed because it is too large Load Diff
-251
View File
@@ -1,251 +0,0 @@
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overriden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
ac_cv_build=${ac_cv_build='i686-pc-cygwin'}
ac_cv_build_alias=${ac_cv_build_alias='i686-pc-cygwin'}
ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
ac_cv_c_char_unsigned=${ac_cv_c_char_unsigned='no'}
ac_cv_c_compiler_gnu=${ac_cv_c_compiler_gnu='yes'}
ac_cv_c_const=${ac_cv_c_const='yes'}
ac_cv_c_inline=${ac_cv_c_inline='inline'}
ac_cv_c_long_double=${ac_cv_c_long_double='yes'}
ac_cv_c_stringize=${ac_cv_c_stringize='yes'}
ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist='no'}
ac_cv_exeext=${ac_cv_exeext='.exe'}
ac_cv_func___setostype=${ac_cv_func___setostype='no'}
ac_cv_func__doprnt=${ac_cv_func__doprnt='no'}
ac_cv_func_alloca_works=${ac_cv_func_alloca_works='yes'}
ac_cv_func_asprintf=${ac_cv_func_asprintf='no'}
ac_cv_func_bcopy=${ac_cv_func_bcopy='yes'}
ac_cv_func_bindtextdomain=${ac_cv_func_bindtextdomain='no'}
ac_cv_func_bzero=${ac_cv_func_bzero='yes'}
ac_cv_func_confstr=${ac_cv_func_confstr='no'}
ac_cv_func_dlclose=${ac_cv_func_dlclose='yes'}
ac_cv_func_dlopen=${ac_cv_func_dlopen='yes'}
ac_cv_func_dlsym=${ac_cv_func_dlsym='yes'}
ac_cv_func_dup2=${ac_cv_func_dup2='yes'}
ac_cv_func_fnmatch=${ac_cv_func_fnmatch='no'}
ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo='no'}
ac_cv_func_getcwd=${ac_cv_func_getcwd='yes'}
ac_cv_func_getdtablesize=${ac_cv_func_getdtablesize='yes'}
ac_cv_func_getgroups=${ac_cv_func_getgroups='yes'}
ac_cv_func_gethostbyname=${ac_cv_func_gethostbyname='yes'}
ac_cv_func_gethostname=${ac_cv_func_gethostname='yes'}
ac_cv_func_getpagesize=${ac_cv_func_getpagesize='yes'}
ac_cv_func_getpeername=${ac_cv_func_getpeername='yes'}
ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
ac_cv_func_getrlimit=${ac_cv_func_getrlimit='yes'}
ac_cv_func_getrusage=${ac_cv_func_getrusage='yes'}
ac_cv_func_getservbyname=${ac_cv_func_getservbyname='yes'}
ac_cv_func_gettext=${ac_cv_func_gettext='no'}
ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'}
ac_cv_func_inet_aton=${ac_cv_func_inet_aton='yes'}
ac_cv_func_isascii=${ac_cv_func_isascii='yes'}
ac_cv_func_isblank=${ac_cv_func_isblank='no'}
ac_cv_func_isgraph=${ac_cv_func_isgraph='yes'}
ac_cv_func_isprint=${ac_cv_func_isprint='yes'}
ac_cv_func_isspace=${ac_cv_func_isspace='yes'}
ac_cv_func_isxdigit=${ac_cv_func_isxdigit='yes'}
ac_cv_func_killpg=${ac_cv_func_killpg='yes'}
ac_cv_func_lstat=${ac_cv_func_lstat='yes'}
ac_cv_func_memmove=${ac_cv_func_memmove='yes'}
ac_cv_func_mkfifo=${ac_cv_func_mkfifo='yes'}
ac_cv_func_pathconf=${ac_cv_func_pathconf='yes'}
ac_cv_func_putenv=${ac_cv_func_putenv='yes'}
ac_cv_func_readlink=${ac_cv_func_readlink='yes'}
ac_cv_func_rename=${ac_cv_func_rename='yes'}
ac_cv_func_sbrk=${ac_cv_func_sbrk='yes'}
ac_cv_func_select=${ac_cv_func_select='yes'}
ac_cv_func_setdtablesize=${ac_cv_func_setdtablesize='yes'}
ac_cv_func_setenv=${ac_cv_func_setenv='yes'}
ac_cv_func_setlinebuf=${ac_cv_func_setlinebuf='no'}
ac_cv_func_setlocale=${ac_cv_func_setlocale='yes'}
ac_cv_func_setvbuf=${ac_cv_func_setvbuf='yes'}
ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
ac_cv_func_siginterrupt=${ac_cv_func_siginterrupt='no'}
ac_cv_func_snprintf=${ac_cv_func_snprintf='yes'}
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
ac_cv_func_strchr=${ac_cv_func_strchr='yes'}
ac_cv_func_strcoll_works=${ac_cv_func_strcoll_works='yes'}
ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
ac_cv_func_strpbrk=${ac_cv_func_strpbrk='yes'}
ac_cv_func_strtod=${ac_cv_func_strtod='yes'}
ac_cv_func_strtoimax=${ac_cv_func_strtoimax='no'}
ac_cv_func_strtol=${ac_cv_func_strtol='yes'}
ac_cv_func_strtoll=${ac_cv_func_strtoll='no'}
ac_cv_func_strtoul=${ac_cv_func_strtoul='yes'}
ac_cv_func_strtoull=${ac_cv_func_strtoull='no'}
ac_cv_func_strtoumax=${ac_cv_func_strtoumax='no'}
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
ac_cv_func_tcgetpgrp=${ac_cv_func_tcgetpgrp='yes'}
ac_cv_func_textdomain=${ac_cv_func_textdomain='no'}
ac_cv_func_times=${ac_cv_func_times='yes'}
ac_cv_func_ttyname=${ac_cv_func_ttyname='yes'}
ac_cv_func_tzset=${ac_cv_func_tzset='yes'}
ac_cv_func_ulimit=${ac_cv_func_ulimit='no'}
ac_cv_func_uname=${ac_cv_func_uname='yes'}
ac_cv_func_vasprintf=${ac_cv_func_vasprintf='no'}
ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'}
ac_cv_func_vsnprintf=${ac_cv_func_vsnprintf='yes'}
ac_cv_func_wait3=${ac_cv_func_wait3='yes'}
ac_cv_func_waitpid=${ac_cv_func_waitpid='yes'}
ac_cv_have_decl_confstr=${ac_cv_have_decl_confstr='no'}
ac_cv_have_decl_printf=${ac_cv_have_decl_printf='yes'}
ac_cv_have_decl_sbrk=${ac_cv_have_decl_sbrk='yes'}
ac_cv_have_decl_strsignal=${ac_cv_have_decl_strsignal='yes'}
ac_cv_have_decl_strtold=${ac_cv_have_decl_strtold='no'}
ac_cv_header_arpa_inet_h=${ac_cv_header_arpa_inet_h='yes'}
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h='yes'}
ac_cv_header_grp_h=${ac_cv_header_grp_h='yes'}
ac_cv_header_inttypes_h=${ac_cv_header_inttypes_h='no'}
ac_cv_header_libintl_h=${ac_cv_header_libintl_h='yes'}
ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
ac_cv_header_locale_h=${ac_cv_header_locale_h='yes'}
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
ac_cv_header_minix_config_h=${ac_cv_header_minix_config_h='no'}
ac_cv_header_netdb_h=${ac_cv_header_netdb_h='yes'}
ac_cv_header_netinet_in_h=${ac_cv_header_netinet_in_h='yes'}
ac_cv_header_stat_broken=${ac_cv_header_stat_broken='no'}
ac_cv_header_stdarg_h=${ac_cv_header_stdarg_h='yes'}
ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'}
ac_cv_header_stdint_h=${ac_cv_header_stdint_h='no'}
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
ac_cv_header_strings_h=${ac_cv_header_strings_h='yes'}
ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h='yes'}
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
ac_cv_header_sys_pte_h=${ac_cv_header_sys_pte_h='no'}
ac_cv_header_sys_ptem_h=${ac_cv_header_sys_ptem_h='no'}
ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h='yes'}
ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='yes'}
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h='yes'}
ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h='yes'}
ac_cv_header_sys_stream_h=${ac_cv_header_sys_stream_h='no'}
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
ac_cv_header_sys_times_h=${ac_cv_header_sys_times_h='yes'}
ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h='yes'}
ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
ac_cv_header_termcap_h=${ac_cv_header_termcap_h='yes'}
ac_cv_header_termio_h=${ac_cv_header_termio_h='yes'}
ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
ac_cv_header_time=${ac_cv_header_time='yes'}
ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
ac_cv_header_varargs_h=${ac_cv_header_varargs_h='yes'}
ac_cv_host=${ac_cv_host='i686-pc-cygwin'}
ac_cv_host_alias=${ac_cv_host_alias='i686-pc-cygwin'}
ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen='no'}
ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain='yes'}
ac_cv_lib_termcap_tgetent=${ac_cv_lib_termcap_tgetent='yes'}
ac_cv_member_struct_stat_st_blocks=${ac_cv_member_struct_stat_st_blocks='yes'}
ac_cv_member_struct_termio_c_line=${ac_cv_member_struct_termio_c_line='yes'}
ac_cv_member_struct_termios_c_line=${ac_cv_member_struct_termios_c_line='yes'}
ac_cv_objext=${ac_cv_objext='o'}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_prog_AR=${ac_cv_prog_AR='ar'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
ac_cv_prog_ac_ct_CC=${ac_cv_prog_ac_ct_CC='gcc'}
ac_cv_prog_ac_ct_RANLIB=${ac_cv_prog_ac_ct_RANLIB='ranlib'}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
ac_cv_prog_cc_stdc=${ac_cv_prog_cc_stdc=''}
ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional='no'}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
ac_cv_sizeof_char=${ac_cv_sizeof_char='1'}
ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
ac_cv_sys_file_offset_bits=${ac_cv_sys_file_offset_bits='no'}
ac_cv_sys_interpreter=${ac_cv_sys_interpreter='yes'}
ac_cv_sys_large_files=${ac_cv_sys_large_files='no'}
ac_cv_sys_largefile_CC=${ac_cv_sys_largefile_CC='no'}
ac_cv_sys_posix_termios=${ac_cv_sys_posix_termios='yes'}
ac_cv_sys_tiocgwinsz_in_termios_h=${ac_cv_sys_tiocgwinsz_in_termios_h='yes'}
ac_cv_type_bits16_t=${ac_cv_type_bits16_t='no'}
ac_cv_type_bits32_t=${ac_cv_type_bits32_t='no'}
ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
ac_cv_type_char=${ac_cv_type_char='yes'}
ac_cv_type_char_p=${ac_cv_type_char_p='yes'}
ac_cv_type_double=${ac_cv_type_double='yes'}
ac_cv_type_getgroups=${ac_cv_type_getgroups='gid_t'}
ac_cv_type_int=${ac_cv_type_int='yes'}
ac_cv_type_long=${ac_cv_type_long='yes'}
ac_cv_type_long_long=${ac_cv_type_long_long='yes'}
ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'}
ac_cv_type_ptrdiff_t=${ac_cv_type_ptrdiff_t='yes'}
ac_cv_type_short=${ac_cv_type_short='yes'}
ac_cv_type_signal=${ac_cv_type_signal='void'}
ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
ac_cv_type_ssize_t=${ac_cv_type_ssize_t='yes'}
ac_cv_type_time_t=${ac_cv_type_time_t='yes'}
ac_cv_type_u_bits16_t=${ac_cv_type_u_bits16_t='no'}
ac_cv_type_u_bits32_t=${ac_cv_type_u_bits32_t='no'}
ac_cv_type_u_int=${ac_cv_type_u_int='yes'}
ac_cv_type_u_long=${ac_cv_type_u_long='yes'}
ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
ac_cv_working_alloca_h=${ac_cv_working_alloca_h='no'}
bash_cv_decl_strtoimax=${bash_cv_decl_strtoimax='no'}
bash_cv_decl_strtol=${bash_cv_decl_strtol='yes'}
bash_cv_decl_strtoll=${bash_cv_decl_strtoll='no'}
bash_cv_decl_strtoul=${bash_cv_decl_strtoul='yes'}
bash_cv_decl_strtoull=${bash_cv_decl_strtoull='no'}
bash_cv_decl_strtoumax=${bash_cv_decl_strtoumax='no'}
bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
bash_cv_dev_fd=${bash_cv_dev_fd='absent'}
bash_cv_dev_stdin=${bash_cv_dev_stdin='absent'}
bash_cv_dirent_has_d_fileno=${bash_cv_dirent_has_d_fileno='no'}
bash_cv_dirent_has_dino=${bash_cv_dirent_has_dino='yes'}
bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
bash_cv_fionread_in_ioctl=${bash_cv_fionread_in_ioctl='no'}
bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='present'}
bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
bash_cv_getpw_declared=${bash_cv_getpw_declared='yes'}
bash_cv_have_strsignal=${bash_cv_have_strsignal='yes'}
bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
bash_cv_printf_a_format=${bash_cv_printf_a_format='no'}
bash_cv_signal_vintage=${bash_cv_signal_vintage='posix'}
bash_cv_speed_t_in_sys_types=${bash_cv_speed_t_in_sys_types='no'}
bash_cv_struct_timeval=${bash_cv_struct_timeval='yes'}
bash_cv_struct_winsize_header=${bash_cv_struct_winsize_header='termios_h'}
bash_cv_sys_errlist=${bash_cv_sys_errlist='no'}
bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='present'}
bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
bash_cv_termcap_lib=${bash_cv_termcap_lib='libtermcap'}
bash_cv_tiocstat_in_ioctl=${bash_cv_tiocstat_in_ioctl='no'}
bash_cv_type_clock_t=${bash_cv_type_clock_t='yes'}
bash_cv_type_intmax_t=${bash_cv_type_intmax_t='no'}
bash_cv_type_long_long=${bash_cv_type_long_long='long long'}
bash_cv_type_quad_t=${bash_cv_type_quad_t='no'}
bash_cv_type_rlimit=${bash_cv_type_rlimit='rlim_t'}
bash_cv_type_sigset_t=${bash_cv_type_sigset_t='yes'}
bash_cv_type_socklen_t=${bash_cv_type_socklen_t='no'}
bash_cv_type_uintmax_t=${bash_cv_type_uintmax_t='no'}
bash_cv_type_unsigned_long_long=${bash_cv_type_unsigned_long_long='unsigned long long'}
bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
bash_cv_unusable_rtsigs=${bash_cv_unusable_rtsigs='no'}
bash_cv_void_sighandler=${bash_cv_void_sighandler='yes'}
+1577 -1522
View File
File diff suppressed because it is too large Load Diff
+372 -169
View File
File diff suppressed because it is too large Load Diff
+393 -166
View File
File diff suppressed because it is too large Load Diff
+477 -387
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
-10934
View File
File diff suppressed because it is too large Load Diff
-297
View File
@@ -1,297 +0,0 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.4
%%CreationDate: Tue Jan 11 16:04:43 2022
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%DocumentSuppliedResources: procset grops 1.22 4
%%Pages: 1
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.22 4
%!PS-Adobe-3.0 Resource-ProcSet
/setpacking where{
pop
currentpacking
true setpacking
}if
/grops 120 dict dup begin
/SC 32 def
/A/show load def
/B{0 SC 3 -1 roll widthshow}bind def
/C{0 exch ashow}bind def
/D{0 exch 0 SC 5 2 roll awidthshow}bind def
/E{0 rmoveto show}bind def
/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
/G{0 rmoveto 0 exch ashow}bind def
/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/I{0 exch rmoveto show}bind def
/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
/K{0 exch rmoveto 0 exch ashow}bind def
/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/M{rmoveto show}bind def
/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
/O{rmoveto 0 exch ashow}bind def
/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/Q{moveto show}bind def
/R{moveto 0 SC 3 -1 roll widthshow}bind def
/S{moveto 0 exch ashow}bind def
/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/SF{
findfont exch
[exch dup 0 exch 0 exch neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
/MF{
findfont
[5 2 roll
0 3 1 roll
neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
/level0 0 def
/RES 0 def
/PL 0 def
/LS 0 def
/MANUAL{
statusdict begin/manualfeed true store end
}bind def
/PLG{
gsave newpath clippath pathbbox grestore
exch pop add exch pop
}bind def
/BP{
/level0 save def
1 setlinecap
1 setlinejoin
DEFS/BPhook known{DEFS begin BPhook end}if
72 RES div dup scale
LS{
90 rotate
}{
0 PL translate
}ifelse
1 -1 scale
}bind def
/EP{
level0 restore
showpage
}def
/DA{
newpath arcn stroke
}bind def
/SN{
transform
.25 sub exch .25 sub exch
round .25 add exch round .25 add exch
itransform
}bind def
/DL{
SN
moveto
SN
lineto stroke
}bind def
/DC{
newpath 0 360 arc closepath
}bind def
/TM matrix def
/DE{
TM currentmatrix pop
translate scale newpath 0 0 .5 0 360 arc closepath
TM setmatrix
}bind def
/RC/rcurveto load def
/RL/rlineto load def
/ST/stroke load def
/MT/moveto load def
/CL/closepath load def
/Fr{
setrgbcolor fill
}bind def
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
/Fg{
setgray fill
}bind def
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
/setcmykcolor where{
pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
/RE{
findfont
dup maxlength 1 index/FontName known not{1 add}if dict begin
{
1 index/FID ne
2 index/UniqueID ne
and
{def}{pop pop}ifelse
}forall
/Encoding exch def
dup/FontName exch def
currentdict end definefont pop
}bind def
/DEFS 0 def
/EBEGIN{
moveto
DEFS begin
}bind def
/EEND/end load def
/CNT 0 def
/level1 0 def
/PBEGIN{
/level1 save def
translate
div 3 1 roll div exch scale
neg exch neg exch translate
0 setgray
0 setlinecap
1 setlinewidth
0 setlinejoin
10 setmiterlimit
[]0 setdash
/setstrokeadjust where{
pop
false setstrokeadjust
}if
/setoverprint where{
pop
false setoverprint
}if
newpath
/CNT countdictstack def
userdict begin
/showpage{}def
/setpagedevice{}def
mark
}bind def
/PEND{
cleartomark
countdictstack CNT sub{end}repeat
level1 restore
}bind def
end def
/setpacking where{
pop
setpacking
}if
%%EndResource
%%EndProlog
%%BeginSetup
%%BeginFeature: *PageSize Default
<< /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice
%%EndFeature
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
%%IncludeResource: font Times-Italic
grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
/Times-Roman@0 ENC0/Times-Roman RE
%%EndSetup
%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SHB).35 E 116.13
(UG\(1\) General)-.1 F(Commands Manual)2.5 E -.35(BA)118.63 G(SHB).35 E
(UG\(1\))-.1 E/F1 10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0
(bashb)108 96 Q(ug \255 report a b)-.2 E(ug in bash)-.2 E F1(SYNOPSIS)72
112.8 Q/F2 10/Times-Bold@0 SF(bashb)108 124.8 Q(ug)-.2 E F0([)2.5 E/F3
10/Times-Italic@0 SF(--ver)A(sion)-.1 E F0 2.5(][)C F3(--help)-2.5 E F0
2.5(][)C F3(email-addr)-2.5 E(ess)-.37 E F0(])A F1(DESCRIPTION)72 141.6
Q F2(bashb)108 153.6 Q(ug)-.2 E F0 .446
(is a shell script to help the user compose and mail b)2.947 F .446
(ug reports concerning bash in a standard for)-.2 F(-)-.2 E(mat.)108
165.6 Q F2(bashb)5.961 E(ug)-.2 E F0(in)3.461 E -.2(vo)-.4 G -.1(ke).2 G
3.461(st).1 G .962(he editor speci\214ed by the en)-3.461 F .962
(vironment v)-.4 F(ariable)-.25 E/F4 9/Times-Bold@0 SF(EDIT)3.462 E(OR)
-.162 E F0 .962(on a temporary cop)3.212 F 3.462(yo)-.1 G(f)-3.462 E
.374(the b)108 177.6 R .374(ug report format outline. The user must \
\214ll in the appropriate \214elds and e)-.2 F .374(xit the editor)-.15
F(.)-.55 E F2(bashb)5.373 E(ug)-.2 E F0(then)2.873 E 1.141
(mails the completed report to)108 189.6 R F3 -.2(bu)3.641 G
(g-bash@gnu.or).2 E(g)-.37 E F0 3.641(,o)C(r)-3.641 E F3(email-addr)
3.641 E(ess)-.37 E F0 6.141(.I)C 3.641(ft)-6.141 G 1.142
(he report cannot be mailed, it is)-3.641 F(sa)108 201.6 Q -.15(ve)-.2 G
2.5(di).15 G 2.5(nt)-2.5 G(he \214le)-2.5 E F3(dead.bashb)2.5 E(ug)-.2 E
F0(in the in)2.5 E -.2(vo)-.4 G(king user').2 E 2.5(sh)-.55 G
(ome directory)-2.5 E(.)-.65 E .354(The b)108 218.4 R .354
(ug report format outline consists of se)-.2 F -.15(ve)-.25 G .353
(ral sections.).15 F .353(The \214rst section pro)5.353 F .353
(vides information about the)-.15 F .37
(machine, operating system, the bash v)108 230.4 R .371
(ersion, and the compilation en)-.15 F 2.871(vironment. The)-.4 F .371
(second section should)2.871 F .209
(be \214lled in with a description of the b)108 242.4 R 2.709(ug. The)
-.2 F .208(third section should be a description of ho)2.709 F 2.708(wt)
-.25 G 2.708(or)-2.708 G .208(eproduce the)-2.708 F -.2(bu)108 254.4 S
2.5(g. The).2 F(optional fourth section is for a proposed \214x.)2.5 E
(Fix)5 E(es are encouraged.)-.15 E F1(ENVIR)72 271.2 Q(ONMENT)-.329 E F2
(bashb)108 283.2 Q(ug)-.2 E F0(will utilize the follo)2.5 E(wing en)-.25
E(vironment v)-.4 E(ariables if the)-.25 E 2.5(ye)-.15 G(xist:)-2.65 E
F2(EDIT)108 300 Q(OR)-.18 E F0 .327(Speci\214es the preferred editor)144
312 R 2.827(.I)-.55 G(f)-2.827 E F4(EDIT)2.827 E(OR)-.162 E F0 .327
(is not set,)2.577 F F2(bashb)2.827 E(ug)-.2 E F0 .328
(attempts to locate a number of alter)2.827 F(-)-.2 E(nati)144 324 Q
1.925 -.15(ve e)-.25 H 1.625(ditors, including).15 F F2(emacs)4.125 E F0
6.625(.I)C(f)-6.625 E F2(bashb)4.125 E(ug)-.2 E F0 1.625
(cannot locate an)4.125 F 4.125(yo)-.15 G 4.125(ft)-4.125 G 1.625
(he alternati)-4.125 F 1.925 -.15(ve e)-.25 H 1.625(ditors, it at-).15 F
(tempts to e)144 336 Q -.15(xe)-.15 G(cute).15 E F2(vi)2.5 E F0(.)A F2
(HOME)108 352.8 Q F0(Directory in which the f)144 364.8 Q(ailed b)-.1 E
(ug report is sa)-.2 E -.15(ve)-.2 G 2.5(di).15 G 2.5(ft)-2.5 G
(he mail f)-2.5 E(ails.)-.1 E F2(TMPDIR)108 381.6 Q F0
(Directory in which to create temporary \214les and directories.)144
393.6 Q F1(SEE ALSO)72 410.4 Q F3(bash)108 422.4 Q F0(\(1\))A F1 -.548
(AU)72 439.2 S(THORS).548 E F0(Brian F)108 451.2 Q(ox, Free Softw)-.15 E
(are F)-.1 E(oundation)-.15 E(bfox@gnu.or)108 463.2 Q(g)-.18 E
(Chet Rame)108 480 Q 1.3 -.65(y, C)-.15 H(ase W).65 E(estern Reserv)-.8
E 2.5(eU)-.15 G(ni)-2.5 E -.15(ve)-.25 G(rsity).15 E(chet@po.cwru.edu)
108 492 Q(GNU Bash 5.2)72 768 Q(2020 August 1)145.395 E(1)199.555 E 0 Cg
EP
%%Trailer
end
%%EOF
BIN
View File
Binary file not shown.
+384 -171
View File
File diff suppressed because it is too large Load Diff
+477 -387
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
-23253
View File
File diff suppressed because it is too large Load Diff
+361 -155
View File
File diff suppressed because it is too large Load Diff
+435 -422
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
-3627
View File
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1,8 +0,0 @@
#! /bin/sh
#
# Some of these should really be done by options to makeinfo or by
# using @setfilename, but this way we can have both bashref.info and
# bash.info (for installing)
#
sed -e 's|bashref.info|bash.info|g'
+2 -2
View File
@@ -32,8 +32,8 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o Importing function definitions from the shell environment at
startup.
+o Parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup.
+o Parsing the values of BBAASSHHOOPPTTSS and SSHHEELLLLOOPPTTSS from the shell en-
vironment at startup.
+o Redirecting output using the >, >|, <>, >&, &>, and >> redirec-
tion operators.
-324
View File
@@ -1,324 +0,0 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.23.0
%%CreationDate: Thu Apr 4 17:50:31 2024
%%DocumentNeededResources: font Times-Italic
%%+ font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.23 0
%%Pages: 1
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.23 0
%!PS-Adobe-3.0 Resource-ProcSet
/setpacking where{
pop
currentpacking
true setpacking
}if
/grops 120 dict dup begin
% The ASCII code of the space character.
/SC 32 def
/A/show load def
/B{0 SC 3 -1 roll widthshow}bind def
/C{0 exch ashow}bind def
/D{0 exch 0 SC 5 2 roll awidthshow}bind def
/E{0 rmoveto show}bind def
/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
/G{0 rmoveto 0 exch ashow}bind def
/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/I{0 exch rmoveto show}bind def
/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
/K{0 exch rmoveto 0 exch ashow}bind def
/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/M{rmoveto show}bind def
/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
/O{rmoveto 0 exch ashow}bind def
/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/Q{moveto show}bind def
/R{moveto 0 SC 3 -1 roll widthshow}bind def
/S{moveto 0 exch ashow}bind def
/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
% name size font SF -
/SF{
findfont exch
[exch dup 0 exch 0 exch neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
% name a c d font MF -
/MF{
findfont
[5 2 roll
0 3 1 roll % b
neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
/level0 0 def
/RES 0 def
/PL 0 def
/LS 0 def
% Enable manual feed.
% MANUAL -
/MANUAL{
statusdict begin/manualfeed true store end
}bind def
% Guess the page length.
% This assumes that the imageable area is vertically centered on the page.
% PLG - length
/PLG{
gsave newpath clippath pathbbox grestore
exch pop add exch pop
}bind def
% BP -
/BP{
/level0 save def
1 setlinecap
1 setlinejoin
DEFS/BPhook known{DEFS begin BPhook end}if
72 RES div dup scale
LS{
90 rotate
}{
0 PL translate
}ifelse
1 -1 scale
}bind def
/EP{
level0 restore
showpage
}def
% centerx centery radius startangle endangle DA -
/DA{
newpath arcn stroke
}bind def
% x y SN - x' y'
% round a position to nearest (pixel + (.25,.25))
/SN{
transform
.25 sub exch .25 sub exch
round .25 add exch round .25 add exch
itransform
}bind def
% endx endy startx starty DL -
% we round the endpoints of the line, so that parallel horizontal
% and vertical lines will appear even
/DL{
SN
moveto
SN
lineto stroke
}bind def
% centerx centery radius DC -
/DC{
newpath 0 360 arc closepath
}bind def
/TM matrix def
% width height centerx centery DE -
/DE{
TM currentmatrix pop
translate scale newpath 0 0 .5 0 360 arc closepath
TM setmatrix
}bind def
% these are for splines
/RC/rcurveto load def
/RL/rlineto load def
/ST/stroke load def
/MT/moveto load def
/CL/closepath load def
% fill the last path
% r g b Fr -
/Fr{
setrgbcolor fill
}bind def
% c m y k Fk -
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
% g Fg -
/Fg{
setgray fill
}bind def
% fill with the "current color"
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
/setcmykcolor where{
pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
% new_font_name encoding_vector old_font_name RE -
/RE{
findfont
dup maxlength 1 index/FontName known not{1 add}if dict begin
{
1 index/FID ne
2 index/UniqueID ne
and
{def}{pop pop}ifelse
}forall
/Encoding exch def
dup/FontName exch def
currentdict end definefont pop
}bind def
/DEFS 0 def
% hpos vpos EBEGIN -
/EBEGIN{
moveto
DEFS begin
}bind def
/EEND/end load def
/CNT 0 def
/level1 0 def
% llx lly newwid wid newht ht newllx newlly PBEGIN -
/PBEGIN{
/level1 save def
translate
div 3 1 roll div exch scale
neg exch neg exch translate
% set the graphics state to default values
0 setgray
0 setlinecap
1 setlinewidth
0 setlinejoin
10 setmiterlimit
[]0 setdash
/setstrokeadjust where{
pop
false setstrokeadjust
}if
/setoverprint where{
pop
false setoverprint
}if
newpath
/CNT countdictstack def
userdict begin
/showpage{}def
%
% Any included setpagedevice should be ignored.
% See: http://www.w-beer.de/doc/ps/.
%
/setpagedevice{}def
mark
}bind def
/PEND{
cleartomark
countdictstack CNT sub{end}repeat
level1 restore
}bind def
end def
/setpacking where{
pop
setpacking
}if
%%EndResource
%%EndProlog
%%BeginSetup
%%BeginFeature: *PageSize Default
<< /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice
%%EndFeature
%%IncludeResource: font Times-Italic
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE
/Times-Italic@0 ENC0/Times-Italic RE
%%EndSetup
%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Italic@0 SF(RB)72.63 48 Q(ASH)-.25 E/F1 10/Times-Roman@0 SF
131.58(\(1\) General).95 F(Commands Manual)2.5 E F0(RB)134.71 E(ASH)-.25
E F1(\(1\)).95 E/F2 10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F1
(rbash \255 restricted bash, see)108 96 Q/F3 10/Times-Bold@0 SF(bash)2.5
E F1(\(1\))A F2(RESTRICTED SHELL)72 112.8 Q F1(If)108 124.8 Q F3(bash)
3.582 E F1 1.081(is started with the name)3.581 F F3(rbash)3.581 E F1
3.581(,o)C 3.581(rt)-3.581 G(he)-3.581 E F3<ad72>3.581 E F1 1.081
(option is supplied at in)3.581 F -.2(vo)-.4 G 1.081
(cation, the shell becomes re-).2 F 2.976(stricted. A)108 136.8 R .476
(restricted shell is used to set up an en)2.976 F .476
(vironment more controlled than the standard shell.)-.4 F .477(It be-)
5.477 F(ha)108 148.8 Q -.15(ve)-.2 G 2.5(si).15 G(dentically to)-2.5 E
F3(bash)2.5 E F1(with the e)2.5 E(xception that the follo)-.15 E
(wing are disallo)-.25 E(wed or not performed:)-.25 E<83>108 165.6 Q
(changing directories with)144 165.6 Q F3(cd)2.5 E F1<83>108 182.4 Q
(setting or unsetting the v)144 182.4 Q(alues of)-.25 E/F4 9
/Times-Bold@0 SF(SHELL)2.5 E/F5 9/Times-Roman@0 SF(,)A F4 -.666(PA)2.25
G(TH)-.189 E F5(,)A F4(HISTFILE)2.25 E F5(,)A F4(ENV)2.25 E F5(,)A F1
(or)2.25 E F4 -.27(BA)2.5 G(SH_ENV).27 E F1<83>108 199.2 Q
(specifying command names containing)144 199.2 Q F3(/)2.5 E F1<83>108
216 Q(specifying a \214lename containing a)144 216 Q F3(/)2.5 E F1
(as an ar)2.5 E(gument to the)-.18 E F3(.)2.5 E F1 -.2(bu)5 G
(iltin command).2 E<83>108 232.8 Q
(specifying a \214lename containing a slash as an ar)144 232.8 Q
(gument to the)-.18 E F3(history)2.5 E F1 -.2(bu)2.5 G(iltin command).2
E<83>108 249.6 Q .45
(specifying a \214lename containing a slash as an ar)144 249.6 R .449
(gument to the)-.18 F F3<ad70>2.949 E F1 .449(option to the)2.949 F F3
(hash)2.949 E F1 -.2(bu)2.949 G .449(iltin com-).2 F(mand)144 261.6 Q
<83>108 278.4 Q(importing function de\214nitions from the shell en)144
278.4 Q(vironment at startup)-.4 E<83>108 295.2 Q(parsing the v)144
295.2 Q(alue of)-.25 E F4(SHELLOPTS)2.5 E F1(from the shell en)2.25 E
(vironment at startup)-.4 E<83>108 312 Q(redirecting output using the >\
, >|, <>, >&, &>, and >> redirection operators)144 312 Q<83>108 328.8 Q
(using the)144 328.8 Q F3(exec)2.5 E F1 -.2(bu)2.5 G
(iltin command to replace the shell with another command).2 E<83>108
345.6 Q(adding or deleting b)144 345.6 Q(uiltin commands with the)-.2 E
F3<ad66>2.5 E F1(and)2.5 E F3<ad64>2.5 E F1(options to the)2.5 E F3
(enable)2.5 E F1 -.2(bu)2.5 G(iltin command).2 E<83>108 362.4 Q
(using the)144 362.4 Q F3(enable)2.5 E F1 -.2(bu)2.5 G
(iltin command to enable disabled shell b).2 E(uiltins)-.2 E<83>108
379.2 Q(specifying the)144 379.2 Q F3<ad70>2.5 E F1(option to the)2.5 E
F3(command)2.5 E F1 -.2(bu)2.5 G(iltin command).2 E<83>108 396 Q
(turning of)144 396 Q 2.5(fr)-.25 G(estricted mode with)-2.5 E F3
(set +r)2.5 E F1(or)2.5 E F3(shopt \255u r)2.5 E(estricted_shell)-.18 E
F1(.)A(These restrictions are enforced after an)108 412.8 Q 2.5(ys)-.15
G(tartup \214les are read.)-2.5 E .429
(When a command that is found to be a shell script is e)108 429.6 R -.15
(xe)-.15 G(cuted,).15 E F3(rbash)2.929 E F1 .429(turns of)2.929 F 2.929
(fa)-.25 G .729 -.15(ny r)-2.929 H .429(estrictions in the shell).15 F
(spa)108 441.6 Q(wned to e)-.15 E -.15(xe)-.15 G(cute the script.).15 E
F2(SEE ALSO)72 458.4 Q F1(bash\(1\))108 470.4 Q 157.215(Bash-5.2 2021)72
768 R(No)2.5 E -.15(ve)-.15 G(mber 22).15 E(1)190.545 E 0 Cg EP
%%Trailer
end
%%EOF
+4 -4
View File
@@ -1,11 +1,11 @@
@ignore
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2025 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Dec 12 13:37:30 EST 2024
@set LASTCHANGE Mon Feb 24 16:09:32 EST 2025
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 12 December 2024
@set UPDATED-MONTH December 2024
@set UPDATED 24 February 2025
@set UPDATED-MONTH February 2025
+6 -2
View File
@@ -1,6 +1,6 @@
/* eval.c -- reading and evaluating commands. */
/* Copyright (C) 1996-2024 Free Software Foundation, Inc.
/* Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -95,7 +95,11 @@ reader_loop (void)
{
/* Some kind of throw to top_level has occurred. */
case ERREXIT:
if (exit_immediately_on_error)
/* POSIX says to exit on error "as if by executing the
exit special built-in utility with no arguments," so we
don't reset any local contexts and keep the execution
context in a shell function if we were executing one. */
if (exit_immediately_on_error && posixly_correct == 0)
reset_local_contexts (); /* not in a function */
case FORCE_EOF:
case EXITPROG:
+11 -3
View File
@@ -103,8 +103,8 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
ALLPROG = print truefalse sleep finfo logname basename dirname fdflags \
tty pathchk tee head mkdir rmdir mkfifo mktemp printenv id whoami \
uname sync push ln unlink realpath strftime mypid setpgid seq rm \
accept csv dsv cut stat getconf kv strptime
OTHERPROG = necho hello cat pushd asort
accept csv dsv cut stat getconf kv strptime chmod
OTHERPROG = necho hello cat pushd asort fltexpr
SUBDIRS = perl
@@ -238,6 +238,9 @@ strftime: strftime.o
strptime: strptime.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strptime.o $(SHOBJ_LIBS)
chmod: chmod.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ chmod.o $(SHOBJ_LIBS)
mypid: mypid.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mypid.o $(SHOBJ_LIBS)
@@ -250,6 +253,10 @@ stat: stat.o
asort: asort.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ asort.o $(SHOBJ_LIBS)
fltexpr: fltexpr.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ fltexpr.o $(SHOBJ_LIBS) -lm
# pushd is a special case. We use the same source that the builtin version
# uses, with special compilation options.
#
@@ -315,7 +322,7 @@ OBJS = print.o truefalse.o accept.o sleep.o finfo.o getconf.o logname.o \
basename.o dirname.o tty.o pathchk.o tee.o head.o rmdir.o necho.o \
hello.o cat.o csv.o dsv.o kv.o cut.o printenv.o id.o whoami.o uname.o \
sync.o push.o mkdir.o mktemp.o realpath.o strftime.o setpgid.o stat.o \
fdflags.o seq.o asort.o strptime.o
fdflags.o seq.o asort.o strptime.o chmod.o
${OBJS}: ${BUILD_DIR}/config.h
@@ -336,6 +343,7 @@ rmdir.o: rmdir.c
necho.o: necho.c
hello.o: hello.c
cat.o: cat.c
chmod.o: chmod.c
csv.o: csv.c
dsv.o: dsv.c
kv.o: kv.c
+10 -7
View File
@@ -72,17 +72,18 @@ fcopy(int fd, char *fn)
int
cat_main (int argc, char **argv)
{
int i, fd, r;
int i, fd, r, closefd;
char *s;
if (argc == 1)
return (fcopy(0, "standard input"));
for (i = r = 1; i < argc; i++) {
for (i = 1, r = 0; i < argc; i++) {
QUIT;
if (argv[i][0] == '-' && argv[i][1] == '\0')
if (argv[i][0] == '-' && argv[i][1] == '\0') {
fd = 0;
else {
closefd = 0;
} else {
fd = open(argv[i], O_RDONLY, 0666);
if (fd < 0) {
s = strerror(errno);
@@ -91,11 +92,13 @@ cat_main (int argc, char **argv)
write(2, ": ", 2);
write(2, s, strlen(s));
write(2, "\n", 1);
r++;
continue;
}
closefd = 1;
}
r = fcopy(fd, argv[i]);
if (fd != 0)
r += fcopy(fd, argv[i]);
if (closefd)
close(fd);
}
QUIT;
@@ -113,7 +116,7 @@ cat_builtin(WORD_LIST *list)
r = cat_main(c, v);
free(v);
return r;
return r; /* relies on EXECUTION_SUCCESS being 0 */
}
char *cat_doc[] = {
+156
View File
@@ -0,0 +1,156 @@
/* chmod - change file mode bits */
/* See Makefile for compilation details. */
/*
Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GNU Bash.
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>
#include "bashtypes.h"
#include "posixstat.h"
#include <errno.h>
#include <stdio.h>
#include "bashansi.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "builtins.h"
#include "shell.h"
#include "bashgetopt.h"
#include "common.h"
#if !defined (errno)
extern int errno;
#endif
#define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
extern int parse_symbolic_mode (char *, mode_t);
#define STANDARD_BITS (S_IRWXU | S_IRWXG | S_IRWXO)
#define ALLBITS (STANDARD_BITS | S_ISUID| S_ISGID | S_ISVTX)
int
chmod_builtin (WORD_LIST *list)
{
int opt, nmode, lmode, rval;
char *mode;
struct stat st;
WORD_LIST *l;
reset_internal_getopt ();
mode = (char *)NULL;
while ((opt = internal_getopt(list, "fhvRHLP")) != -1)
switch (opt)
{
CASE_HELPOPT;
default:
return (EX_DISKFALLBACK);
}
list = loptend;
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
mode = list->word->word;
list = list->next;
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
nmode = -1;
if (ISOCTAL (*mode)) /* octal number */
{
nmode = read_octal (mode);
if (nmode < 0)
{
builtin_error ("invalid file mode: %s", mode);
return (EXECUTION_FAILURE);
}
}
else /* test for valid symbolic mode */
{
/* initial bits are a=rwx; the mode argument modifies them */
lmode = parse_symbolic_mode (mode, ALLBITS);
if (lmode < 0)
{
builtin_error ("invalid file mode: %s", mode);
return (EXECUTION_FAILURE);
}
}
for (rval = EXECUTION_SUCCESS, l = list; l; l = l->next)
{
lmode = nmode;
if (stat (l->word->word, &st) < 0)
{
builtin_error ("`%s': cannot stat: %s", l->word->word, strerror (errno));
rval = EXECUTION_FAILURE;
continue;
}
if (lmode == -1)
{
lmode = parse_symbolic_mode (mode, st.st_mode & ALLBITS);
if (lmode < 0)
{
builtin_error ("`%s': invalid file mode: %s", l->word->word, mode);
rval = EXECUTION_FAILURE;
continue;
}
}
if (chmod (l->word->word, lmode))
{
builtin_error ("`%s': cannot change mode: %s", l->word->word, strerror (errno));
rval = EXECUTION_FAILURE;
continue;
}
}
return rval;
}
char *chmod_doc[] = {
"Change file mode bits.",
"",
"Change file mode bits. Change the mode bits of files named as",
"arguments, in the order specified, as specified by MODE."
"The MODE argument may be an octal number or a symbolic mode like",
"that described in chmod(1). If a symbolic mode is used, the",
"operations are interpreted relative to an initial mode of \"a=rwx\".",
"",
"The return value is 0 unless an error occurs.",
(char *)NULL
};
struct builtin chmod_struct = {
"chmod",
chmod_builtin,
BUILTIN_ENABLED,
chmod_doc,
"chmod [-R] mode file [file...]",
0
};
File diff suppressed because it is too large Load Diff
+77 -24
View File
@@ -3,7 +3,7 @@
/* See Makefile for compilation details. */
/*
Copyright (C) 2023 Free Software Foundation, Inc.
Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
@@ -87,16 +87,19 @@ static char * const date_time_formats[] =
"%F %r", /* YYYY-mm-dd HH:MM:SS p.m. */
"%F %R", /* YYYY-mm-dd HH:MM */
"%F %I:%M %p", /* YYYY-mm-dd HH:MM a.m. */
"%F", /* YYYY-mm-dd ISO8601 time */
"%T", /* HH:MM:SS */
"%H.%M.%S", /* HH.MM.SS */
/* From coreutils-9.2 date */
"%Y-%m-%dT%H:%M:%S%z", /* ISO8601 time */
"%Y-%m-%dT%H%z", /* ISO8601 time */
"%Y-%m-%dT%H:%M%z", /* ISO8601 time */
"%Y-%m-%dT%H:%M:%S%Z", /* ISO8601 time but with timezone name */
"%Y-%m-%dT%H%Z", /* ISO8601 time but with timezone name */
"%Y-%m-%dT%H:%M%Z", /* ISO8601 time but with timezone name */
/* RFC 3339 time */
"%Y-%m-%d %H:%M:%S%z", /* RFC 3339 time */
"%Y-%m-%dT%H:%M:%S%z", /* RFC 3339 time */
"%Y-%m-%d %H:%M:%S%Z", /* RFC 3339 time but with timezone name */
#if 0
"%Y-%m-%dT%H:%M:%S%z", /* RFC 3339 time, same as first ISO8601 time */
#endif
/* more oddball formats */
"%m.%d.%Y %T", /* mm.dd.YYYY HH:MM:SS */
"%m.%d.%Y %R", /* mm.dd.YYYY HH:MM */
@@ -151,13 +154,28 @@ static char * const date_time_formats[] =
"%d.%m.%Y %R", /* dd.mm.YYYY HH:MM */
"%d.%m.%Y %r", /* dd.mm.YYYY HH:MM:SS a.m. */
"%d.%m.%Y %I:%M %p", /* dd.mm.YYYY HH:MM p.m. */
/* Some fallbacks */
"%F", /* YYYY-mm-dd ISO8601 time */
"%T", /* HH:MM:SS */
"%H.%M.%S", /* HH.MM.SS */
0
};
static void
inittime (time_t *clock, struct tm *timeptr)
{
timeptr = localtime (clock); /* for now */
struct tm *loctime;
/* Initialize to local time */
loctime = localtime (clock);
if (loctime == 0)
{
timeptr->tm_hour = timeptr->tm_min = timeptr->tm_sec = 0;
return;
}
memcpy (timeptr, loctime, sizeof (struct tm));
/* but default to midnight */
timeptr->tm_hour = timeptr->tm_min = timeptr->tm_sec = 0;
@@ -171,17 +189,31 @@ strptime_builtin (WORD_LIST *list)
char *s;
struct tm t, *tm;
time_t now, secs;
char *datestr;
int i;
char *datestr, *format;
int i, opt;
if (no_options (list)) /* for now */
return (EX_USAGE);
format = NULL;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "f:")) != -1)
{
switch (opt)
{
case 'f':
format = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
return (EX_USAGE);
}
datestr = string_list (list);
@@ -195,26 +227,44 @@ strptime_builtin (WORD_LIST *list)
if (STREQ (datestr, date_time_modifiers[i].shorthand))
{
secs = now + date_time_modifiers[i].incr;
break;
printf ("%ld\n", secs);
return (EXECUTION_SUCCESS);
}
}
if (secs == -1)
/* init struct tm */
inittime (&now, &t);
if (format)
{
s = strptime (datestr, format, &t);
if (s == 0 || s == datestr)
{
builtin_error ("%s: unrecognized format", datestr);
return (EXECUTION_FAILURE);
}
}
else
{
/* init struct tm */
inittime (&now, tm);
t = *tm;
for (i = 0; date_time_formats[i]; i++)
{
{
s = strptime (datestr, date_time_formats[i], &t);
if (s == 0)
if (s == 0 || s == datestr)
continue;
/* skip extra characters at the end for now */
secs = mktime (&t);
break;
}
if (date_time_formats[i] == 0)
{
builtin_error ("%s: unrecognized format", datestr);
return (EXECUTION_FAILURE);
}
}
/* Found something. */
secs = mktime (&t);
if (s && *s)
builtin_warning("%s: not completely converted (%s)", datestr, s);
printf ("%ld\n", secs);
return (EXECUTION_SUCCESS);
}
@@ -222,9 +272,12 @@ strptime_builtin (WORD_LIST *list)
char *strptime_doc[] = {
"Convert a date-time string to seconds since the epoch.",
"",
"Take DATE-TIME, a date-time string, parse it against a set of common",
"date-time formats. If the string matches one of the formats, convert",
"it into seconds since the epoch and display the result.",
"Take DATE-TIME, a date-time string, and parse it using FORMAT, a",
"date and time format accepted by strptime(3). If FORMAT is not supplied,",
"attempt to parse DATE-TIME against a set of common date-time formats,",
"not all of which may be acceptable to strptime(3).",
"If the string matches one of the formats, convert it into seconds",
"since the epoch and display the result.",
(char *)NULL
};
@@ -236,6 +289,6 @@ struct builtin strptime_struct = {
strptime_builtin, /* function implementing the builtin */
BUILTIN_ENABLED, /* initial flags for builtin */
strptime_doc, /* array of long documentation strings. */
"strptime date-time", /* usage synopsis; becomes short_doc */
"strptime [-f format] date-time", /* usage synopsis; becomes short_doc */
0 /* reserved for internal use */
};
+55 -40
View File
@@ -88,7 +88,7 @@ function _shellmath_handleError()
# Display error msg, making parameter substitutions as needed
msgParameters="$*"
printf "$msgTemplate" "${msgParameters[@]}"
printf '%s ' "$msgTemplate" "${msgParameters[@]}"; printf '\n'
if ((returnDontExit)); then
return "$returnCode"
@@ -442,7 +442,7 @@ function _shellmath_add()
((isNegative2)) && ((integerPart2*=-1))
local sum=$((integerPart1 + integerPart2))
if (( (!isSubcall) && (isScientific1 || isScientific2) )); then
_shellmath_numToScientific $sum ""
_shellmath_numToScientific $sum ""
_shellmath_getReturnValue sum
fi
_shellmath_setReturnValue $sum
@@ -485,17 +485,11 @@ function _shellmath_add()
# Summing the fractional parts is tricky: We need to override the shell's
# default interpretation of leading zeros, but the operator for doing this
# (the "10#" operator) cannot work directly with negative numbers. So we
# break it all down.
if ((isNegative1)); then
((fractionalSum += (-1) * 10#${fractionalPart1:1}))
else
((fractionalSum += 10#$fractionalPart1))
fi
if ((isNegative2)); then
((fractionalSum += (-1) * 10#${fractionalPart2:1}))
else
((fractionalSum += 10#$fractionalPart2))
fi
# use parameter expansions to separate the \+/-\ signs from the numbers.
((fractionalSum =
${fractionalPart1//[^-]}10#${fractionalPart1//[^0-9]} +
${fractionalPart2//[^-]}10#${fractionalPart2//[^0-9]}))
unsignedFracSumLength=${#fractionalSum}
if [[ "$fractionalSum" =~ ^[-] ]]; then
@@ -515,7 +509,9 @@ function _shellmath_add()
fi
# Carry a digit from fraction to integer if required
if ((10#$fractionalSum!=0 && unsignedFracSumLength > unsignedFracLength)); then
if (( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} !=0 )) &&
((unsignedFracSumLength > unsignedFracLength))
then
local carryAmount
((carryAmount = isNegative1?-1:1))
((integerSum += carryAmount))
@@ -527,34 +523,43 @@ function _shellmath_add()
# pair (-2,3) is not -2.3 but rather (-2)+(0.3), i.e. -1.7 so we want to
# transform (-2,3) to (-1,7). This transformation is meaningful when
# the two parts have opposite signs, so that's what we look for.
if ((integerSum < 0 && 10#$fractionalSum > 0)); then
if ((integerSum < 0)) &&
(( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} > 0))
then
((integerSum += 1))
((fractionalSum = 10#$fractionalSum - 10**unsignedFracSumLength))
elif ((integerSum > 0 && 10#$fractionalSum < 0)); then
((fractionalSum = ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} -
10**unsignedFracSumLength))
elif ((integerSum > 0)) &&
(( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} < 0))
then
((integerSum -= 1))
((fractionalSum = 10**unsignedFracSumLength + 10#$fractionalSum))
((fractionalSum = 10**unsignedFracSumLength +
${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} ))
fi
# This last case needs to function either as an "else" for the above,
# or as a coda to the "if" clause when integerSum is -1 initially.
if ((integerSum == 0 && 10#$fractionalSum < 0)); then
if ((integerSum == 0)) &&
(( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} < 0))
then
integerSum="-"$integerSum
((fractionalSum *= -1))
fi
# Touch up the numbers for display
local sum
((10#$fractionalSum < 0)) && fractionalSum=${fractionalSum:1}
(( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]}< 0)) &&
fractionalSum=${fractionalSum//[-]}
if (( (!isSubcall) && (isScientific1 || isScientific2) )); then
_shellmath_numToScientific "$integerSum" "$fractionalSum"
_shellmath_getReturnValue sum
elif ((10#$fractionalSum)); then
elif (( ${fractionalSum//[^-]}10#${fractionalSum//[^0-9]} )); then
printf -v sum "%s.%s" "$integerSum" "$fractionalSum"
else
sum=$integerSum
fi
# Note the result, print if running "normally", and return
_shellmath_setReturnValue $sum
_shellmath_setReturnValue "$sum"
if (( isVerbose && ! isSubcall )); then
echo "$sum"
fi
@@ -660,9 +665,9 @@ function _shellmath_reduceOuterPairs()
fi
# Discard the least-significant digits or move them past the decimal point
value1=${value1%${tail1}}
value1=${value1%"${tail1}"}
[[ -n "$subvalue1" ]] && subvalue1=${tail1}${subvalue1%0} # remove placeholder zero
value2=${value2%${tail2}}
value2=${value2%"${tail2}"}
[[ -n "$subvalue2" ]] && subvalue2=${tail2}${subvalue2%0}
else
# Signal the caller that no rescaling was actually done
@@ -733,7 +738,7 @@ function _shellmath_round()
number=${number:0:digitCount}
if ((nextDigit >= 5)); then
printf -v number "%0*d" "$digitCount" $((10#$number + 1))
printf -v number "%0*d" "$digitCount" $((${number//[^-]}10#${number//[^0-9]} + 1))
fi
_shellmath_setReturnValue "$number"
@@ -818,11 +823,15 @@ function _shellmath_multiply()
# Overflow / underflow detection and accommodation
local rescalingFactor=0
if ((${#integerPart1} + ${#integerPart2} + ${#fractionalPart1} + ${#fractionalPart2} >= ${__shellmath_precision})); then
if ((${#integerPart1} + ${#integerPart2} + ${#fractionalPart1} + ${#fractionalPart2} >= __shellmath_precision)); then
_shellmath_reduceOuterPairs "$integerPart1" "$integerPart2" "$fractionalPart1" "$fractionalPart2"
_shellmath_getReturnValues integerPart1 integerPart2 fractionalPart1 fractionalPart2 rescalingFactor
if ((10#$fractionalPart1)); then type1=${__shellmath_numericTypes[DECIMAL]}; fi
if ((10#$fractionalPart2)); then type2=${__shellmath_numericTypes[DECIMAL]}; fi
if ((${fractionalPart1//[^-]}10#${fractionalPart1//[^0-9]})); then
type1=${__shellmath_numericTypes[DECIMAL]}
fi
if ((${fractionalPart2//[^-]}10#${fractionalPart2//[^0-9]})); then
type2=${__shellmath_numericTypes[DECIMAL]}
fi
_shellmath_reduceCrossPairs "$integerPart1" "$integerPart2" "$fractionalPart1" "$fractionalPart2"
_shellmath_getReturnValues fractionalPart1 fractionalPart2
@@ -841,7 +850,7 @@ function _shellmath_multiply()
_shellmath_getReturnValue product
fi
if (( (!isSubcall) && (isScientific1 || isScientific2) )); then
_shellmath_numToScientific $product ""
_shellmath_numToScientific $product ""
_shellmath_getReturnValue product
fi
_shellmath_setReturnValue $product
@@ -862,14 +871,16 @@ function _shellmath_multiply()
fractionalWidth1=${#fractionalPart1}
fractionalWidth2=${#fractionalPart2}
((floatWidth = fractionalWidth1 + fractionalWidth2))
((floatProduct = 10#$fractionalPart1 * 10#$fractionalPart2))
((floatProduct =
${fractionalPart1//[^-]}10#${fractionalPart1//[^0-9]} *
${fractionalPart2//[^-]}10#${fractionalPart2//[^0-9]}))
if ((${#floatProduct} < floatWidth)); then
printf -v floatProduct "%0*d" "$floatWidth" "$floatProduct"
fi
# Compute the inner products: First integer-multiply, then rescale
((innerProduct1 = integerPart1 * 10#$fractionalPart2))
((innerProduct2 = integerPart2 * 10#$fractionalPart1))
((innerProduct1 = integerPart1 * ${fractionalPart2//[^-]}10#${fractionalPart2//[^0-9]}))
((innerProduct2 = integerPart2 * ${fractionalPart1//[^-]}10#${fractionalPart1//[^0-9]}))
# Rescale the inner products back to decimals so we can shellmath_add() them
if ((fractionalWidth2 <= ${#innerProduct1})); then
@@ -979,7 +990,9 @@ function _shellmath_divide()
fi
# Throw error on divide by zero
if ((integerPart2 == 0 && 10#$fractionalPart2 == 0)); then
if ((integerPart2 == 0)) &&
(( ${fractionalPart2//[^-]}10#${fractionalPart2//[^0-9]} == 0 ))
then
_shellmath_warn "${__shellmath_returnCodes[DIVIDE_BY_ZERO]}" "$n2"
return $?
fi
@@ -1002,11 +1015,13 @@ function _shellmath_divide()
# Rescale and rewrite the fraction to be computed, and compute it
numerator=${integerPart1}${fractionalPart1}${zeroTail}
denominator=${integerPart2}${fractionalPart2}
((quotient = 10#$numerator / 10#$denominator))
((quotient = ${numerator//[^-]}10#${numerator//[^0-9]} /
${denominator//[^-]}10#${denominator//[^0-9]}))
# For greater precision, re-divide by the remainder to get the next digits of the quotient
local remainder quotient_2
((remainder = 10#$numerator % 10#$denominator)) # cannot exceed numerator or thus, maxValue
((remainder = ${numerator//[^-]}10#${numerator//[^0-9]} %
${denominator//[^-]}10#${denominator//[^0-9]})) # cant exceed numerator or thus, maxValue
((zeroCount = __shellmath_precision - ${#remainder}))
if ((zeroCount > 0)); then
printf -v zeroTail "%0*d" "$zeroCount" 0
@@ -1015,7 +1030,8 @@ function _shellmath_divide()
fi
# Derive the new numerator from the remainder. Do not change the denominator.
numerator=${remainder}${zeroTail}
((quotient_2 = 10#$numerator / 10#$denominator))
((quotient_2 = ${numerator//[^-]}10#${numerator//[^0-9]} /
${denominator//[^-]}10#${denominator//[^0-9]}))
quotient=${quotient}${quotient_2}
((rescaleFactor += ${#quotient_2}))
@@ -1027,12 +1043,12 @@ function _shellmath_divide()
printf -v zeroPrefix "%0*d" "$((rescaleFactor - ${#quotient}))" 0
fi
fractionalPart=${zeroPrefix}${quotient}
_shellmath_round "$fractionalPart" $__shellmath_precision
_shellmath_round "$fractionalPart" "$__shellmath_precision"
_shellmath_getReturnValue fractionalPart
quotient="0."${fractionalPart}
else
fractionalPart=${quotient:(-$rescaleFactor)}
_shellmath_round "$fractionalPart" $__shellmath_precision
_shellmath_round "$fractionalPart" "$__shellmath_precision"
_shellmath_getReturnValue fractionalPart
quotient=${quotient:0:(-$rescaleFactor)}"."${fractionalPart}
fi
@@ -1047,7 +1063,7 @@ function _shellmath_divide()
if [[ "$quotient" =~ [\.].*0$ ]]; then
# If the decimal point IMMEDIATELY precedes the 0s, remove that too
[[ $quotient =~ [\.]?0+$ ]]
quotient=${quotient%${BASH_REMATCH[0]}}
quotient=${quotient%"${BASH_REMATCH[0]}"}
fi
fi
@@ -1065,4 +1081,3 @@ function _shellmath_divide()
return "$__shellmath_SUCCESS"
}
+47 -21
View File
@@ -1,6 +1,6 @@
/* execute_cmd.c -- Execute a COMMAND structure. */
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
/* Copyright (C) 1987-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -776,6 +776,14 @@ execute_command_internal (COMMAND *command, int asynchronous, int pipe_in, int p
if (user_subshell && ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS)
{
/* Update BASH_COMMAND before running any traps,
including the exit trap, since we are going to exit
the shell. */
if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
}
run_pending_traps ();
jump_to_top_level (ERREXIT);
}
@@ -4202,7 +4210,7 @@ execute_null_command (REDIRECT *redirects, int pipe_in, int pipe_out, int async)
{
forcefork += rd->rflags & REDIR_VARASSIGN;
/* Safety */
forcefork += (rd->redirector.dest == 0 || fd_is_bash_input (rd->redirector.dest)) && (INPUT_REDIRECT (rd->instruction) || TRANSLATE_REDIRECT (rd->instruction) || rd->instruction == r_close_this);
forcefork += (rd->redirector.dest == 0 || fd_is_bash_input (rd->redirector.dest));
}
if (forcefork || pipe_in != NO_PIPE || pipe_out != NO_PIPE || async)
@@ -5570,7 +5578,7 @@ execute_builtin_or_function (WORD_LIST *words,
REDIRECT *redirects, struct fd_bitmap *fds_to_close,
int flags)
{
int result;
int result, has_exec_redirects;
REDIRECT *saved_undo_list;
#if defined (PROCESS_SUBSTITUTION)
int ofifo, nfifo, osize;
@@ -5597,17 +5605,25 @@ execute_builtin_or_function (WORD_LIST *words,
return (EX_REDIRFAIL); /* was EXECUTION_FAILURE */
}
/* Is this the exec builtin with redirections? We want to undo them and
throw away the exec_redirection_undo_list if exec has a program name
argument, fails to execute it, and does not exit the shell */
has_exec_redirects = (builtin == exec_builtin) && redirection_undo_list;
saved_undo_list = redirection_undo_list;
/* Calling the "exec" builtin changes redirections forever. */
if (builtin == exec_builtin)
{
dispose_redirects (saved_undo_list);
/* let exec_builtin handle disposing redirection_undo_list */
saved_undo_list = exec_redirection_undo_list;
exec_redirection_undo_list = (REDIRECT *)NULL;
}
else
dispose_exec_redirects ();
{
dispose_exec_redirects ();
redirection_undo_list = (REDIRECT *)NULL;
}
if (saved_undo_list)
{
@@ -5615,8 +5631,6 @@ execute_builtin_or_function (WORD_LIST *words,
add_unwind_protect (uw_cleanup_redirects, (char *)saved_undo_list);
}
redirection_undo_list = (REDIRECT *)NULL;
if (builtin)
result = execute_builtin (builtin, words, flags, 0);
else
@@ -5628,26 +5642,38 @@ execute_builtin_or_function (WORD_LIST *words,
if (ferror (stdout))
clearerr (stdout);
/* If we are executing the `command' builtin, but this_shell_builtin is
set to `exec_builtin', we know that we have something like
`command exec [redirection]', since otherwise `exec' would have
overwritten the shell and we wouldn't get here. In this case, we
want to behave as if the `command' builtin had not been specified
and preserve the redirections. */
if (builtin == command_builtin && this_shell_builtin == exec_builtin)
if (has_exec_redirects && redirection_undo_list)
{
int discard;
discard = 0;
/* We have returned from the exec builtin. If redirection_undo_list is
still non-null, we had an operand and failed to exit the shell for
some reason. We want to dispose of saved_undo_list, discard the frame,
and let the redirections be undone as usual. If redirection_undo_list
is NULL, then exec_builtin had no program name operand and disposed
of it. In that case, we should perform the redirections in
exec_redirection_undo_list (saved_undo_list) like usual. */
if (saved_undo_list)
{
dispose_redirects (saved_undo_list); /* exec_redirection_undo_list */
discard_unwind_frame ("saved-redirects");
}
saved_undo_list = exec_redirection_undo_list = (REDIRECT *)NULL;
}
/* This code is no longer executed and remains only for explanatory reasons. */
else if (builtin == command_builtin && this_shell_builtin == exec_builtin)
{
/* If we are executing the `command' builtin, but this_shell_builtin is
set to `exec_builtin', we know that we have something like
`command exec [redirection]', since otherwise `exec' would have
overwritten the shell and we wouldn't get here. In this case, we
want to behave as if the `command' builtin had not been specified
and preserve the redirections. */
if (saved_undo_list)
{
dispose_redirects (saved_undo_list);
discard = 1;
dispose_redirects (saved_undo_list); /* redirection_undo_list */
discard_unwind_frame ("saved-redirects");
}
redirection_undo_list = exec_redirection_undo_list;
saved_undo_list = exec_redirection_undo_list = (REDIRECT *)NULL;
if (discard)
discard_unwind_frame ("saved-redirects");
}
if (saved_undo_list)
+62 -44
View File
@@ -1,6 +1,6 @@
/* expr.c -- arithmetic expression evaluation. */
/* Copyright (C) 1990-2024 Free Software Foundation, Inc.
/* Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -88,6 +88,9 @@
#include "subst.h"
#include "typemax.h" /* INTMAX_MAX, INTMAX_MIN */
#include "builtins/common.h" /* this_shell_builtin */
#include "builtins/builtext.h" /* let_builtin */
/* Because of the $((...)) construct, expressions may include newlines.
Here is a macro which accepts newlines, tabs and spaces as whitespace. */
#define cr_whitespace(c) (whitespace(c) || ((c) == '\n'))
@@ -194,6 +197,10 @@ static intmax_t expr_streval (char *, int, struct lvalue *);
static intmax_t strlong (char *);
static void evalerror (const char *);
#if defined (ARRAYS)
static int expr_skipsubscript (char *, char *);
#endif
static void pushexp (void);
static void popexp (void);
static void expr_unwind (void);
@@ -330,7 +337,11 @@ expr_bind_variable (const char *lhs, const char *rhs)
return; /* XXX */
#if defined (ARRAY_VARS)
aflags = (array_expand_once && already_expanded) ? ASS_NOEXPAND : 0;
aflags = (array_expand_once && already_expanded) ? ASS_NOEXPAND : 0; /* XXX */
#if 0 /* TAG:bash-5.4 https://lists.gnu.org/archive/html/bug-bash/2024-12/msg00193.html */
if (this_shell_builtin == let_builtin && shell_compatibility_level > 51)
aflags |= ASS_NOEXPAND; /* we didn't quote subscripts */
#endif
aflags |= ASS_ALLOWALLSUB; /* allow assoc[@]=value */
#else
aflags = 0;
@@ -347,18 +358,21 @@ expr_bind_variable (const char *lhs, const char *rhs)
static int
expr_skipsubscript (char *vp, char *cp)
{
int flags, isassoc;
int flags, isassoc, noexp;
SHELL_VAR *entry;
isassoc = 0;
isassoc = noexp = 0;
entry = 0;
if (array_expand_once & already_expanded)
/* We're not doing any evaluation here, we should suppress expansion when
skipping over the subscript */
noexp = already_expanded && (shell_compatibility_level > 51 || array_expand_once);
if (noexp)
{
*cp = '\0';
isassoc = valid_identifier (vp) && (entry = find_variable (vp)) && assoc_p (entry);
*cp = '['; /* ] */
}
flags = (isassoc && array_expand_once && already_expanded) ? VA_NOEXPAND : 0;
flags = (isassoc && noexp) ? VA_NOEXPAND : 0;
return (skipsubscript (cp, 0, flags));
}
@@ -881,9 +895,7 @@ expmuldiv (void)
val1 = exppower ();
while ((curtok == MUL) ||
(curtok == DIV) ||
(curtok == MOD))
while ((curtok == MUL) || (curtok == DIV) || (curtok == MOD))
{
int op = curtok;
char *stp, *sltp;
@@ -1057,47 +1069,49 @@ exp0 (void)
/* Skip over closing paren. */
readtok ();
}
else if ((curtok == NUM) || (curtok == STR))
else if (curtok == NUM)
{
val = tokval;
if (curtok == STR)
readtok ();
}
else if (curtok == STR)
{
val = tokval;
SAVETOK (&ec);
tokstr = (char *)NULL; /* keep it from being freed */
noeval = 1;
readtok ();
stok = curtok;
/* post-increment or post-decrement */
if (stok == POSTINC || stok == POSTDEC)
{
SAVETOK (&ec);
tokstr = (char *)NULL; /* keep it from being freed */
noeval = 1;
readtok ();
stok = curtok;
/* restore certain portions of EC */
tokstr = ec.tokstr;
noeval = ec.noeval;
curlval = ec.lval;
lasttok = STR; /* ec.curtok */
/* post-increment or post-decrement */
if (stok == POSTINC || stok == POSTDEC)
{
/* restore certain portions of EC */
tokstr = ec.tokstr;
noeval = ec.noeval;
curlval = ec.lval;
lasttok = STR; /* ec.curtok */
v2 = val + ((stok == POSTINC) ? 1 : -1);
vincdec = itos (v2);
if (noeval == 0)
{
v2 = val + ((stok == POSTINC) ? 1 : -1);
vincdec = itos (v2);
if (noeval == 0)
{
#if defined (ARRAY_VARS)
if (curlval.ind != -1)
expr_bind_array_element (curlval.tokstr, curlval.ind, vincdec);
else
if (curlval.ind != -1)
expr_bind_array_element (curlval.tokstr, curlval.ind, vincdec);
else
#endif
expr_bind_variable (tokstr, vincdec);
}
free (vincdec);
curtok = NUM; /* make sure x++=7 is flagged as an error */
}
else
{
/* XXX - watch out for pointer aliasing issues here */
if (stok == STR) /* free new tokstr before old one is restored */
FREE (tokstr);
RESTORETOK (&ec);
}
expr_bind_variable (tokstr, vincdec);
}
free (vincdec);
curtok = NUM; /* make sure x++=7 is flagged as an error */
}
else
{
/* XXX - watch out for pointer aliasing issues here */
if (stok == STR) /* free new tokstr before old one is restored */
FREE (tokstr);
RESTORETOK (&ec);
}
readtok ();
@@ -1155,6 +1169,10 @@ expr_streval (char *tok, int e, struct lvalue *lvalue)
#if defined (ARRAY_VARS)
tflag = (array_expand_once && already_expanded) ? AV_NOEXPAND : 0; /* for a start */
#if 0 /* TAG:bash-5.4 https://lists.gnu.org/archive/html/bug-bash/2024-12/msg00193.html */
if (this_shell_builtin == let_builtin && shell_compatibility_level > 51)
tflag |= AV_NOEXPAND; /* we didn't quote subscripts */
#endif
#endif
/* [[[[[ */
+2 -2
View File
@@ -1,7 +1,7 @@
/* externs.h -- extern function declarations which do not appear in their
own header file. */
/* Copyright (C) 1993-2024 Free Software Foundation, Inc.
/* Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -550,7 +550,7 @@ extern int zcatfd (int, int, const char *);
extern ssize_t zgetline (int, char **, size_t *, int, int);
/* declarations for functions defined in lib/sh/zmapfd.c */
extern int zmapfd (int, char **, const char *);
extern ssize_t zmapfd (int, char **, const char *);
/* declarations for functions defined in lib/sh/zread.c */
extern ssize_t zread (int, char *, size_t);
+1
View File
@@ -213,6 +213,7 @@ typedef int sh_glist_func_t (GENERIC_LIST *);
typedef int sh_gcp_func_t (GENERIC_LIST *, char *);
typedef char *sh_string_func_t (char *); /* like savestring, et al. */
typedef void *sh_copy_func_t (void *); /* generic copy function */
typedef int sh_msg_func_t (const char *, ...); /* printf(3)-like */
typedef void sh_vmsg_func_t (const char *, ...); /* printf(3)-like */
+3 -3
View File
@@ -50,7 +50,7 @@
don't discard the upper 32 bits of the value, if present. */
#define HASH_BUCKET(s, t, h) (((h) = hash_string (s)) & ((t)->nbuckets - 1))
static BUCKET_CONTENTS *copy_bucket_array (BUCKET_CONTENTS *, sh_string_func_t *);
static BUCKET_CONTENTS *copy_bucket_array (BUCKET_CONTENTS *, sh_copy_func_t *);
static void hash_rehash (HASH_TABLE *, int);
static void hash_grow (HASH_TABLE *);
@@ -88,7 +88,7 @@ hash_size (HASH_TABLE *table)
/* Copy a hash table bucket array. Call (*cpdata) to copy the data from
each element. */
static BUCKET_CONTENTS *
copy_bucket_array (BUCKET_CONTENTS *ba, sh_string_func_t *cpdata)
copy_bucket_array (BUCKET_CONTENTS *ba, sh_copy_func_t *cpdata)
{
BUCKET_CONTENTS *new_bucket, *n, *e;
@@ -171,7 +171,7 @@ hash_shrink (HASH_TABLE *table)
/* Copy an entire hash table. (*cpdata) copies the data in each element. */
HASH_TABLE *
hash_copy (HASH_TABLE *table, sh_string_func_t *cpdata)
hash_copy (HASH_TABLE *table, sh_copy_func_t *cpdata)
{
HASH_TABLE *new_table;
int i;
+1 -1
View File
@@ -45,7 +45,7 @@ typedef int hash_wfunc (BUCKET_CONTENTS *);
/* Operations on tables as a whole */
extern HASH_TABLE *hash_create (int);
extern HASH_TABLE *hash_copy (HASH_TABLE *, sh_string_func_t *);
extern HASH_TABLE *hash_copy (HASH_TABLE *, sh_copy_func_t *);
extern void hash_flush (HASH_TABLE *, sh_free_func_t *);
extern void hash_dispose (HASH_TABLE *);
extern void hash_walk (HASH_TABLE *, hash_wfunc *);
+1 -1
View File
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2008,2009 Free Software Foundation, Inc.
Copyright (C) 1995-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
+8
View File
@@ -90,4 +90,12 @@ getnow(void)
} while (0)
#endif
#ifndef TIMESPEC_TO_TIMEVAL
# define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (tv)->tv_nsec / 1000; \
} while (0)
#endif
#endif /* _POSIXTIME_H_ */
+6 -1
View File
@@ -302,10 +302,15 @@ save_bash_input (int fd, int new_fd)
int
check_bash_input (int fd)
{
int nfd;
if (fd_is_bash_input (fd))
{
if (fd > 0)
return ((save_bash_input (fd, -1) == -1) ? -1 : 0);
{
nfd = save_bash_input (fd, -1); /* allocates new fd */
return (nfd);
}
else if (fd == 0)
return ((sync_buffered_stream (fd) == -1) ? -1 : 0);
}
+4 -1
View File
@@ -3,7 +3,7 @@
/* This file works with both POSIX and BSD systems. It implements job
control. */
/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -2749,6 +2749,7 @@ wait_for_single_pid (pid_t pid, int flags)
if (child == 0)
{
no_child:
if (flags & JWAIT_PERROR)
internal_error (_("wait: pid %ld is not a child of this shell"), (long)pid);
return (257);
@@ -2758,6 +2759,8 @@ wait_for_single_pid (pid_t pid, int flags)
do
{
r = wait_for (pid, 0);
if (r == -1 && errno == ECHILD)
goto no_child;
if ((flags & JWAIT_FORCE) == 0)
break;
-50
View File
@@ -1,50 +0,0 @@
/* <dir.h> -- definitions for 4.2BSD-compatible directory access.
last edit: 09-Jul-1983 D A Gwyn. */
#if defined (VMS)
# if !defined (FAB$C_BID)
# include <fab.h>
# endif
# if !defined (NAM$C_BID)
# include <nam.h>
# endif
# if !defined (RMS$_SUC)
# include <rmsdef.h>
# endif
# include "dir.h"
#endif /* VMS */
/* Size of directory block. */
#define DIRBLKSIZ 512
/* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
#if defined (VMS)
# define MAXNAMLEN (DIR$S_NAME + 7) /* 80 plus room for version #. */
# define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */
#else
# define MAXNAMLEN 15 /* Maximum filename length. */
#endif /* VMS */
/* Data from readdir (). */
struct direct {
long d_ino; /* Inode number of entry. */
unsigned short d_reclen; /* Length of this record. */
unsigned short d_namlen; /* Length of string in d_name. */
char d_name[MAXNAMLEN + 1]; /* Name of file. */
};
/* Stream data from opendir (). */
typedef struct {
int dd_fd; /* File descriptor. */
int dd_loc; /* Offset in block. */
int dd_size; /* Amount of valid data. */
char dd_buf[DIRBLKSIZ]; /* Directory block. */
} DIR;
extern DIR *opendir ();
extern struct direct *readdir ();
extern long telldir ();
extern void seekdir (), closedir ();
#define rewinddir(dirp) seekdir (dirp, 0L)
-4
View File
@@ -1,4 +0,0 @@
2003-05-22 GNU <bug-gnu-gettext@gnu.org>
* Version 0.12.1 released.
-465
View File
@@ -1,465 +0,0 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
# Copyright (C) 2000-2009 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# The table consists of lines of the form
# ALIAS CANONICAL
#
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
# ALIAS is compared in a case sensitive way.
#
# CANONICAL is the GNU canonical name for this character encoding.
# It must be an encoding supported by libiconv. Support by GNU libc is
# also desirable. CANONICAL is case insensitive. Usually an upper case
# MIME charset name is preferred.
# The current list of GNU canonical charset names is as follows.
#
# name used by which systems a MIME name?
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-3 glibc solaris yes
# ISO-8859-4 osf solaris freebsd yes
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-6 glibc aix hpux solaris yes
# ISO-8859-7 glibc aix hpux irix osf solaris yes
# ISO-8859-8 glibc aix hpux osf solaris yes
# ISO-8859-9 glibc aix hpux irix osf solaris yes
# ISO-8859-13 glibc
# ISO-8859-14 glibc
# ISO-8859-15 glibc aix osf solaris freebsd
# KOI8-R glibc solaris freebsd yes
# KOI8-U glibc freebsd yes
# KOI8-T glibc
# CP437 dos
# CP775 dos
# CP850 aix osf dos
# CP852 dos
# CP855 dos
# CP856 aix
# CP857 dos
# CP861 dos
# CP862 dos
# CP864 dos
# CP865 dos
# CP866 freebsd dos
# CP869 dos
# CP874 woe32 dos
# CP922 aix
# CP932 aix woe32 dos
# CP943 aix
# CP949 osf woe32 dos
# CP950 woe32 dos
# CP1046 aix
# CP1124 aix
# CP1125 dos
# CP1129 aix
# CP1250 woe32
# CP1251 glibc solaris woe32
# CP1252 aix woe32
# CP1253 woe32
# CP1254 woe32
# CP1255 glibc woe32
# CP1256 woe32
# CP1257 woe32
# GB2312 glibc aix hpux irix solaris freebsd yes
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
# EUC-TW glibc aix hpux irix osf solaris
# BIG5 glibc aix hpux osf solaris freebsd yes
# BIG5-HKSCS glibc solaris
# GBK glibc aix osf solaris woe32 dos
# GB18030 glibc solaris
# SHIFT_JIS hpux osf solaris freebsd yes
# JOHAB glibc solaris woe32
# TIS-620 glibc aix hpux osf solaris
# VISCII glibc yes
# TCVN5712-1 glibc
# GEORGIAN-PS glibc
# HP-ROMAN8 hpux
# HP-ARABIC8 hpux
# HP-GREEK8 hpux
# HP-HEBREW8 hpux
# HP-TURKISH8 hpux
# HP-KANA8 hpux
# DEC-KANJI osf
# DEC-HANYU osf
# UTF-8 glibc aix hpux osf solaris yes
#
# Note: Names which are not marked as being a MIME name should not be used in
# Internet protocols for information interchange (mail, news, etc.).
#
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
# must understand both names and treat them as equivalent.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
host="$1"
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
echo "# This file contains a table of character encoding aliases,"
echo "# suitable for operating system '${os}'."
echo "# It was automatically generated from config.charset."
# List of references, updated during installation:
echo "# Packages using this file: "
case "$os" in
linux* | *-gnu*)
# With glibc-2.1 or newer, we don't need any canonicalization,
# because glibc has iconv and both glibc and libiconv support all
# GNU canonical names directly. Therefore, the Makefile does not
# need to install the alias file at all.
# The following applies only to glibc-2.0.x and older libcs.
echo "ISO_646.IRV:1983 ASCII"
;;
aix*)
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-6 ISO-8859-6"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-8 ISO-8859-8"
echo "ISO8859-9 ISO-8859-9"
echo "ISO8859-15 ISO-8859-15"
echo "IBM-850 CP850"
echo "IBM-856 CP856"
echo "IBM-921 ISO-8859-13"
echo "IBM-922 CP922"
echo "IBM-932 CP932"
echo "IBM-943 CP943"
echo "IBM-1046 CP1046"
echo "IBM-1124 CP1124"
echo "IBM-1129 CP1129"
echo "IBM-1252 CP1252"
echo "IBM-eucCN GB2312"
echo "IBM-eucJP EUC-JP"
echo "IBM-eucKR EUC-KR"
echo "IBM-eucTW EUC-TW"
echo "big5 BIG5"
echo "GBK GBK"
echo "TIS-620 TIS-620"
echo "UTF-8 UTF-8"
;;
hpux*)
echo "iso88591 ISO-8859-1"
echo "iso88592 ISO-8859-2"
echo "iso88595 ISO-8859-5"
echo "iso88596 ISO-8859-6"
echo "iso88597 ISO-8859-7"
echo "iso88598 ISO-8859-8"
echo "iso88599 ISO-8859-9"
echo "iso885915 ISO-8859-15"
echo "roman8 HP-ROMAN8"
echo "arabic8 HP-ARABIC8"
echo "greek8 HP-GREEK8"
echo "hebrew8 HP-HEBREW8"
echo "turkish8 HP-TURKISH8"
echo "kana8 HP-KANA8"
echo "tis620 TIS-620"
echo "big5 BIG5"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
echo "hp15CN GB2312"
#echo "ccdc ?" # what is this?
echo "SJIS SHIFT_JIS"
echo "utf8 UTF-8"
;;
irix*)
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-9 ISO-8859-9"
echo "eucCN GB2312"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
;;
osf*)
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-8 ISO-8859-8"
echo "ISO8859-9 ISO-8859-9"
echo "ISO8859-15 ISO-8859-15"
echo "cp850 CP850"
echo "big5 BIG5"
echo "dechanyu DEC-HANYU"
echo "dechanzi GB2312"
echo "deckanji DEC-KANJI"
echo "deckorean EUC-KR"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
echo "GBK GBK"
echo "KSC5601 CP949"
echo "sdeckanji EUC-JP"
echo "SJIS SHIFT_JIS"
echo "TACTIS TIS-620"
echo "UTF-8 UTF-8"
;;
solaris*)
echo "646 ASCII"
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-3 ISO-8859-3"
echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-6 ISO-8859-6"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-8 ISO-8859-8"
echo "ISO8859-9 ISO-8859-9"
echo "ISO8859-15 ISO-8859-15"
echo "koi8-r KOI8-R"
echo "ansi-1251 CP1251"
echo "BIG5 BIG5"
echo "Big5-HKSCS BIG5-HKSCS"
echo "gb2312 GB2312"
echo "GBK GBK"
echo "GB18030 GB18030"
echo "cns11643 EUC-TW"
echo "5601 EUC-KR"
echo "ko_KR.johap92 JOHAB"
echo "eucJP EUC-JP"
echo "PCK SHIFT_JIS"
echo "TIS620.2533 TIS-620"
#echo "sun_eu_greek ?" # what is this?
echo "UTF-8 UTF-8"
;;
freebsd* | os2*)
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
# Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
# reuse FreeBSD's locale data for OS/2.
echo "C ASCII"
echo "US-ASCII ASCII"
for l in la_LN lt_LN; do
echo "$l.ASCII ASCII"
done
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
echo "$l.ISO_8859-1 ISO-8859-1"
echo "$l.DIS_8859-15 ISO-8859-15"
done
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
echo "$l.ISO_8859-2 ISO-8859-2"
done
for l in la_LN lt_LT; do
echo "$l.ISO_8859-4 ISO-8859-4"
done
for l in ru_RU ru_SU; do
echo "$l.KOI8-R KOI8-R"
echo "$l.ISO_8859-5 ISO-8859-5"
echo "$l.CP866 CP866"
done
echo "uk_UA.KOI8-U KOI8-U"
echo "zh_TW.BIG5 BIG5"
echo "zh_TW.Big5 BIG5"
echo "zh_CN.EUC GB2312"
echo "ja_JP.EUC EUC-JP"
echo "ja_JP.SJIS SHIFT_JIS"
echo "ja_JP.Shift_JIS SHIFT_JIS"
echo "ko_KR.EUC EUC-KR"
;;
netbsd*)
echo "646 ASCII"
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-15 ISO-8859-15"
echo "eucCN GB2312"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
echo "BIG5 BIG5"
echo "SJIS SHIFT_JIS"
;;
beos*)
# BeOS has a single locale, and it has UTF-8 encoding.
echo "* UTF-8"
;;
msdosdjgpp*)
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "#"
echo "# The encodings given here may not all be correct."
echo "# If you find that the encoding given for your language and"
echo "# country is not the one your DOS machine actually uses, just"
echo "# correct it in this file, and send a mail to"
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
echo "# and Bruno Haible <bruno@clisp.org>."
echo "#"
echo "C ASCII"
# ISO-8859-1 languages
echo "ca CP850"
echo "ca_ES CP850"
echo "da CP865" # not CP850 ??
echo "da_DK CP865" # not CP850 ??
echo "de CP850"
echo "de_AT CP850"
echo "de_CH CP850"
echo "de_DE CP850"
echo "en CP850"
echo "en_AU CP850" # not CP437 ??
echo "en_CA CP850"
echo "en_GB CP850"
echo "en_NZ CP437"
echo "en_US CP437"
echo "en_ZA CP850" # not CP437 ??
echo "es CP850"
echo "es_AR CP850"
echo "es_BO CP850"
echo "es_CL CP850"
echo "es_CO CP850"
echo "es_CR CP850"
echo "es_CU CP850"
echo "es_DO CP850"
echo "es_EC CP850"
echo "es_ES CP850"
echo "es_GT CP850"
echo "es_HN CP850"
echo "es_MX CP850"
echo "es_NI CP850"
echo "es_PA CP850"
echo "es_PY CP850"
echo "es_PE CP850"
echo "es_SV CP850"
echo "es_UY CP850"
echo "es_VE CP850"
echo "et CP850"
echo "et_EE CP850"
echo "eu CP850"
echo "eu_ES CP850"
echo "fi CP850"
echo "fi_FI CP850"
echo "fr CP850"
echo "fr_BE CP850"
echo "fr_CA CP850"
echo "fr_CH CP850"
echo "fr_FR CP850"
echo "ga CP850"
echo "ga_IE CP850"
echo "gd CP850"
echo "gd_GB CP850"
echo "gl CP850"
echo "gl_ES CP850"
echo "id CP850" # not CP437 ??
echo "id_ID CP850" # not CP437 ??
echo "is CP861" # not CP850 ??
echo "is_IS CP861" # not CP850 ??
echo "it CP850"
echo "it_CH CP850"
echo "it_IT CP850"
echo "lt CP775"
echo "lt_LT CP775"
echo "lv CP775"
echo "lv_LV CP775"
echo "nb CP865" # not CP850 ??
echo "nb_NO CP865" # not CP850 ??
echo "nl CP850"
echo "nl_BE CP850"
echo "nl_NL CP850"
echo "nn CP865" # not CP850 ??
echo "nn_NO CP865" # not CP850 ??
echo "no CP865" # not CP850 ??
echo "no_NO CP865" # not CP850 ??
echo "pt CP850"
echo "pt_BR CP850"
echo "pt_PT CP850"
echo "sv CP850"
echo "sv_SE CP850"
# ISO-8859-2 languages
echo "cs CP852"
echo "cs_CZ CP852"
echo "hr CP852"
echo "hr_HR CP852"
echo "hu CP852"
echo "hu_HU CP852"
echo "pl CP852"
echo "pl_PL CP852"
echo "ro CP852"
echo "ro_RO CP852"
echo "sk CP852"
echo "sk_SK CP852"
echo "sl CP852"
echo "sl_SI CP852"
echo "sq CP852"
echo "sq_AL CP852"
echo "sr CP852" # CP852 or CP866 or CP855 ??
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
# ISO-8859-3 languages
echo "mt CP850"
echo "mt_MT CP850"
# ISO-8859-5 languages
echo "be CP866"
echo "be_BE CP866"
echo "bg CP866" # not CP855 ??
echo "bg_BG CP866" # not CP855 ??
echo "mk CP866" # not CP855 ??
echo "mk_MK CP866" # not CP855 ??
echo "ru CP866"
echo "ru_RU CP866"
echo "uk CP1125"
echo "uk_UA CP1125"
# ISO-8859-6 languages
echo "ar CP864"
echo "ar_AE CP864"
echo "ar_DZ CP864"
echo "ar_EG CP864"
echo "ar_IQ CP864"
echo "ar_IR CP864"
echo "ar_JO CP864"
echo "ar_KW CP864"
echo "ar_MA CP864"
echo "ar_OM CP864"
echo "ar_QA CP864"
echo "ar_SA CP864"
echo "ar_SY CP864"
# ISO-8859-7 languages
echo "el CP869"
echo "el_GR CP869"
# ISO-8859-8 languages
echo "he CP862"
echo "he_IL CP862"
# ISO-8859-9 languages
echo "tr CP857"
echo "tr_TR CP857"
# Japanese
echo "ja CP932"
echo "ja_JP CP932"
# Chinese
echo "zh_CN GBK"
echo "zh_TW CP950" # not CP938 ??
# Korean
echo "kr CP949" # not CP934 ??
echo "kr_KR CP949" # not CP934 ??
# Thai
echo "th CP874"
echo "th_TH CP874"
# Other
echo "eo CP850"
echo "eo_EO CP850"
;;
esac
-311
View File
@@ -1,311 +0,0 @@
/* libgnuintl.h - Message catalogs for internationalization. */
/* Copyright (C) 1995-1997, 2000-2003, 2004-2009 Free Software Foundation, Inc.
This file is part of GNU Bash.
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/>.
*/
#ifndef _LIBINTL_H
#define _LIBINTL_H 1
#include <locale.h>
/* The LC_MESSAGES locale category is the category used by the functions
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
On systems that don't define it, use an arbitrary value instead.
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
then includes <libintl.h> (i.e. this file!) and then only defines
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
in this case. */
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
# define LC_MESSAGES 1729
#endif
/* We define an additional symbol to signal that we use the GNU
implementation of gettext. */
#define __USE_GNU_GETTEXT 1
/* Provide information about the supported file formats. Returns the
maximum minor revision number supported for a given major revision. */
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
((major) == 0 ? 1 : -1)
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
precedence over _conio_gettext. */
#ifdef __DJGPP__
# undef gettext
#endif
/* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers
used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */
#ifndef _INTL_PARAMS
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
# define _INTL_PARAMS(args) args
# else
# define _INTL_PARAMS(args) ()
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* We redirect the functions to those prefixed with "libintl_". This is
necessary, because some systems define gettext/textdomain/... in the C
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
If we used the unprefixed names, there would be cases where the
definition in the C library would override the one in the libintl.so
shared library. Recall that on ELF systems, the symbols are looked
up in the following order:
1. in the executable,
2. in the shared libraries specified on the link command line, in order,
3. in the dependencies of the shared libraries specified on the link
command line,
4. in the dlopen()ed shared libraries, in the order in which they were
dlopen()ed.
The definition in the C library would override the one in libintl.so if
either
* -lc is given on the link command line and -lintl isn't, or
* -lc is given on the link command line before -lintl, or
* libintl.so is a dependency of a dlopen()ed shared library but not
linked to the executable at link time.
Since Solaris gettext() behaves differently than GNU gettext(), this
would be unacceptable.
The redirection happens by default through macros in C, so that &gettext
is independent of the compilation unit, but through inline functions in
C++, in order not to interfere with the name mangling of class fields or
class methods called 'gettext'. */
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
If he doesn't, we choose the method. A third possible method is
_INTL_REDIRECT_ASM, supported only by GCC. */
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus)
# define _INTL_REDIRECT_ASM
# else
# ifdef __cplusplus
# define _INTL_REDIRECT_INLINE
# else
# define _INTL_REDIRECT_MACROS
# endif
# endif
#endif
/* Auxiliary macros. */
#ifdef _INTL_REDIRECT_ASM
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
# define _INTL_STRINGIFY(prefix) #prefix
#else
# define _INTL_ASM(cname)
#endif
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_gettext (const char *__msgid);
static inline char *gettext (const char *__msgid)
{
return libintl_gettext (__msgid);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define gettext libintl_gettext
#endif
extern char *gettext _INTL_PARAMS ((const char *__msgid))
_INTL_ASM (libintl_gettext);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
static inline char *dgettext (const char *__domainname, const char *__msgid)
{
return libintl_dgettext (__domainname, __msgid);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define dgettext libintl_dgettext
#endif
extern char *dgettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid))
_INTL_ASM (libintl_dgettext);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
int __category);
static inline char *dcgettext (const char *__domainname, const char *__msgid,
int __category)
{
return libintl_dcgettext (__domainname, __msgid, __category);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define dcgettext libintl_dcgettext
#endif
extern char *dcgettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid,
int __category))
_INTL_ASM (libintl_dcgettext);
#endif
/* Similar to `gettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n);
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
{
return libintl_ngettext (__msgid1, __msgid2, __n);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define ngettext libintl_ngettext
#endif
extern char *ngettext _INTL_PARAMS ((const char *__msgid1,
const char *__msgid2,
unsigned long int __n))
_INTL_ASM (libintl_ngettext);
#endif
/* Similar to `dgettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
const char *__msgid2, unsigned long int __n);
static inline char *dngettext (const char *__domainname, const char *__msgid1,
const char *__msgid2, unsigned long int __n)
{
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define dngettext libintl_dngettext
#endif
extern char *dngettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid1,
const char *__msgid2,
unsigned long int __n))
_INTL_ASM (libintl_dngettext);
#endif
/* Similar to `dcgettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category);
static inline char *dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
{
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define dcngettext libintl_dcngettext
#endif
extern char *dcngettext _INTL_PARAMS ((const char *__domainname,
const char *__msgid1,
const char *__msgid2,
unsigned long int __n,
int __category))
_INTL_ASM (libintl_dcngettext);
#endif
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_textdomain (const char *__domainname);
static inline char *textdomain (const char *__domainname)
{
return libintl_textdomain (__domainname);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define textdomain libintl_textdomain
#endif
extern char *textdomain _INTL_PARAMS ((const char *__domainname))
_INTL_ASM (libintl_textdomain);
#endif
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_bindtextdomain (const char *__domainname,
const char *__dirname);
static inline char *bindtextdomain (const char *__domainname,
const char *__dirname)
{
return libintl_bindtextdomain (__domainname, __dirname);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define bindtextdomain libintl_bindtextdomain
#endif
extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname,
const char *__dirname))
_INTL_ASM (libintl_bindtextdomain);
#endif
/* Specify the character encoding in which the messages from the
DOMAINNAME message catalog will be returned. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
const char *__codeset);
static inline char *bind_textdomain_codeset (const char *__domainname,
const char *__codeset)
{
return libintl_bind_textdomain_codeset (__domainname, __codeset);
}
#else
#ifdef _INTL_REDIRECT_MACROS
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
#endif
extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname,
const char *__codeset))
_INTL_ASM (libintl_bind_textdomain_codeset);
#endif
/* Support for relocatable packages. */
/* Sets the original and the current installation prefix of the package.
Relocation simply replaces a pathname starting with the original prefix
by the corresponding pathname with the current prefix instead. Both
prefixes should be directory names without trailing slash (i.e. use ""
instead of "/"). */
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
extern void
libintl_set_relocation_prefix _INTL_PARAMS ((const char *orig_prefix,
const char *curr_prefix));
#ifdef __cplusplus
}
#endif
#endif /* libintl.h */
-78
View File
@@ -1,78 +0,0 @@
# locale.alias - Locale name alias data base.
#
# Copyright (C) 1996,1997,1998,1999,2000,2001,2005-2009 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# The format of this file is the same as for the corresponding file of
# the X Window System, which normally can be found in
# /usr/lib/X11/locale/locale.alias
# A single line contains two fields: an alias and a substitution value.
# All entries are case independent.
# Note: This file is far from being complete. If you have a value for
# your own site which you think might be useful for others too, share
# it with the rest of us. Send it using the `glibcbug' script to
# bugs@gnu.org.
# Packages using this file:
bokmal no_NO.ISO-8859-1
bokmål no_NO.ISO-8859-1
catalan ca_ES.ISO-8859-1
croatian hr_HR.ISO-8859-2
czech cs_CZ.ISO-8859-2
danish da_DK.ISO-8859-1
dansk da_DK.ISO-8859-1
deutsch de_DE.ISO-8859-1
dutch nl_NL.ISO-8859-1
eesti et_EE.ISO-8859-1
estonian et_EE.ISO-8859-1
finnish fi_FI.ISO-8859-1
français fr_FR.ISO-8859-1
french fr_FR.ISO-8859-1
galego gl_ES.ISO-8859-1
galician gl_ES.ISO-8859-1
german de_DE.ISO-8859-1
greek el_GR.ISO-8859-7
hebrew he_IL.ISO-8859-8
hrvatski hr_HR.ISO-8859-2
hungarian hu_HU.ISO-8859-2
icelandic is_IS.ISO-8859-1
italian it_IT.ISO-8859-1
japanese ja_JP.eucJP
japanese.euc ja_JP.eucJP
ja_JP ja_JP.eucJP
ja_JP.ujis ja_JP.eucJP
japanese.sjis ja_JP.SJIS
korean ko_KR.eucKR
korean.euc ko_KR.eucKR
ko_KR ko_KR.eucKR
lithuanian lt_LT.ISO-8859-13
nb_NO no_NO.ISO-8859-1
nb_NO.ISO-8859-1 no_NO.ISO-8859-1
norwegian no_NO.ISO-8859-1
nynorsk nn_NO.ISO-8859-1
polish pl_PL.ISO-8859-2
portuguese pt_PT.ISO-8859-1
romanian ro_RO.ISO-8859-2
russian ru_RU.ISO-8859-5
slovak sk_SK.ISO-8859-2
slovene sl_SI.ISO-8859-2
slovenian sl_SI.ISO-8859-2
spanish es_ES.ISO-8859-1
swedish sv_SE.ISO-8859-1
thai th_TH.TIS-620
turkish tr_TR.ISO-8859-9
+1 -1
View File
@@ -1,6 +1,6 @@
/* malloc.c - dynamic memory allocation for bash. */
/* Copyright (C) 1985-2022 Free Software Foundation, Inc.
/* Copyright (C) 1985-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
+1 -1
View File
@@ -1,6 +1,6 @@
/* table.h - definitions for tables for keeping track of allocated memory */
/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
/* Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
+5 -2
View File
@@ -1,6 +1,6 @@
/* complete.c -- filename completion for readline. */
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
/* Copyright (C) 1987-2025 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.
@@ -3066,7 +3066,10 @@ _rl_export_completions (char **matches, char *text, int start, int end)
fprintf (rl_outstream, "%s\n", text);
fprintf (rl_outstream, "%d:%d\n", start, end); /* : because it's not a radix character */
for (i = 0; i < len; i++)
fprintf (rl_outstream, "%s\n", matches[i]);
{
print_filename (matches[i], matches[i], 0);
fprintf (rl_outstream, "\n");
}
fflush (rl_outstream);
}
+46 -21
View File
@@ -1,6 +1,6 @@
/* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
/* Copyright (C) 1987-2025 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.
@@ -1489,7 +1489,7 @@ rl_redisplay (void)
but the buffer position needs to be adjusted to account
for invisible characters. */
if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line)
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);;
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
}
/* Now we move the cursor to where it needs to be. First, make
@@ -1502,28 +1502,53 @@ rl_redisplay (void)
invisible character in the prompt string. */
/* XXX - why not use local_prompt_len? */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == prompt_last_screen_line && wrap_offset > 0 &&
_rl_last_c_pos > 0 && local_prompt &&
_rl_last_c_pos < PROMPT_ENDING_INDEX)
if (cursor_linenum == prompt_last_screen_line)
{
int pmt_offset;
int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0;
int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset;
int cursor_bufpos;
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
/* cursor_bufpos is where the portion of the prompt that appears
on the current screen line begins in the buffer. It is a
buffer position, an index into curline
(local_prompt + pmt_offset) */
cursor_bufpos = pmt_offset;
if (mb_cur_max == 1 || rl_byte_oriented)
cursor_bufpos += _rl_last_c_pos;
else
cursor_bufpos += _rl_last_c_pos + curline_invchars;
/* If the number of characters in local_prompt is greater than
the screen width, the prompt wraps. We only want to print the
portion after the line wrap. */
pmt_offset = local_prompt_newlines[cursor_linenum];
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
else
_rl_output_some_chars (local_prompt, nleft);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
else
_rl_last_c_pos = nleft + modmark; /* buffer position */
if (local_prompt && local_prompt_invis_chars[cursor_linenum] &&
_rl_last_c_pos > 0 &&
cursor_bufpos <= prompt_last_invisible)
{
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
/* If the number of characters in local_prompt is greater
than the screen width, the prompt wraps. We only want to
print the portion after the line wrap. */
/* Make sure we set _rl_last_c_pos based on the number of
characters we actually output, since we start at column 0. */
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
else
{
_rl_output_some_chars (local_prompt, nleft);
pmt_offset = 0; /* force for calculation below */
}
if (mb_cur_max > 1 && rl_byte_oriented == 0)
/* Start width calculation where we started output. */
_rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark;
else
/* Index into invisible_line+inv_lbreaks[cursor_linenum],
since that's what we use in the call to
_rl_move_cursor_relative below. */
_rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */
}
}
/* Where on that line? And where does that line start
+2 -2
View File
@@ -1,4 +1,4 @@
\input texinfo @c -*-texinfo-*-
c\input texinfo @c -*-texinfo-*-
@c %**start of header (This is for running Texinfo on a region.)
@setfilename history.info
@settitle GNU History Library
@@ -12,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+2 -2
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -36,7 +36,7 @@ For information on the interactive use of @sc{gnu} History,
* Introduction to History:: What is the GNU History library for?
* History Storage:: How information is stored.
* History Functions:: Functions that you can use.
* History Variables:: Variables that control behaviour.
* History Variables:: Variables that control behavior.
* History Programming Example:: Example of using the GNU History Library.
@end menu
+4 -2
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988--2024 Free Software Foundation, Inc.
Copyright (C) 1988--2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -504,6 +504,8 @@ It may be omitted if the word designator begins with a @samp{^}, @samp{$},
@samp{*}, @samp{-}, or @samp{%}.
Words are numbered from the beginning of the line,
with the first word being denoted by 0 (zero).
That first word is usually the command word, and the arguments begin
with the second word.
Words are inserted into the current line separated by single spaces.
@need 0.75
@@ -515,7 +517,7 @@ designates the preceding command.
When you type this, the preceding command is repeated in toto.
@item !!:$
designates the last argument of the preceding command.
designates the last word of the preceding command.
This may be shortened to @code{!$}.
@item !fi:2
+1 -1
View File
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+5 -5
View File
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Copyright (C) 1988--2024 Free Software Foundation, Inc.
Copyright (C) 1988--2025 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -58,7 +58,7 @@ in your own programs, this section is for you.
Many programs provide a command line interface, such as @code{mail},
@code{ftp}, and @code{sh}.
For such programs, the default behaviour of Readline is sufficient.
For such programs, the default behavior of Readline is sufficient.
This section describes how to use Readline in
the simplest way possible, perhaps to replace calls in your code to
@code{fgets()}.
@@ -149,7 +149,7 @@ rl_gets ()
@}
@end example
This function gives the user the default behaviour of @key{TAB}
This function gives the user the default behavior of @key{TAB}
completion: filename completion.
If you do not want Readline to
complete filenames, you can change the binding of the @key{TAB} key
@@ -768,7 +768,7 @@ The caller should free @var{keymap}.
@deftypefun void rl_free_keymap (Keymap keymap)
Free all storage associated with @var{keymap}.
This calls @code{rl_discard_keymap} to free subordindate
This calls @code{rl_discard_keymap} to free subordinate
keymaps and macros.
@end deftypefun
@@ -1168,7 +1168,7 @@ displaying a new message in the message area with @code{rl_message()}.
@deftypefun void rl_restore_prompt (void)
Restore the local Readline prompt display state saved by the most
recent call to @code{rl_save_prompt}.
if you called @code{rl_save_prompt} to save the prompt before a call
If you called @code{rl_save_prompt} to save the prompt before a call
to @code{rl_message}, you should call this function before the
corresponding call to @code{rl_clear_message}.
@end deftypefun
+17 -11
View File
@@ -11,7 +11,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
Copyright (C) 1988--2024 Free Software Foundation, Inc.
Copyright (C) 1988--2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -466,9 +466,10 @@ A sample value might be @samp{\e[01;33m}.
@item active-region-end-color
@vindex active-region-end-color
A string variable that "undoes" the effects of @code{active-region-start-color}
and restores "normal" terminal display appearance after displaying text
in the active region.
A string variable that ``undoes''
the effects of @code{active-region-start-color}
and restores ``normal''
terminal display appearance after displaying text in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
@@ -703,7 +704,7 @@ are saved.
If set to a value less than zero, the number of history entries is not
limited.
@ifset BashFeatures
By default, Bash sets the the maximum number of history entries to
By default, Bash sets the maximum number of history entries to
the value of the @code{HISTSIZE} shell variable.
@end ifset
@ifclear BashFeatures
@@ -1055,7 +1056,7 @@ The eight-bit character whose value is the hexadecimal value @var{HH}
When entering the text of a macro, single or double quotes must
be used to indicate a macro definition.
Unquoted text is assumed to be a function name.
Tthe backslash escapes described above are expanded
The backslash escapes described above are expanded
in the macro body.
Backslash will quote any other character in the macro text,
including @samp{"} and @samp{'}.
@@ -1188,7 +1189,7 @@ binding, variable assignment, and conditional syntax.
@example
@page
# This file controls the behaviour of line input editing for
# This file controls the behavior of line input editing for
# programs that use the GNU Readline library. Existing
# programs include FTP, Bash, and GDB.
#
@@ -1316,10 +1317,13 @@ In the following descriptions, @dfn{point} refers to the current cursor
position, and @dfn{mark} refers to a cursor position saved by the
@code{set-mark} command.
The text between the point and mark is referred to as the @dfn{region}.
Readline has the concept of an @emph{active region}:
Readline
has the concept of an @emph{active region}:
when the region is active,
Readline redisplay highlights the region using the
value of the @code{active-region-start-color} variable.
value of the
@code{active-region-start-color}
variable.
The @code{enable-active-region} variable turns this on and off.
Several commands set the region to active; those are noted below.
@@ -1384,6 +1388,8 @@ leaving the current line at the top of the screen.
Clear the screen,
then redraw the current line,
leaving the current line at the top of the screen.
If given a numeric argument, this refreshes the current line
without clearing the screen.
@item redraw-current-line ()
Refresh the current line. By default, this is unbound.
@@ -1806,7 +1812,7 @@ the number of matches @var{N};
the word being completed;
@item
@var{S}:@var{E},
where S and E are the start and end offsets of the word
where @var{S} and @var{E} are the start and end offsets of the word
in the Readline line buffer; then
@item
each match, one per line
@@ -2057,7 +2063,7 @@ Expand the line by performing shell word expansions.
This performs alias and history expansion,
$'@var{string}' and $"@var{string}" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and proces substitution,
command and process substitution,
word splitting, and quote removal.
An explicit argument suppresses command and process substitution.
+1 -1
View File
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+4 -4
View File
@@ -1,11 +1,11 @@
@ignore
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2025 Free Software Foundation, Inc.
@end ignore
@set EDITION 8.3
@set VERSION 8.3
@set UPDATED 29 November 2024
@set UPDATED-MONTH November 2024
@set UPDATED 30 December 2024
@set UPDATED-MONTH December 2024
@set LASTCHANGE Fri Nov 29 18:18:20 EST 2024
@set LASTCHANGE Mon Dec 30 11:27:03 EST 2024
+4 -3
View File
@@ -141,7 +141,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
register char c;
HIST_ENTRY *entry;
int which, sign, local_index, substring_okay;
int search_flags;
int search_flags, old_offset;
char *temp;
/* The event can be specified in a number of ways.
@@ -251,9 +251,10 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
*caller_index = i;
old_offset = history_offset; /* XXX */
#define FAIL_SEARCH() \
do { \
history_offset = history_length; xfree (temp) ; return (char *)NULL; \
history_offset = old_offset; xfree (temp) ; return (char *)NULL; \
} while (0)
/* If there is no search string, try to use the previous search string,
@@ -282,7 +283,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
entry = current_history ();
if (entry == 0)
FAIL_SEARCH ();
history_offset = history_length;
history_offset = old_offset; /* XXX - was history_length */
/* If this was a substring search, then remember the
string that we matched for word substitution. */
+17 -14
View File
@@ -1,6 +1,6 @@
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989-2019,2023-2024 Free Software Foundation, Inc.
/* Copyright (C) 1989-2019,2023-2025 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -298,21 +298,24 @@ read_history_range (const char *filename, int from, int to)
#endif
goto error_and_exit;
}
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
else
{
errno = overflow_errno;
goto error_and_exit;
}
/* regular file */
file_size = (size_t)finfo.st_size;
if (file_size == 0)
{
xfree (input);
close (file);
return 0; /* don't waste time if we don't have to */
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
{
errno = overflow_errno;
goto error_and_exit;
}
if (file_size == 0)
{
xfree (input);
close (file);
return 0; /* don't waste time if we don't have to */
}
}
#ifdef HISTORY_USE_MMAP
+8
View File
@@ -90,4 +90,12 @@ getnow(void)
} while (0)
#endif
#ifndef TIMESPEC_TO_TIMEVAL
# define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (tv)->tv_nsec / 1000; \
} while (0)
#endif
#endif /* _POSIXTIME_H_ */
File diff suppressed because it is too large Load Diff
+20 -20
View File
@@ -148,26 +148,26 @@ _rl_wcwidth (WCHAR_T wc)
{
switch (wc)
{
case ' ': case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>':
case '?':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case '[': case '\\': case ']': case '^': case '_':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z': case '{': case '|': case '}': case '~':
case L' ': case L'!': case L'"': case L'#': case L'%':
case L'&': case L'\'': case L'(': case L')': case L'*':
case L'+': case L',': case L'-': case L'.': case L'/':
case L'0': case L'1': case L'2': case L'3': case L'4':
case L'5': case L'6': case L'7': case L'8': case L'9':
case L':': case L';': case L'<': case L'=': case L'>':
case L'?':
case L'A': case L'B': case L'C': case L'D': case L'E':
case L'F': case L'G': case L'H': case L'I': case L'J':
case L'K': case L'L': case L'M': case L'N': case L'O':
case L'P': case L'Q': case L'R': case L'S': case L'T':
case L'U': case L'V': case L'W': case L'X': case L'Y':
case L'Z':
case L'[': case L'\\': case L']': case L'^': case L'_':
case L'a': case L'b': case L'c': case L'd': case L'e':
case L'f': case L'g': case L'h': case L'i': case L'j':
case L'k': case L'l': case L'm': case L'n': case L'o':
case L'p': case L'q': case L'r': case L's': case L't':
case L'u': case L'v': case L'w': case L'x': case L'y':
case L'z': case L'{': case L'|': case L'}': case L'~':
return 1;
default:
return wcwidth (wc);
+2 -1
View File
@@ -1,7 +1,7 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
/* Copyright (C) 1999-2025 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.
@@ -640,6 +640,7 @@ extern int _rl_history_search_pos;
/* signals.c */
extern int volatile _rl_caught_signal;
extern int volatile _rl_handling_signal;
extern _rl_sigcleanup_func_t *_rl_sigcleanup;
extern void *_rl_sigcleanarg;
+15 -5
View File
@@ -80,15 +80,25 @@ static int ksrflow;
#endif
/* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. */
to get the tty settings. But we use the information to set our idea
of the screen size if we're in a signal handling context, since it
doesn't make sense to waste it. */
static void
set_winsize (int tty)
{
#if defined (TIOCGWINSZ)
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
struct winsize w;
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
if (_rl_tcgetwinsize (tty, &w) == 0)
{
(void) _rl_tcsetwinsize (tty, &w);
/* We restrict this to the case where we're running a signal handler
and executing after a SIGTSTP. We can relax it later. */
#if defined (SIGTSTP)
if (RL_ISSTATE (RL_STATE_SIGHANDLER) && _rl_handling_signal == SIGTSTP && rl_prefer_env_winsize == 0)
_rl_set_screen_size (w.ws_row, w.ws_col); /* don't waste the info */
#endif
}
#endif /* TIOCGWINSZ */
}
+3
View File
@@ -55,4 +55,7 @@
# define tcflow(fd, action) ioctl(fd, TCXONC, action)
#endif
extern int _rl_tcgetwinsize (int, struct winsize *);
extern void _rl_tcsetwinsize (int, struct winsize *);
#endif /* _RL_WINSIZE_H */
+6 -1
View File
@@ -1,6 +1,6 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
/* Copyright (C) 1987-2025 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.
@@ -88,6 +88,7 @@ int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
/* Private variables. */
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
int volatile _rl_handling_signal = 0;
/* 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). */
@@ -133,6 +134,7 @@ _rl_signal_handler (int sig)
if (sig == SIGWINCH)
{
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_handling_signal = SIGWINCH;
rl_resize_terminal ();
/* XXX - experimental for now */
@@ -142,6 +144,7 @@ _rl_signal_handler (int sig)
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
_rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
}
else
@@ -177,6 +180,7 @@ _rl_handle_signal (int sig)
#endif /* !HAVE_POSIX_SIGNALS */
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_handling_signal = sig;
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
@@ -301,6 +305,7 @@ _rl_handle_signal (int sig)
rl_reset_after_signal ();
}
_rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
+29 -5
View File
@@ -258,6 +258,30 @@ _win_get_screensize (int *swp, int *shp)
}
#endif
int
_rl_tcgetwinsize (int tty, struct winsize *wp)
{
#if defined (HAVE_TCGETWINSIZE)
return (tcgetwinsize (tty, wp));
#elif defined (TIOCGWINSZ)
return (ioctl (tty, TIOCGWINSZ, wp));
#else
return -1;
#endif
}
void
_rl_tcsetwinsize (int tty, struct winsize *wp)
{
#if defined (HAVE_TCGETWINSIZE)
tcsetwinsize (tty, wp);
#elif defined (TIOCGWINSZ)
ioctl (tty, TIOCSWINSZ, wp);
#else
;
#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
@@ -266,19 +290,19 @@ void
_rl_get_screen_size (int tty, int ignore_env)
{
char *ss;
#if defined (TIOCGWINSZ)
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
struct winsize window_size;
#endif /* TIOCGWINSZ */
#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
int wr, wc;
wr = wc = -1;
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
if (_rl_tcgetwinsize (tty, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
#endif /* TIOCGWINSZ */
#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
#if defined (__EMX__)
_emx_get_screensize (&wc, &wr);
+1
View File
@@ -112,6 +112,7 @@ _rl_abort_internal (void)
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
rl_last_func = (rl_command_func_t *)NULL;
_rl_command_to_execute = 0;
_rl_longjmp (_rl_top_level, 1);
return (0);
+109 -37
View File
@@ -1,59 +1,131 @@
/* gettimeofday.c - gettimeofday replacement using time() */
/* Provide gettimeofday for systems that don't have it or for which it's broken.
/* Copyright (C) 2020, 2022 Free Software Foundation, Inc.
Copyright (C) 2001-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
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,
This file 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.
GNU Lesser 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/>.
*/
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include "config.h"
/* written by Jim Meyering */
/* A version of gettimeofday that just sets tv_sec from time(3) on Unix-like
systems that don't have it, or a version for Win32 systems. From gnulib */
#include <config.h>
#if !defined (HAVE_GETTIMEOFDAY)
#include "posixtime.h"
#if HAVE_STDINT_H
#include <stdint.h>
#if defined _WIN32 && ! defined __CYGWIN__
# define WINDOWS_NATIVE
# include <windows.h>
#endif
/* A version of gettimeofday that just sets tv_sec from time(3) on Unix-like
systems that don't have it, or a version for Win32 systems. */
#ifdef WINDOWS_NATIVE
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
/* Avoid warnings from gcc -Wcast-function-type. */
# define GetProcAddress \
(void *) GetProcAddress
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
static BOOL initialized = FALSE;
static void
initialize (void)
{
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
if (kernel32 != NULL)
{
GetSystemTimePreciseAsFileTimeFunc =
(GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
}
initialized = TRUE;
}
# else /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
# define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime
# endif /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
#endif /* WINDOWS_NATIVE */
/* This is a wrapper for gettimeofday. It is used only on systems
that lack this function, or whose implementation of this function
causes problems.
Work around the bug in some systems whereby gettimeofday clobbers
the static buffer that localtime uses for its return value. The
gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
this problem. */
int
gettimeofday (struct timeval *restrict tv, void *restrict tz)
{
#if !defined (_WIN32)
tv->tv_sec = (time_t) time ((time_t *)0);
tv->tv_usec = 0;
#else
/* EPOCH is the number of 100 nanosecond intervals from
January 1, 1601 (UTC) to January 1, 1970.
(the correct value has 9 trailing zeros) */
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
#undef gettimeofday
#ifdef WINDOWS_NATIVE
SYSTEMTIME system_time;
FILETIME file_time;
uint64_t time;
/* On native Windows, there are two ways to get the current time:
GetSystemTimeAsFileTime
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
or
GetSystemTimePreciseAsFileTime
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
GetSystemTimeAsFileTime produces values that jump by increments of
15.627 milliseconds (!) on average.
Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
microseconds.
More discussion on this topic:
<http://www.windowstimestamp.com/description>. */
FILETIME current_time;
GetSystemTime(&system_time);
SystemTimeToFileTime(&system_time, &file_time);
time = ((uint64_t)file_time.dwLowDateTime);
time += ((uint64_t)file_time.dwHighDateTime) << 32;
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
if (!initialized)
initialize ();
# endif
if (GetSystemTimePreciseAsFileTimeFunc != NULL)
GetSystemTimePreciseAsFileTimeFunc (&current_time);
else
GetSystemTimeAsFileTime (&current_time);
tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
#endif
/* Convert from FILETIME to 'struct timeval'. */
/* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
ULONGLONG since_1601 =
((ULONGLONG) current_time.dwHighDateTime << 32)
| (ULONGLONG) current_time.dwLowDateTime;
/* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap
years, in total 134774 days. */
ULONGLONG since_1970 =
since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000;
ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10;
*tv = (struct timeval) {
.tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000,
.tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000
};
return 0;
#else /* !WINDOWS_NATIVE */
tv->tv_sec = (time_t) time ((time_t *)0);
tv->tv_usec = 0;
return 0;
#endif /* !WINDOWS_NATIVE */
}
#endif
#endif /* !HAVE_GETTIMEOFDAY */
+2
View File
@@ -241,6 +241,8 @@ getmaxgroups (void)
if (maxgroups > 0)
return maxgroups;
/* can also use getgroups (0, NULL) */
#if defined (HAVE_SYSCONF) && defined (_SC_NGROUPS_MAX)
maxgroups = sysconf (_SC_NGROUPS_MAX);
#else
+207 -48
View File
@@ -17,11 +17,15 @@
* For VMS dates, add VMS_EXT.
* For complete POSIX semantics, add POSIX_SEMANTICS.
*
* The code for %c, %x, and %X follows the C99 specification for
* The code for %X follows the C99 specification for
* the "C" locale.
*
* This version ignores LOCALE information.
* It also doesn't worry about multi-byte characters.
* The code for %c, and %x follows the C11 specification for
* the "C" locale.
*
* With HAVE_NL_LANGINFO defined, locale-based values are used.
*
* This version doesn't worry about multi-byte characters.
* So there.
*
* Arnold Robbins
@@ -39,6 +43,8 @@
* Updated December, 2001
* Updated January, 2011
* Updated April, 2012
* Updated March, 2015
* Updated June, 2015
*
* Fixes from ado@elsie.nci.nih.gov,
* February 1991, May 1992
@@ -61,6 +67,10 @@
#include <sys/types.h>
#if defined(TM_IN_SYS_TIME)
#include <sys/time.h>
#endif
#include <stdio.h>
#include <ctype.h>
#include <posixtime.h>
@@ -82,6 +92,10 @@
extern int errno;
#endif
#ifdef HAVE_NL_LANGINFO
#include <langinfo.h>
#endif
#if defined (SHELL)
extern char *get_string_value (const char *);
#endif
@@ -165,6 +179,146 @@ iso_8601_2000_year(char *buf, int year, size_t fw)
}
#endif /* POSIX_2008 */
/* days_a --- return the short name for the day of the week */
static const char *
days_a(int index)
{
#ifdef HAVE_NL_LANGINFO
static const nl_item data[] = {
ABDAY_1,
ABDAY_2,
ABDAY_3,
ABDAY_4,
ABDAY_5,
ABDAY_6,
ABDAY_7,
};
return nl_langinfo(data[index]);
#else
static const char *data[] = {
"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat",
};
return data[index];
#endif
}
/* days_l --- return the long name for the day of the week */
static const char *
days_l(int index)
{
#ifdef HAVE_NL_LANGINFO
static const nl_item data[] = {
DAY_1,
DAY_2,
DAY_3,
DAY_4,
DAY_5,
DAY_6,
DAY_7,
};
return nl_langinfo(data[index]);
#else
static const char *data[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
};
return data[index];
#endif
}
/* months_a --- return the short name for the month */
static const char *
months_a(int index)
{
#ifdef HAVE_NL_LANGINFO
static const nl_item data[] = {
ABMON_1,
ABMON_2,
ABMON_3,
ABMON_4,
ABMON_5,
ABMON_6,
ABMON_7,
ABMON_8,
ABMON_9,
ABMON_10,
ABMON_11,
ABMON_12,
};
return nl_langinfo(data[index]);
#else
static const char *data[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};
return data[index];
#endif
}
/* months_l --- return the short name for the month */
static const char *
months_l(int index)
{
#ifdef HAVE_NL_LANGINFO
static const nl_item data[] = {
MON_1,
MON_2,
MON_3,
MON_4,
MON_5,
MON_6,
MON_7,
MON_8,
MON_9,
MON_10,
MON_11,
MON_12,
};
return nl_langinfo(data[index]);
#else
static const char *data[] = {
"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December",
};
return data[index];
#endif
}
/* days_a --- return am/pm string */
static const char *
ampm(int index)
{
#ifdef HAVE_NL_LANGINFO
static const nl_item data[] = {
AM_STR,
PM_STR,
};
return nl_langinfo(data[index]);
#else
static const char *data[] = {
"AM", "PM",
};
return data[index];
#endif
}
/* strftime --- produce formatted time */
size_t
@@ -199,27 +353,6 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
char flag;
#endif /* POSIX_2008 */
/* various tables, useful in North America */
static const char *days_a[] = {
"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat",
};
static const char *days_l[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
};
static const char *months_a[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};
static const char *months_l[] = {
"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December",
};
static const char *ampm[] = { "AM", "PM", };
oerrno = errno;
if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
return 0;
@@ -228,6 +361,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize)
return 0;
oerrno = errno;
#ifndef POSIX_SEMANTICS
if (first) {
tzset();
@@ -321,14 +456,14 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
strcpy(tbuf, "?");
else
strcpy(tbuf, days_a[timeptr->tm_wday]);
strcpy(tbuf, days_a(timeptr->tm_wday));
break;
case 'A': /* full weekday name */
if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
strcpy(tbuf, "?");
else
strcpy(tbuf, days_l[timeptr->tm_wday]);
strcpy(tbuf, days_l(timeptr->tm_wday));
break;
case 'b': /* abbreviated month name */
@@ -336,14 +471,14 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
strcpy(tbuf, "?");
else
strcpy(tbuf, months_a[timeptr->tm_mon]);
strcpy(tbuf, months_a(timeptr->tm_mon));
break;
case 'B': /* full month name */
if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
strcpy(tbuf, "?");
else
strcpy(tbuf, months_l[timeptr->tm_mon]);
strcpy(tbuf, months_l(timeptr->tm_mon));
break;
case 'c': /* appropriate date and time representation */
@@ -352,9 +487,16 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
*
* strftime(tbuf, sizeof tbuf, "%a %b %e %H:%M:%S %Y", timeptr);
*
* Now, per the ISO 1999 C standard, it this:
* Per the ISO 1999 C standard, it was this:
* strftime(tbuf, sizeof tbuf, "%A %B %d %T %Y", timeptr);
*
* Per the ISO 2011 C standard, it is now this:
*/
strftime(tbuf, sizeof tbuf, "%A %B %d %T %Y", timeptr);
#ifdef HAVE_NL_LANGINFO
strftime(tbuf, sizeof tbuf, nl_langinfo(D_T_FMT), timeptr);
#else
strftime(tbuf, sizeof tbuf, "%a %b %e %T %Y", timeptr);
#endif
break;
case 'C':
@@ -497,9 +639,9 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
case 'p': /* am or pm based on 12-hour clock */
i = range(0, timeptr->tm_hour, 23);
if (i < 12)
strcpy(tbuf, ampm[0]);
strcpy(tbuf, ampm(0));
else
strcpy(tbuf, ampm[1]);
strcpy(tbuf, ampm(1));
break;
case 'r': /* time as %I:%M:%S %p */
@@ -560,11 +702,25 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
break;
case 'x': /* appropriate date representation */
strftime(tbuf, sizeof tbuf, "%A %B %d %Y", timeptr);
/*
* Up to the 2011 standard, this code used:
* strftime(tbuf, sizeof tbuf, "%A %B %d %Y", timeptr);
*
* Now, per the 2011 C standard, this is:
*/
#ifdef HAVE_NL_LANGINFO
strftime(tbuf, sizeof tbuf, nl_langinfo(D_FMT), timeptr);
#else
strftime(tbuf, sizeof tbuf, "%m/%d/%y", timeptr);
#endif
break;
case 'X': /* appropriate time representation */
#ifdef HAVE_NL_LANGINFO
strftime(tbuf, sizeof tbuf, nl_langinfo(T_FMT), timeptr);
#else
goto the_time;
#endif
break;
case 'y': /* year without a century, 00 - 99 */
@@ -625,12 +781,12 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
* Systems with tzname[] probably have timezone as
* secs west of GMT. Convert to mins east of GMT.
*/
# if defined(__hpux) || defined (HPUX) || defined(__CYGWIN__)
#if defined(__hpux) || defined (HPUX) || defined(__CYGWIN__)
off = -timezone / 60;
# else
#else
/* ADR: 4 August 2001, fixed this per gazelle@interaccess.com */
off = -(daylight ? altzone : timezone) / 60;
# endif
#endif
#else /* !HAVE_TZNAME */
gettimeofday(& tv, & zone);
off = -zone.tz_minuteswest;
@@ -682,8 +838,12 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
#ifdef HPUX_EXT
case 'N': /* Emperor/Era name */
#ifdef HAVE_NL_LANGINFO
strftime(tbuf, sizeof tbuf, nl_langinfo(ERA), timeptr);
#else
/* this is essentially the same as the century */
goto century; /* %C */
#endif
case 'o': /* Emperor/Era year */
goto year; /* %y */
@@ -694,7 +854,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
case 'v': /* date as dd-bbb-YYYY */
sprintf(tbuf, "%2d-%3.3s-%4ld",
range(1, timeptr->tm_mday, 31),
months_a[range(0, timeptr->tm_mon, 11)],
months_a(range(0, timeptr->tm_mon, 11)),
timeptr->tm_year + 1900L);
for (i = 3; i < 6; i++)
if (islower(tbuf[i]))
@@ -925,6 +1085,7 @@ How nicer it depends on a compiler, of course, but always a tiny bit.
#ifndef NULL
#include <stdio.h>
#endif
#include <locale.h>
#include <sys/time.h>
#include <string.h>
@@ -941,11 +1102,11 @@ static char *array[] =
"(%%C) Century %C",
"(%%D) date (%%m/%%d/%%y) %D",
"(%%E) Locale extensions (ignored) %E",
"(%%F) full month name, var length (January..December) %F",
"(%%F) year-month-day (YYYY-MM-DD) %F",
"(%%H) hour (24-hour clock, 00..23) %H",
"(%%I) hour (12-hour clock, 01..12) %I",
"(%%M) minute (00..59) %M",
"(%%N) Emperor/Era Name %N",
"(%%N) Emporer/Era Name %N",
"(%%O) Locale extensions (ignored) %O",
"(%%R) time, 24-hour (%%H:%%M) %R",
"(%%S) second (00..60) %S",
@@ -953,12 +1114,12 @@ static char *array[] =
"(%%U) week of year, Sunday as first day of week (00..53) %U",
"(%%V) week of year according to ISO 8601 %V",
"(%%W) week of year, Monday as first day of week (00..53) %W",
"(%%X) appropriate locale time representation (%H:%M:%S) %X",
"(%%X) appropriate locale time representation (%%H:%%M:%%S) %X",
"(%%Y) year with century (1970...) %Y",
"(%%Z) timezone (EDT), or blank if timezone not determinable %Z",
"(%%a) locale's abbreviated weekday name (Sun..Sat) %a",
"(%%b) locale's abbreviated month name (Jan..Dec) %b",
"(%%c) full date (Sat Nov 4 12:02:33 1989)%n%t%t%t %c",
"(%%c) full date + newline (Sat Nov 4 12:02:33 1989)%n%t%t%t %c",
"(%%d) day of the month (01..31) %d",
"(%%e) day of the month, blank-padded ( 1..31) %e",
"(%%h) should be same as (%%b) %h",
@@ -966,7 +1127,7 @@ static char *array[] =
"(%%k) hour, 24-hour clock, blank pad ( 0..23) %k",
"(%%l) hour, 12-hour clock, blank pad ( 0..12) %l",
"(%%m) month (01..12) %m",
"(%%o) Emperor/Era Year %o",
"(%%o) Emporer/Era Year %o",
"(%%p) locale's AM or PM based on 12-hour clock %p",
"(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r",
"(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u",
@@ -981,12 +1142,8 @@ static char *array[] =
/* main routine. */
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
long time();
char *next;
char string[MAXTIME];
@@ -997,6 +1154,8 @@ char **argv;
long clock;
setlocale(LC_ALL, "");
/* Call the function. */
clock = time((long *) 0);
@@ -1007,6 +1166,6 @@ char **argv;
printf("%s\n", string);
}
exit(0);
return 0;
}
#endif /* TEST_STRFTIME */
+1 -1
View File
@@ -43,7 +43,7 @@ typedef ssize_t breadfunc_t (int, char *, size_t);
typedef ssize_t creadfunc_t (int, char *);
/* Initial memory allocation for automatic growing buffer in zreadlinec */
#define GET_LINE_INITIAL_ALLOCATION 16
#define GET_LINE_INITIAL_ALLOCATION 64
/* Derived from GNU libc's getline.
The behavior is almost the same as getline. See man getline.
+3 -8
View File
@@ -44,16 +44,14 @@ extern ssize_t zread (int, char *, size_t);
/* Dump contents of file descriptor FD to *OSTR. FN is the filename for
error messages (not used right now). */
int
ssize_t
zmapfd (int fd, char **ostr, const char *fn)
{
ssize_t nr;
int rval;
char lbuf[ZBUFSIZ];
char *result;
size_t rsize, rind;
rval = 0;
result = (char *)xmalloc (rsize = ZBUFSIZ);
rind = 0;
@@ -61,10 +59,7 @@ zmapfd (int fd, char **ostr, const char *fn)
{
nr = zread (fd, lbuf, sizeof (lbuf));
if (nr == 0)
{
rval = rind;
break;
}
break;
else if (nr < 0)
{
free (result);
@@ -86,5 +81,5 @@ zmapfd (int fd, char **ostr, const char *fn)
else
free (result);
return rval;
return (ssize_t)rind;
}
+32 -60
View File
@@ -46,10 +46,6 @@ extern char *realloc ();
#include <string.h>
#endif
#if !defined (HAVE_BCOPY) && (defined (HAVE_STRING_H) || defined (STDC_HEADERS))
# define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#else /* not HAVE_CONFIG_H */
#ifdef HAVE_STDLIB_H
@@ -64,17 +60,11 @@ char *realloc ();
#include <string.h>
#endif
/* Do this after the include, in case string.h prototypes bcopy. */
#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _POSIX_VERSION
#include <fcntl.h>
#endif
#endif /* not HAVE_CONFIG_H */
@@ -110,30 +100,31 @@ int bufsize = 128;
#endif
#ifndef emacs
static void memory_out (void);
static void *xmalloc (size_t);
static void *xrealloc (void *, size_t);
static void
memory_out ()
memory_out (void)
{
write (2, "virtual memory exhausted\n", 25);
exit (1);
}
static char *
xmalloc (size)
unsigned size;
static void *
xmalloc (size_t size)
{
register char *tem = malloc (size);
register void *tem = malloc (size);
if (!tem)
memory_out ();
return tem;
}
static char *
xrealloc (ptr, size)
char *ptr;
unsigned size;
static void *
xrealloc (void *ptr, size_t size)
{
register char *tem = realloc (ptr, size);
register void *tem = realloc (ptr, size);
if (!tem)
memory_out ();
@@ -147,15 +138,15 @@ xrealloc (ptr, size)
for tgetnum, tgetflag and tgetstr to find. */
static char *term_entry;
static char *tgetst1 ();
static char *find_capability (char *, char *);
static char *tgetst1 (char *, char **);
/* Search entry BP for capability CAP.
Return a pointer to the capability (in BP) if found,
0 if not found. */
static char *
find_capability (bp, cap)
register char *bp, *cap;
find_capability (char *bp, char *cap)
{
for (; *bp; bp++)
if (bp[0] == ':'
@@ -167,8 +158,7 @@ find_capability (bp, cap)
__private_extern__
int
tgetnum (cap)
char *cap;
tgetnum (char *cap)
{
register char *ptr = find_capability (term_entry, cap);
if (!ptr || ptr[-1] != '#')
@@ -178,8 +168,7 @@ tgetnum (cap)
__private_extern__
int
tgetflag (cap)
char *cap;
tgetflag (char *cap)
{
register char *ptr = find_capability (term_entry, cap);
return ptr && ptr[-1] == ':';
@@ -192,9 +181,7 @@ tgetflag (cap)
__private_extern__
char *
tgetstr (cap, area)
char *cap;
char **area;
tgetstr (char *cap, char **area)
{
register char *ptr = find_capability (term_entry, cap);
if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~'))
@@ -220,9 +207,7 @@ static char esctab[]
or NULL if PTR is NULL. */
static char *
tgetst1 (ptr, area)
char *ptr;
char **area;
tgetst1 (char *ptr, char **area)
{
register char *p, *r;
register int c;
@@ -313,10 +298,7 @@ static int speeds[] =
__private_extern__
int
tputs (str, nlines, outfun)
register char *str;
int nlines;
register int (*outfun) ();
tputs (char *str, int nlines, int (*outfun)(int))
{
register int padcount = 0;
register int speed;
@@ -392,10 +374,10 @@ struct buffer
/* Forward declarations of static functions. */
static int scan_file ();
static char *gobble_line ();
static int compare_contin ();
static int name_match ();
static int scan_file (char *, int, struct buffer *);
static char *gobble_line (int, struct buffer *, char *);
static int compare_contin (char *, char *);
static int name_match (char *, char *);
#ifdef VMS
@@ -451,8 +433,7 @@ valid_filename_p (fn)
__private_extern__
int
tgetent (bp, name)
char *bp, *name;
tgetent (char *bp, char *name)
{
register char *termcap_name;
register int fd;
@@ -462,7 +443,7 @@ tgetent (bp, name)
char *term;
int malloc_size = 0;
register int c;
char *tcenv; /* TERMCAP value, if it contains :tc=. */
char *tcenv = NULL; /* TERMCAP value, if it contains :tc=. */
char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */
int filep;
@@ -621,10 +602,7 @@ tgetent (bp, name)
or 0 if no entry is found in the file. */
static int
scan_file (str, fd, bufp)
char *str;
int fd;
register struct buffer *bufp;
scan_file (char *str, int fd, struct buffer *bufp)
{
register char *end;
@@ -661,8 +639,7 @@ scan_file (str, fd, bufp)
by termcap entry LINE. */
static int
name_match (line, name)
char *line, *name;
name_match (char *line, char *name)
{
register char *tem;
@@ -677,8 +654,7 @@ name_match (line, name)
}
static int
compare_contin (str1, str2)
register char *str1, *str2;
compare_contin (char *str1, char *str2)
{
register int c1, c2;
while (1)
@@ -718,10 +694,7 @@ compare_contin (str1, str2)
thing as one line. The caller decides when a line is continued. */
static char *
gobble_line (fd, bufp, append_end)
int fd;
register struct buffer *bufp;
char *append_end;
gobble_line (int fd, struct buffer *bufp, char *append_end)
{
register char *end;
register int nread;
@@ -754,7 +727,7 @@ gobble_line (fd, bufp, append_end)
else
{
append_end -= bufp->ptr - buf;
bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf);
memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
bufp->ptr = buf;
}
if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
@@ -799,8 +772,7 @@ main (argc, argv)
printf ("am: %d\n", tgetflag ("am"));
}
tprint (cap)
char *cap;
tprint (char *cap)
{
char *x = tgetstr (cap, 0);
register char *y;

Some files were not shown because too many files have changed in this diff Show More