Commit Graph

238 Commits

Author SHA1 Message Date
tg 07b97d5444 document workaround for the $(…) parsing bug 2010-09-05 19:12:24 +00:00
tg 2c59cc6089 more on the cat 2010-08-28 21:22:24 +00:00
tg d09fd67299 make cat an mksh builtin, for things like here documents
if any options are given, the external programme is invoked instead
2010-08-28 17:21:46 +00:00
tg 7fdc42cead fix realpath builtin’s handling of (source) pathnames with a trailing slash
as per POSIX (if a trailing slash is part of the symlink target it fails as
well, like GNU readlink -f does)
2010-08-24 14:42:04 +00:00
tg b5bdc6d10f document the [[ $foo = "$bar" ]] thing expressly 2010-08-14 20:13:10 +00:00
tg 14dc6071e7 portable hogwash 2010-08-14 19:55:37 +00:00
tg 7c91e018f4 • merge printf from OpenBSD
• deactivate %a and %A since our libc doesn’t have it
• rewrite the mksh integration code to use shf instead of stdio, removing
  floating point support always in the process, as shf doesn’t support it
  ⇒ saves 11114 (6706 text, 168 data, 4240 bss) with dietlibc on Debian
• fix -Wall -Wextra -Wformat -Wstrict-aliasing=2 for gcc (Debian 4.4.4-7)
• fix these and -Wc++-compat for gcc version 4.6.0 20100711 (experimental)
  [trunk revision 162057] (Debian 20100711-1) except:
  – a few enum warnings that relate to eglibc’s {g,s}etrlimit() functions
    taking an enum instead of an int because they’re too stupid to adhere
    to POSIX interfaces they design by themselves
  – all “request for implicit conversion” involving a "void *" on one side
• tweak the manual page somewhat more
2010-07-17 22:09:40 +00:00
tg 1e113b416b sync with oksh and remove some unnecessary/legacy portability notes
Revision 1.136: [7]download - view: [8]text, [9]markup, [10]annotated - [11]select for diffs
   Thu Jul 15 20:04:35 2010 UTC (47 hours, 56 minutes ago) by schwarze
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.135: [14]preferred, [15]coloured
   Changes since revision 1.135: +7 -7 lines
When the first argument or arguments of a macro are opening delimiters
(parentheses and/or square brackets), both modern groff and mandoc first
output those leading delimiters as plain text, then start the macro scope
after these opening delimiters.  This is similar to printing trailing
punctuation and trailing closing delimiters on a macro line outside and
after the macro scope.  For example, ".Sq ( text )" is "(`text')",
not "`(text)'".  Thus, we now need to quote leading opening delimiters
when we want them inside the macro scope.
These are the cases in src/bin.

"makes sense" jmc@
2010-07-17 20:21:18 +00:00
tg 6b006202a1 partial oksh sync (RCSID and do add some parenthesēs to the list of
reserved words, but really only these which are only recognised at
the beginning of a line as the context says, not blindly all of them)
2010-07-13 13:12:32 +00:00
tg ad98b9fc4a compatibility: stick “set ±o arc4random” around for a bit longer,
until R40 is definitively out (so there MAY still be an R39d)

