Skip to content

Commit

Permalink
merge upstream 'v0.5.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
mgree committed Nov 15, 2023
2 parents b31a032 + 4bbf872 commit 5b15fe9
Show file tree
Hide file tree
Showing 21 changed files with 342 additions and 225 deletions.
22 changes: 16 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([dash],[0.5.11.5])
AC_INIT([dash],[0.5.12])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS(config.h)
Expand All @@ -14,6 +14,7 @@ AC_PROG_YACC
dnl MMG 2018-09-26 support building the library
AM_PROG_AR


AC_MSG_CHECKING([for build system compiler])
if test "$cross_compiling" = yes; then
CC_FOR_BUILD=${CC_FOR_BUILD-cc}
Expand Down Expand Up @@ -41,8 +42,8 @@ if test "$enable_static" = "yes"; then
export LDFLAGS="-static -Wl,--fatal-warnings"
fi

AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--enable-fnmatch, \
[Use fnmatch(3) from libc]))
AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--disable-fnmatch, \
[Do not use fnmatch(3) from libc]))
AC_ARG_ENABLE(glob, AS_HELP_STRING(--enable-glob, [Use glob(3) from libc]))

dnl Checks for libraries.
Expand Down Expand Up @@ -126,7 +127,7 @@ if test "$enable_test_workaround" = "yes"; then
[Define if your faccessat tells root all files are executable])
fi

if test "$enable_fnmatch" = yes; then
if test "$enable_fnmatch" != no; then
use_fnmatch=
AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
fi
Expand All @@ -144,10 +145,18 @@ if test "$ac_cv_func_signal" != yes; then
fi

