move some information off mksh.1; harmonise

This commit is contained in:
tg 2015-10-09 20:33:49 +00:00
parent fc48729336
commit 7a5a9c9ea0
1 changed files with 42 additions and 9 deletions

51
lksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/lksh.1,v 1.12 2015/10/09 19:28:20 tg Exp $
.\" $MirOS: src/bin/mksh/lksh.1,v 1.14 2015/10/09 20:33:49 tg Exp $
.\"-
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
.\" mirabilos <m@mirbsd.org>
@ -173,6 +173,20 @@ It is recommended to port scripts to
.Nm mksh
instead of relying on legacy or idiotic POSIX-mandated behaviour,
since the MirBSD Korn Shell scripting language is much more consistent.
.Pp
Note that it's strongly recommended to invoke
.Nm
with at least the
.Fl o Ic posix
option, if not both that
.Em and Fl o Ic sh ,
to fully enjoy better compatibility to the
.Tn POSIX
standard (which is probably why you use
.Nm
over
.Nm mksh
in the first place) or legacy scripts, respectively.
.Sh LEGACY MODE
.Nm
currently has the following differences from
@ -203,22 +217,30 @@ change between versions; see the accompanying manual page
for the versions this document applies to.
.It
.Nm
only offers the traditional ten file descriptors to scripts.
.It
.Nm
uses
.Tn POSIX
arithmetics, which has quite a few implications:
The data type for arithmetics is the host ISO C
The data type for arithmetics is the host
.Tn ISO
C
.Vt long
data type.
Signed integer wraparound is Undefined Behaviour.
Signed integer wraparound is Undefined Behaviour; this means that...
.Bd -literal -offset indent
$ echo $((2147483647 + 1))
.Ed
.Pp
\&... is permitted to, e.g. delete all files on your system
(the figure differs for non-32-bit systems, the rule doesn't).
The sign of the result of a modulo operation with at least one
negative operand is unspecified.
Shift operations on negative numbers are unspecified.
Division of the largest negative number by \-1 is Undefined Behaviour.
The compiler is permitted to delete all data and crash the system
if Undefined Behaviour occurs.
if Undefined Behaviour occurs (see above for an example).
.It
.Nm
only offers the traditional ten file descriptors to scripts.
.It
.\"XXX TODO: move this to FPOSIX
The rotation arithmetic operators are not available.
@ -298,7 +320,18 @@ as
.Pa /bin/sh ,
compilation to enable
.Ic set -o posix
by default is highly recommended for better standards compliance.
by default if called as
.Nm sh
is highly recommended for better standards compliance.
For better compatibility with legacy scripts, such as many
.Tn Debian
maintainer scripts, Upstart and SYSV init scripts, and other
unfixed scripts, using the compile-time options for enabling
.Em both
.Ic set -o posix -o sh
when the shell is run as
.Nm sh
is recommended.
.Pp
.Nm
tries to make a cross between a legacy bourne/posix compatibl-ish
@ -308,7 +341,7 @@ is not exactly specified.
.Pp
The
.Ic set
built-in command does not have all options one would expect
built-in command does not currently have all options one would expect
from a full-blown
.Nm mksh
or