this commit can easily be reverted in its entirety later, when
Build.sh’s compatibility for “-combine” &c. is removed too
2010-07-13 13:07:58 +00:00
tg a6c81ea978 on obsd/mbsd, entropy is cheap enough for us to do this (codepath in
kernel checked for both) for additional seeding ($RANDOM is still from
the LCG only)
2010-07-11 11:17:33 +00:00
tg 4cbb5a9d46 to speed up mksh, get rid of arc4random(3) uses and use the LCG always;
depend on ASLR for seeding
2010-07-04 17:33:58 +00:00
tg 020ce07d14 document using $'…' to set $PS1 in an easier manner, after pressure 2010-05-13 18:47:50 +00:00
tg f872c5d941 sync with oksh (comments and docs only) 2010-05-13 18:44:10 +00:00
tg 3fa79f3ea4 oksh merge 2010-04-09 18:59:30 +00:00
tg ff9f89f22f Fix two more POSIX conformance bugs and minor documentation/comment issues 2010-04-08 13:21:08 +00:00
tg f41d5ba82f allow MKSHRC_PATH to change from 「"~/.mkshrc"」, for Android &c. 2010-03-27 20:36:26 +00:00
tg 98e43b0f7a rework ‘m’ and ‘v’ ulimits; add more (seen at zsh) 2010-03-27 16:51:39 +00:00
tg ffe1c04ee9 document ulimit -V (Haiku only) 2010-03-15 18:14:40 +00:00
tg f21cd59f00 rcsid sync with oksh, no change 2010-03-06 20:08:18 +00:00
tg b17b0b8909 I: mksh: hyphen-used-as-minus-sign usr/share/man/man1/mksh.1.gz:1463 2010-02-28 14:06:56 +00:00
tg fa7f439290 sync with oksh:
get rid of overlapping blocks discouraged by [16]mdoc.samples(7);
found by and unbreaking the build with [17]mandoc(1);
"fine" jmc@ sobrado@
2010-02-25 21:05:00 +00:00
tg e5e6857c43 (hopefully) fix the substitution thing for good 2010-02-25 20:18:19 +00:00
tg c67bed8790 • unbreak testsuite for MKSH_SMALL
• sync version and © year
2010-01-28 20:58:34 +00:00
tg eee75716f3 • document the pipeline thing better
• set -o {posix,sh} also turns off the other, like {emacs,gmacs,vi}
2010-01-28 15:33:11 +00:00
tg 9eee6d1d6d there is no space after .Px 2010-01-28 15:23:03 +00:00
tg 0c94277ccb To solve the incompatibility issues between mksh-current, old mksh versions
and vendor pdksh versions, re-introduce FPOSIX alongside FSH. The semantics
are now:
‣ set -o posix ⇒
  • disable brace expansion and FSH when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
‣ set -o sh ⇒
  • set automatically #ifdef MKSH_BINSHREDUCED
  • disable brace expansion and FPOSIX when triggered
  • use Debian Policy 10.4 compliant non-XSI “echo” builtin
  • do not keep file descriptors > 2 to ksh
  • trigger MKSH_MIDNIGHTBSD01ASH_COMPAT mode if compiled in
  • make “set -- $(getopt ab:c "$@")” construct work

Note that the set/getopt one used to behave POSIXly only with FSH or
FPOSIX (depending on the mksh version) set and Bourne-ish with it not
set, so this changes default mksh behaviour to POSIX!
2010-01-28 15:18:51 +00:00
tg fa63e3ba13 grml, better. 2010-01-27 18:36:19 +00:00
tg d489a0153c document an annoying ^Z bug
(I think this is because the TAND and the Job are not visible to
the code at the same time; patches welcome, as usual)

I don't think this is related to ^Z'd systrace(1)'d programmes
sometimes being unawakable, though.
2010-01-27 18:16:14 +00:00
tg 2765a07564 when using persistent history (and not MKSH_SMALL), let the shells
concurrently accessing the same $HISTFILE be more synchronised with
each other: empty lines (just pressing Return) and duplicates (that
are split and written twice by the lines loaded from $HISTFILE in
the meantime); requested by Maximilian “mxey” Gaß in #!/bin/mksh
2010-01-25 16:12:57 +00:00
tg 2e9654ffa4 introduce “typeset -i foo[*]”, rationale see cid 1004B5DA60A56BFB604 2010-01-25 14:25:16 +00:00
tg c700693d11 Add “unset foo[*]” mksh extension, which allows to unset the *contents*
of foo[0] (but not its attributes), and the rest of the array, so that
later “set +A foo bar” will set foo[0]=bar but retain the attributes.

This is important, because, in the future, arrays will have different
attributes per element, instead of all the same (which, actually, is
not entirely true right now either, since “unset foo[0]” will not mo-
dify the attributes of a foo[1] existing at that point in time), where
foo[$newkey] will inherit from foo[0], but typeset foo will only affect
foo[0] no longer foo[*] in the future. (The rules about typeset=local
will still apply, as they affect creation of variables in a scope.)
2010-01-25 14:11:29 +00:00
tg 833810a154 While we were supposed to use Ctrl-Arrowkey for wordwise jumping,
some idiotic terminal emulators and/or people seem to use the es-
cape codes normally denoting Alt-Arrowkey instead so let's simply
bind them to the vt_hack as well... (untested)
2010-01-08 22:21:06 +00:00
tg 1baed92a90 document that mksh evaluates namerefs lazily but ksh93 doesn't 2010-01-06 18:29:01 +00:00
tg 0611ecad1f make [[ -o ‣-U ]] = [[ -o ‣+U ]] = [[ -o ‣utf8-mode ]]
where ‘‣’ is either nothing, ‘!’ or ‘?’ as usual.
2010-01-01 18:02:01 +00:00
tg 6115f5a91c • re-implement wcswidth-like behaviour for ${%foo} even in !UTFMODE
• merge the rest of branch tg-wcswidth-behaviour
• enhance test cases for wcswidth-like behaviour
• switch hash table collision resolution algorithm to Python’s as announced
• bump vsn
2010-01-01 17:44:10 +00:00
tg 417fd60c76 * fix 'set -A foo -- [2]=a b c' contingency (tested against GNU bash4,
which, in its latest sid incarnation, even received mksh's ability
  to produce ${!foo[*]} array keys, wow!)
* plug a memory leak while here (ATEMP only, but still)
2009-12-01 19:15:35 +00:00
tg 7063a9a921 lintian: hyphen-used-as-minus-sign 2009-11-23 12:49:55 +00:00
tg 29176a176f fix more manpages 2009-11-22 18:23:38 +00:00
tg 22ff50fe55 IFS (even in AT&T ksh93) are octets, so 'IFS=…' isn’t possible atm 2009-11-22 14:23:21 +00:00
tg 2094e3f25c since we have wcwidth anyway, expose it as ${%strvar} to the user, iff
utf8-mode is enabled (otherwise it'll be a synonym for ${#strvar} aka
the number of octets in it)
2009-11-21 23:23:20 +00:00
tg aa31a51e5f sync with reality 2009-11-21 23:21:23 +00:00
tg ba9375684d update portmdoc, sprinke a few more macros that now work 2009-11-17 21:49:42 +00:00
tg eafe88aa74 • overhaul handling of special variables
• use a combination of the one-at-a-time hash and an LCG for handling
  the $RANDOM special if !HAVE_ARC4RANDOM instead of rand(3)/srand(3)
  and get rid of time(3) usage to reduce import footprint
• raise entropy state (mostly in the !HAVE_ARC4RANDOM case though…)
• simplify handling of the $RANDOM_SPECIAL generally
• tweak hash() to save a temp var for non-optimising compilers
• some int → mksh_ari_t and other type fixes
• general tweaking of code and comments
2009-10-17 21:16:05 +00:00
tg 549888a183 while testing haserl-0.9.26 on MirBSD, I discovered that the echo builtin
in FSH mode did in fact, contrary to POSIX and Debian Policy 10.4 behavi-
our (I think), interpret escape sequences; fix and add testsuite for echo
2009-10-10 21:17:31 +00:00
tg 33b9f8b666 * rename "set -o posix" (FPOSIX) to "set -o sh" (FSH) because it's not
just a "somewhat more POSIX" but also a "/bin/sh legacy kludge" mode
* consistently capitalise POSIX and SUSv3/SUSv4 (same as AT&T ksh) and
  Bourne shell
2009-10-02 18:08:37 +00:00
tg a59d14b565 further optimise and simplify the handling of $RANDOM, reads and writes
to it are now either arc4random or rand/srand, but srand retains the old
state; set +o arc4random is no longer possible, but if it's there we use
arc4random(3), if not, we use rand(3) for $RANDOM reads; optimise special
variable handling too and fix a few consts and other minor things
2009-09-26 03:40:03 +00:00
tg 1ea1096a4e Add a hack input function for VT100-style key sequences; support
Ctrl-CurLeft and Ctrl-CurRight (not quite ANSI, but fits the scheme)
2009-09-20 17:23:52 +00:00
tg 588921333e more of this:
• shell flags are now handled in one single place (sh_flags.h)
• sync comments (between enum and array) and manpage with reality
• FMONITOR is now no longer needed for Hartz IV shells
2009-09-20 16:40:58 +00:00
tg 8a0c68a184 document cid 1004AB55AA4341EC755, printf builtin may use $'...' backslash
expansion code instead (and the one from the print builtin for %b), same
as AT&T ksh93 does
2009-09-20 12:12:00 +00:00