dnl Check for stat64 (dietlibc/klibc).
AC_CHECK_DECL(stat64,, [
AC_CHECK_DECL(stat64, AC_CHECK_FUNC(stat64))
if test "$ac_cv_func_stat64" != yes; then
AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
fi

AC_CHECK_FUNC(glob64,, [
AC_DEFINE(glob64_t, glob_t, [64-bit operations are the same as 32-bit])
AC_DEFINE(glob64, glob, [64-bit operations are the same as 32-bit])
AC_DEFINE(globfree64, globfree,
[64-bit operations are the same as 32-bit])
])

dnl OS X apparently has stat64 but not open64.
Expand Down Expand Up @@ -179,7 +188,8 @@ if test "$with_libedit" = "yes"; then
AC_CHECK_LIB(edit, history_init, [
AC_CHECK_HEADER([histedit.h], [use_libedit="yes"],
AC_MSG_ERROR(
[Can't find required header files.]))])
[Can't find required header files.]))], [
AC_MSG_ERROR([Can't find libedit.])])
fi
if test "$use_libedit" != "yes"; then
AC_DEFINE([SMALL], 1, [Define if you build with -DSMALL])
Expand Down
6 changes: 4 additions & 2 deletions src/bltin/echo.1
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ and
may be given.
.Pp
If any of the following sequences of characters is encountered during
output, the sequence is not output. Instead, the specified action is
output, the sequence is not output.
Instead, the specified action is
performed:
.Bl -tag -width indent
.It Li \eb
A backspace character is output.
.It Li \ec
Subsequent output is suppressed. This is normally used at the end of the
Subsequent output is suppressed.
This is normally used at the end of the
last argument to suppress the trailing newline that
.Nm
would otherwise output.
Expand Down
13 changes: 7 additions & 6 deletions src/bltin/printf.1
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ and
formats, or the maximum number of characters to be printed
from a string
.Sm off
.Pf ( Cm b No ,
.Pf ( Cm b Ns \&,
.Sm on
.Cm B
and
Expand Down Expand Up @@ -281,16 +281,16 @@ value is the 1\-, 2\-, or 3\-digit
octal number
.Ar num .
.It Cm \e^ Ns Ar c
Write the control character
Write the control character
.Ar c .
Generates characters `\e000' through `\e037`, and `\e177' (from `\e^?').
.It Cm \eM\- Ns Ar c
Write the character
Write the character
.Ar c
with the 8th bit set.
Generates characters `\e241' through `\e376`.
.It Cm \eM^ Ns Ar c
Write the control character
Write the control character
.Ar c
with the 8th bit set.
Generates characters `\e000' through `\e037`, and `\e177' (from `\eM^?').
Expand Down Expand Up @@ -330,7 +330,7 @@ exits 0 on success, 1 on failure.
.Sh SEE ALSO
.Xr echo 1 ,
.Xr printf 3 ,
.Xr printf 9
.Xr printf 9 ,
.Xr vis 3
.Sh STANDARDS
The
Expand All @@ -350,5 +350,6 @@ to floating-point and
then back again, floating-point precision may be lost.
.Pp
Hexadecimal character constants are restricted to, and should be specified
as, two character constants. This is contrary to the ISO C standard but
as, two character constants.
This is contrary to the ISO C standard but
does guarantee detection of the end of the constant.
2 changes: 1 addition & 1 deletion src/bltin/test.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
.Nm test
.Ar expression
.Nm \&[
.Ar expression Cm ]
.Ar expression Cm \&]
.Sh DESCRIPTION
The
.Nm test
Expand Down
57 changes: 33 additions & 24 deletions src/dash.1
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
.\" @(#)sh.1 8.6 (Berkeley) 5/4/95
.\"
.Dd January 19, 2003
.Os
.Dt DASH 1
.Os
.Sh NAME
.Nm dash
.Nd command interpreter (shell)
Expand Down Expand Up @@ -439,7 +439,7 @@ instead of
then leading tabs in the here-doc-text are stripped.
.Ss Search and Execution
There are three types of commands: shell functions, builtin commands, and
normal programs -- and the command is searched for (by name) in that order.
normal programs \(en and the command is searched for (by name) in that order.
They each are executed in a different way.
.Pp
When a shell function is executed, all of the shell positional parameters
Expand Down Expand Up @@ -578,11 +578,11 @@ the preceding AND-OR-list.
.Pp
Note that unlike some other shells, each process in the pipeline is a
child of the invoking shell (unless it is a shell builtin, in which case
it executes in the current shell -- but any effect it has on the
it executes in the current shell \(en but any effect it has on the
environment is wiped).
.Ss Background Commands -- &
.Ss Background Commands \(en &
If a command is terminated by the control operator ampersand (&), the
shell executes the command asynchronously -- that is, the shell does not
shell executes the command asynchronously \(en that is, the shell does not
wait for the command to finish before executing the next command.
.Pp
The format for running a command in background is:
Expand All @@ -592,7 +592,7 @@ The format for running a command in background is:
If the shell is not interactive, the standard input of an asynchronous
command is set to
.Pa /dev/null .
.Ss Lists -- Generally Speaking
.Ss Lists \(en Generally Speaking
A list is a sequence of zero or more commands separated by newlines,
semicolons, or ampersands, and optionally terminated by one of these three
characters.
Expand All @@ -615,7 +615,7 @@ of the first command is nonzero.
and
.Dq ||
both have the same priority.
.Ss Flow-Control Constructs -- if, while, for, case
.Ss Flow-Control Constructs \(en if, while, for, case
The syntax of the if command is
.Bd -literal -offset indent
if list
Expand Down Expand Up @@ -694,7 +694,7 @@ Builtin commands grouped into a (list) will not affect the current shell.
The second form does not fork another shell so is slightly more efficient.
Grouping commands together this way allows you to redirect
their output as though they were one program:
.Pp
.\".Pp
.Bd -literal -offset indent
{ printf \*q hello \*q ; printf \*q world\\n" ; } \*[Gt] greeting
.Ed
Expand Down Expand Up @@ -1177,27 +1177,30 @@ mechanism was used or because the argument is a single dash.
The
.Fl P
option causes the physical directory structure to be used, that is, all
symbolic links are resolved to their respective values. The
symbolic links are resolved to their respective values.
The
.Fl L
option turns off the effect of any preceding
.Fl P
options.
.It Xo echo Op Fl n
.Ar args...
.Ar args...
.Xc
Print the arguments on the standard output, separated by spaces.
Unless the
.Fl n
option is present, a newline is output following the arguments.
.Pp
If any of the following sequences of characters is encountered during
output, the sequence is not output. Instead, the specified action is
output, the sequence is not output.
Instead, the specified action is
performed:
.Bl -tag -width indent
.It Li \eb
A backspace character is output.
.It Li \ec
Subsequent output is suppressed. This is normally used at the end of the
Subsequent output is suppressed.
This is normally used at the end of the
last argument to suppress the trailing newline that
.Ic echo
would otherwise output.
Expand Down Expand Up @@ -1417,7 +1420,7 @@ and
and the option
.Op c ,
which requires an argument.
.Pp
.\".Pp
.Bd -literal -offset indent
while getopts abc: f
do
Expand All @@ -1431,7 +1434,7 @@ shift `expr $OPTIND - 1`
.Ed
.Pp
This code will accept any of the following as equivalent:
.Pp
.\".Pp
.Bd -literal -offset indent
cmd \-acarg file file
cmd \-a \-c arg file file
Expand Down Expand Up @@ -1471,7 +1474,8 @@ will continue to print the old name for the directory.
The
.Fl P
option causes the physical value of the current working directory to be shown,
that is, all symbolic links are resolved to their respective values. The
that is, all symbolic links are resolved to their respective values.
The
.Fl L
option turns off the effect of any preceding
.Fl P
Expand Down Expand Up @@ -1522,7 +1526,7 @@ variables.
With the
.Fl p
option specified the output will be formatted suitably for non-interactive use.
.Pp
.\".Pp
.It Xo printf Ar format
.Op Ar arguments ...
.Xc
Expand Down Expand Up @@ -1780,9 +1784,11 @@ If options are given, it sets the specified option
flags, or clears them as described in the section called
.Sx Argument List Processing .
As a special case, if the option is -o or +o and no argument is
supplied, the shell prints the settings of all its options. If the
option is -o, the settings are printed in a human-readable format; if
the option is +o, the settings are printed in a format suitable for
supplied, the shell prints the settings of all its options.
If the option is -o,
the settings are printed in a human-readable format;
if the option is +o,
the settings are printed in a format suitable for
reinput to the shell to affect the same option settings.
.Pp
The third use of the set command is to set the values of the shell's
Expand Down Expand Up @@ -2058,7 +2064,8 @@ operator has higher precedence than the
operator.
.It times
Print the accumulated user and system times for the shell and for processes
run from the shell. The return status is 0.
run from the shell.
The return status is 0.
.It Xo trap
.Op Ar action Ar signal ...
.Xc
Expand Down Expand Up @@ -2179,7 +2186,7 @@ the current limit is displayed.
Limits of an arbitrary process can be displayed or set using the
.Xr sysctl 8
utility.
.Pp
.\".Pp
.It umask Op Ar mask
Set the value of umask (see
.Xr umask 2 )
Expand Down Expand Up @@ -2308,19 +2315,21 @@ children of the shell, and is used in the history editing modes.
.It Ev HISTSIZE
The number of lines in the history buffer for the shell.
.It Ev PWD
The logical value of the current working directory. This is set by the
The logical value of the current working directory.
This is set by the
.Ic cd
command.
.It Ev OLDPWD
The previous logical value of the current working directory. This is set by
The previous logical value of the current working directory.
This is set by
the
.Ic cd
command.
.It Ev PPID
The process ID of the parent process of the shell.
.El
.Sh FILES
.Bl -item -width HOMEprofilexxxx
.Bl -item
.It
.Pa $HOME/.profile
.It
Expand Down
4 changes: 0 additions & 4 deletions src/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,7 @@ void __inton(void);
#define int_pending() intpending

void exraise(int) __attribute__((__noreturn__));
#ifdef USE_NORETURN
void onint(void) __attribute__((__noreturn__));
#else
void onint(void);
#endif
extern int errlinno;
void sh_error(const char *, ...) __attribute__((__noreturn__));
void exerror(int, const char *, ...) __attribute__((__noreturn__));
Expand Down
Loading

0 comments on commit 5b15fe9

Please sign in to comment.