Commit Graph

199 Commits

Author SHA1 Message Date
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
tg 9fd4b9db41 $'…' functionality, documentation improvements, fixes for backslash
expansion in all modes, regression tests for both kinds of backslash
expansion; unbksl() revamp; make CTRL macro available globally
2009-09-19 21:54:46 +00:00
tg c8eb13a13f align with C standard (optional C style); document differences to C style
for print builtin (align with ksh93 ipv GNU bash)
2009-09-19 19:08:48 +00:00
tg 7806fe510a allow “function stop () {” (bashism, an evil one) 2009-09-19 18:36:59 +00:00
tg e0f000fb83 new function unbksl doing "backslash expansion" independent of c_print();
also make a separate subsection about it in the manpage
2009-09-19 15:16:05 +00:00
tg 3639137e48 another ksh93 feature: test -o ?foo (almost zero cost) 2009-09-07 17:24:49 +00:00
tg ce24c5da13 • more on pipelines vs subshells
• remove some superfluous spaces
2009-09-06 18:17:51 +00:00
tg 9dd98da40d Support Dave Korn’s alternative 「'a'」 (or 「'…'」) form for base-one
integers in addition to my 「1#a」 (or 「1#…」), which also allows for
finer end-of-character checking. Note that this is locale-dependent in
ksh93, set ±U dependent in mksh, and mksh’s OPTU-16 encoding is used.
2009-09-06 17:55:55 +00:00
tg 9531e12b36 merge the nameref code, using mksh standard scoping as discussed 2009-09-06 17:42:15 +00:00
tg 574d6725aa document more differences to ksh93; here: static vs dynamic scoping 2009-09-05 17:12:49 +00:00
tg 4a4be7d313 add the chdir builtin from mircvs://contrib/hosted/tg/deb/mksh/ for
better dash compatibility (mksh is now a dash superset if printf is
compiled in)
2009-08-30 21:02:01 +00:00
tg 75a7eb63e1 document the _possible_ printf(1) builtin and mark that it’s not supported 2009-08-30 11:38:44 +00:00
tg 09abc55150 documentation and test suite for tonight’s new features, ☾ gn8 2009-08-28 22:46:21 +00:00
tg d5d6e97683 implement "typeset ±a" as no-op 2009-08-28 21:51:52 +00:00
tg a95b90b79f add the keyword “colour” to the PS1 example, since it wasn’t found in
here in either spelling and smultron@ wanted to see how it’s done
2009-08-14 09:00:30 +00:00
tg b42582689f ABI bump to R39: adhere to the future POSIX standard regarding -o nounset;
add appropriate regression test (except $_ *is* unset in non-interactive
shells). See the thread at:
http://article.gmane.org/gmane.os.miros.general/8863
2009-07-16 15:06:45 +00:00
tg e42e775d9b sync special commands list (XXX why is alias there twice? pdksh.deb too…) 2009-07-08 10:37:24 +00:00
tg f349aeab3c be more robust against things like Debian #535970
reverts and rewrites the code from cid 10047C1EBA57E4F4AF0

XXX find out if this is done right
2009-07-06 15:06:25 +00:00
tg 0b4b689c92 note that ${foo//bar/baz} may need the pattern escaped; discovered by me
for # and %, and by Matt Lewandowsky («lewellyn:#ksh») for & as pattern.
2009-07-06 09:37:03 +00:00
tg 25ea755f54 wbx@ requested that his feature is not called his feature 2009-06-21 15:43:17 +00:00
tg 63c56000f7 sync with oksh:
Revision 1.129: [7]download - view: [8]text, [9]markup, [10]annotated - [11]select for diffs
   Thu May 28 06:09:06 2009 UTC (3 days, 11 hours ago) by jmc
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.128: [14]preferred, [15]coloured
   Changes since revision 1.128: +6 -6 lines
fix missing bracket by slightly rewriting; from Alan R. S. Bueno
2009-05-31 17:41:09 +00:00
tg da5dc48cd0 implement an extension that an interactive mode input line, when
starting with an ‘!’ exclamation mark at the beginning of a com-
mand (PS1 not PS2), shall have the same effect as the predefined
“r” alias, to be compatible with csh and GNU bash’s “!string” to
«Execute last used command starting with string» – documentation
and feature request provided by wbx@ (Waldemar Brodkorb)
2009-05-27 19:52:38 +00:00
tg 9179c10119 pgas mentioned ksh93 does [[ $foo ]] (ipv forced [[ -n $foo ]])
and it actually REDUCES code size to allow it as well; mention
in the manpage that it’s merely unportable (and of course exe-
cution time differs); sync clog
2009-05-21 14:28:35 +00:00
tg b6ce748064 • remove “#if 0” and “#ifdef notdef” style old debugging code
• expose “#ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT” just in case they decide to
  require it and show it in the ksh version automatically
• sync the use of non-ASCII characters over files (unification)
2009-05-16 18:40:09 +00:00
tg b145ca5c9f • sync distrib/special/mksh/Makefile with bin/mksh/Build.sh and
fix the regression test’s results while here, which have been
  broken since cid 10049D9BE5254CE65B8
• get rid of separate copyright file which was intended for De-
  bian; track down commits in all files of oksh-mirbsd and mksh
  to get correct copyright years per-file, as is BSD custom
2009-05-16 16:59:42 +00:00
tg cc783807d3 this began as a one-word change to the spec (manpage): that
${foo:1:2} operates on characters ipv bytes – which means:
‣ set +U: octets
‣ set -U: MirOS OPTU-8 characters

for consistency I also adapted ${#stringname} to deliver the
length in characters ipv bytes; more may follow; for example
I’d like a way to expose the string width.

you can already get the MirOS OPTU-16 of a character in the
WTF-8 (「set -U」) mode with something like
│ typeset -Uui16 -Z7 x=1#${stringname:position:1}
which will correctly use the PUA EF80‥EFFF mapping for octets.

due to this being an incompatible change, bump to R38

also change the unicode-hexdump sample regression test and
add two news for ${x:1:2} and ${#x} checks in A/W mode ☺
2009-05-16 15:53:02 +00:00
tg 36f737f5cb bind new search-history-{up,down} to ANSI PgUp and PgDn keys
“because we can”
2009-05-16 14:45:40 +00:00
tg e7c565b2aa document currently bound ANSI cursor keys (↑↓←→ Home End Del) 2009-05-16 14:44:37 +00:00
tg 1535151525 fix typo 2009-05-16 14:34:58 +00:00
tg 747cc12184 Add search-history-up and search-history-down keybindings (both unbound
by default) to the Emacs command line editing mode; patch originally by
James Butler <sweetnavelorange@gmail.com> but slightly modified

10x
2009-05-16 14:19:23 +00:00
tg eb3f3d584f move pdksh and contributor dedication into TFM, preparation for things
to come
2009-05-16 14:17:39 +00:00
tg 3765851432 address RedHat BZ#496791: fix currently not possible, because the code
which escapes $(…) content does not know if an imbedded ‘#’ is a comment
leader or something else like “16#foo”, “${#bla[*]}”, “${foo#bar}”, &c.
and the comment skip code does not know about nesting beforehand
⇒ document this problem in the place where it already documents that
  the current code does not properly handle nested $($(…)) expressions

patches welcome
2009-04-22 16:25:12 +00:00
tg 7463e5daa7 fix an oversight 2009-04-07 21:23:28 +00:00
tg ecef21a50a switch mail address to .org domain 2009-04-07 19:46:55 +00:00
tg 3dc6b813fd • document new (clarified) macro behaviour – bugfix
• make bind ^X vs ^[[ section more clear
2009-04-05 12:45:25 +00:00
tg 44202462f5 even more clear; ok «gps23» 2009-03-23 12:21:02 +00:00
tg a6d9fe51dc give example 2009-03-23 12:16:58 +00:00
tg c37c7aea61 document somewhat surprising behaviour
12:58⎜<gps23:#ksh> someone please tell me why:   code=1; if [ "code" -eq 1 ] returns true
13:10⎜<mira|AO:#ksh> hm but I see the problem
13:10⎜<mira|AO:#ksh> code=1; x=code; [ "$x" -eq 1 ]
13:10⎜<mira|AO:#ksh> this is indeed unexpected
13:10⎜«pgas:#ksh» gps23: code=1+1;[ "code" -eq 2 ] && echo true #also works
as of now, we consider
13:13⎜«pgas:#ksh» gps23: when you use -eq there is something like an implicit $(( )) around the
     ⎜    arguments
13:14⎜«pgas:#ksh» [ code -eq 1 ] is the same as [ $((code)) -eq 1 ]
to be documented.
2009-03-23 12:15:33 +00:00
tg bf7c84eef6 merge manpage and sync RCS IDs
not merged: POSuX character class nonsense
2009-03-22 18:09:17 +00:00
tg 32bc1dc40e sprinkle mksh_ari_t to limit arithmetics to 32 bit even
on Debian Lenny/amd64 (XXX need more verification; this
can be used for 64 bit arithmetics later too)

PPID, PGRP, RANDOM, USER_ID are now unsigned by default
2009-03-14 18:12:55 +00:00