fix for invalid brace sequence expressions; cosmetic fix to help builtin; documentation and copyright updates; bump version to bash-5.3-rc1; cosmetic locale fixes

This commit is contained in:
Chet Ramey
2025-03-24 17:07:43 -04:00
parent c3997d51f8
commit e009d30dff
47 changed files with 1629 additions and 1884 deletions
+65
View File
@@ -1,3 +1,68 @@
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 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.
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' 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.
+65
View File
@@ -1,3 +1,68 @@
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 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.
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' 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.
+34
View File
@@ -11046,3 +11046,37 @@ redir.c
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
+1 -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
+6
View File
@@ -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.
@@ -190,6 +193,9 @@ m. The default value for `readline-colored-completion-prefix' no longer has a
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
+6
View File
@@ -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.
@@ -189,3 +192,6 @@ m. The default value for `readline-colored-completion-prefix' no longer has a
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.
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
+1 -1
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.
+3 -3
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.
@@ -137,7 +137,7 @@ brace_expand (char *text)
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 - 1) == 0)
if (etype == BRACE_SEQ && valid_seqterm (text + start, j - start) == 0)
c = 0;
#endif
@@ -483,7 +483,7 @@ valid_seqterm (char *text, size_t tlen)
int lhs_t, rhs_t;
int c;
c = text[tlen];
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;
+1 -1
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.
+5 -1
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.
@@ -321,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 */
+1 -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.
+1 -1
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.
+1 -1
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.
+1 -1
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.
Vendored
+13 -11
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.075.
# 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' ;;
@@ -13467,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
@@ -23637,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
@@ -23705,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\\"
+3 -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.075])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])
+4 -4
View File
@@ -903,7 +903,7 @@ operators do not evaluate \fIexpression2\fP if the value of
the entire conditional expression.
.RE
.TP
\fBfor\fP \fIname\fP [ [ \fBin\fP [ \fIword .\|.\|.\&\fP ] ] ; ] \fBdo\fP \fIlist\fP ; \fBdone\fP
\fBfor\fP \fIname\fP [ [ \fBin\fP \fIword .\|.\|.\&\fP ] ; ] \fBdo\fP \fIlist\fP ; \fBdone\fP
First, expand The list of words following \fBin\fP, generating a list
of items.
Then, the variable \fIname\fP is set to each element of this list
@@ -917,7 +917,7 @@ The return status is the exit status of the last command that executes.
If the expansion of the items following \fBin\fP results in an empty
list, no commands are executed, and the return status is 0.
.TP
\fBfor\fP (( \fIexpr1\fP ; \fIexpr2\fP ; \fIexpr3\fP )) ; \fBdo\fP \fIlist\fP ; \fBdone\fP
\fBfor\fP (( \fIexpr1\fP ; \fIexpr2\fP ; \fIexpr3\fP )) [;] \fBdo\fP \fIlist\fP ; \fBdone\fP
First, evaluate the arithmetic expression \fIexpr1\fP according
to the rules described below under
.SM
@@ -3419,7 +3419,7 @@ For example, a\fB{\fPd,c,b\fB}\fPe expands into
.Q "ade ace abe" .
.PP
A sequence expression takes the form
\fB{\fP\fIx\fP\fB..\fP\fIy\fP\fB[..\fP\fIincr\fP\fB]}\fP,
\fIx\fP\fB..\fP\fIy\fP\fB[..\fP\fIincr\fP\fB]\fP,
where \fIx\fP and \fIy\fP are either integers or single letters,
and \fIincr\fP, an optional increment, is an integer.
When integers are supplied, the expression expands to each number between
@@ -4897,7 +4897,7 @@ The format of here-documents is:
.PP
The shell does not perform
parameter and variable expansion, command substitution,
arithmetic expansion, or pathname expansion is performed on
arithmetic expansion, or pathname expansion on
.IR word .
.PP
If any part of
+5 -4
View File
@@ -970,7 +970,7 @@ in @var{consequent-commands}, or zero if none was executed.
The syntax of the @code{for} command is:
@example
for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done
for @var{name} [ [in @var{words} @dots{}] ; ] do @var{commands}; done
@end example
Expand @var{words} (@pxref{Shell Expansions}), and then
@@ -985,10 +985,11 @@ The return status is the exit status of the last command that executes.
If there are no items in the expansion of @var{words}, no commands are
executed, and the return status is zero.
An alternate form of the @code{for} command is also supported:
There is an alternate form of the @code{for} command which is similar to the
C language:
@example
for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) ; do @var{commands} ; done
for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) [;] do @var{commands} ; done
@end example
First, evaluate the arithmetic expression @var{expr1} according
@@ -2069,7 +2070,7 @@ ade ace abe
@end example
A sequence expression takes the form
@code{@{@var{x}..@var{y}[..@var{incr}]@}},
@code{@var{x}..@var{y}[..@var{incr}]},
where @var{x} and @var{y} are either integers or letters,
and @var{incr}, an optional increment, is an integer.
When integers are supplied, the expression expands to each number between
+1 -1
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.
+1 -1
View File
@@ -3,7 +3,7 @@
/* See Makefile for compilation details. */
/*
Copyright (C) 2024 Free Software Foundation, Inc.
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
+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 */
};
+1 -1
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.
+1 -1
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.
+1 -1
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.
+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_ */
+1 -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.
+1 -1
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.
+1 -1
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.
+1 -1
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.
+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);
+1 -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.
+1 -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.
+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 */
+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;
+15 -37
View File
@@ -38,16 +38,8 @@ 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 */
#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#include <string.h>
@@ -72,23 +64,20 @@ memory_out ()
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 ();
@@ -108,15 +97,11 @@ xrealloc (ptr, size)
The fourth and following args to tparam serve as the parameter values. */
static char *tparam1 ();
static char *tparam1 (char *, char *, int, char *, char *, int *);
/* VARARGS 2 */
char *
tparam (string, outstring, len, arg0, arg1, arg2, arg3)
char *string;
char *outstring;
int len;
int arg0, arg1, arg2, arg3;
tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3)
{
int arg[4];
@@ -134,9 +119,7 @@ static char tgoto_buf[50];
__private_extern__
char *
tgoto (cm, hpos, vpos)
char *cm;
int hpos, vpos;
tgoto (char *cm, int hpos, int vpos)
{
int args[2];
if (!cm)
@@ -147,12 +130,7 @@ tgoto (cm, hpos, vpos)
}
static char *
tparam1 (string, outstring, len, up, left, argp)
char *string;
char *outstring;
int len;
char *up, *left;
register int *argp;
tparam1 (char *string, char *outstring, int len, char *up, char *left, int *argp)
{
register int c;
register char *p = string;
@@ -173,21 +151,21 @@ tparam1 (string, outstring, len, up, left, argp)
if (op + 5 >= outend)
{
register char *new;
int offset = op - outstring;
if (outlen == 0)
{
outlen = len + 40;
new = (char *) xmalloc (outlen);
outend += 40;
bcopy (outstring, new, op - outstring);
memcpy (new, outstring, offset);
}
else
{
outend += outlen;
outlen *= 2;
new = (char *) xrealloc (outstring, outlen);
}
op += new - outstring;
outend += new - outstring;
op = new + offset;
outend = new + outlen;
outstring = new;
}
c = *p++;
+1
View File
@@ -18,6 +18,7 @@ AC_DEFUN([AM_LANGINFO_CODESET],
[am_cv_langinfo_codeset=no])
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE([HAVE_NL_LANGINFO], [1])
AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
+1 -1
View File
@@ -1,6 +1,6 @@
/* parse.y - Yacc grammar for bash. */
/* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
/* patchlevel.h -- current bash patch level */
/* 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.
BIN
View File
Binary file not shown.
+1032 -1641
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
/* print_command -- A way to make readable commands from a command tree. */
/* 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.
+1 -1
View File
@@ -1,6 +1,6 @@
/* redir.c -- Functions to perform input and output redirection. */
/* 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.
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
: ${BUILD_DIR:==/usr/local/build/bash/bash-current}
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
: ${BUILD_DIR:=/usr/local/build/chet/bash/bash-current}
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+2 -2
View File
@@ -1,6 +1,6 @@
/* version.c -- distribution and version numbers. */
/* 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.
@@ -47,7 +47,7 @@ const char * const release_status = (char *)0;
#endif
const char * const sccs_version = SCCSVERSION;
const char * const bash_copyright = N_("Copyright (C) 2024 Free Software Foundation, Inc.");
const char * const bash_copyright = N_("Copyright (C) 2025 Free Software Foundation, Inc.");
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */