Commit Graph

121 Commits

Author SHA1 Message Date
tg b52badd958 oh wait, actually…
• besides the previously-set $EDITOR take [jupp jstar mcedit ed vi]
  as sorted list, first one found wins
• set -eu safe, and in the lksh part
2017-08-08 21:10:21 +00:00
tg b00e5b01b4 promote jupp to default editor if installed, in the customisation section 2017-08-08 20:52:11 +00:00
tg bc1746bccb comment 2017-08-08 20:50:34 +00:00
tg 0af974d905 let hd_mksh take from stdin, great simplification 2017-08-08 20:42:16 +00:00
tg 7f7fb75205 make EBCDIC-safe 2017-08-08 20:40:25 +00:00
tg 252c4b181b perform in chunks, don’t read the entire file into memory ahead 2017-08-08 20:38:08 +00:00
tg ce64148abb always expone mksh’s hexdumper 2017-08-08 20:22:16 +00:00
tg 9466b49fe8 add standard variable PATHSEP, for better and easier OS/2 support 2017-03-19 22:31:29 +00:00
tg 1dd5ae69ae fix padding in Lb64encode
undefined array elements read as "" or (arithmetically) 0
so this is ok and works as the lines below expect it
2017-03-19 21:08:25 +00:00
tg 06b2d53ea2 use \\builtin ipv \let] and \set internally 2017-03-19 20:59:29 +00:00
tg 73dca6e90f use the new “\builtin” builtin for quoting, everywhere 2017-03-19 20:36:08 +00:00
tg 4cc0d14466 exclude PATH manipulation if we guess at OS/2 2017-02-18 02:37:57 +00:00
tg 2584cd0634 fixup relation between lksh and mksh (somewhat minimal delta) 2017-02-18 02:33:15 +00:00
tg 3c6fec1db3 missed a function (due to it being POSIX, not Korn, probably) 2016-07-26 22:03:41 +00:00
tg 2364bb5f22 use ^< and ^> for ROL and ROR in R53, schedule >>> as SAR for R54
cf. http://david.tribble.com/text/c0xrot.htm
2016-07-25 20:41:23 +00:00
tg e0e63c65e6 fix issues with home directory replacement, from Torsten Sillke:
• if $PWD = ${HOME}foo, no longer show as ~foo in PS1
• simplify ~, ~+, and ~- exactly as $PWD is upon shell entry
  (fixes HOME=/home/./foo but PWD=/home/foo)
2016-07-24 23:05:52 +00:00
tg da085fd7d2 simplify 2016-04-09 16:33:23 +00:00
tg c56d848a10 set -U after LANG/LC_*, for future compatibility, cf. commitid 10056858F3B37548534 2015-12-31 21:00:12 +00:00
tg ceb98d7558 we must quote a tilde in substitutions now 2015-12-12 18:47:40 +00:00
tg cef386fb60 make “source” into a built-in command (keepasn, to match ksh93 and “dot”);
remove the “stop” alias and drop old Android and OS/2 hacks and auto-unalias
2015-10-09 21:36:59 +00:00
tg c2d9863a05 make setenv set -u safe and fix behaviour for no args 2015-07-18 23:03:24 +00:00
tg ba8a6e9461 merge OS/2 style PATH (absolute with drive letters, ‘;’ as separator)
From: KO Myung-Hun <komh@chollian.net>
2015-07-10 19:36:38 +00:00
tg be8c2fa8c2 optimise by making use of commitid 1005529AD8D33CF99B9 2015-07-05 19:02:16 +00:00
tg f03037706c cd does weird things wrt. error messages; slightly better, from carstenh via IRC 2015-06-27 20:44:01 +00:00
tg 1d347a35fe EBCDIC review 2015-04-29 20:56:18 +00:00
tg 4ee3269564 • the \: "${foo:=bar}${bar:=baz}" construct needs no spaces
• more set -u police
• 80c and tweaks while here
2015-04-11 19:01:59 +00:00
tg 451aef7a8a some robustness improvements for dot.mkshrc:
• do not use \return for return before we know we are mksh
  (plus fix a wrong-word mistake)
• quote the argument(s) to \: (“colon”) for SECURITY
• default $MKSH to /bin/mksh (not normally reached)
• while here: check $USER only once, not for each PS1 (speed)

this addresses and mostly closes LP#1441853 – prt.mkshrc (in
OBS home:mirabile/mksh and DEB wtf-mksh they are identical)
is already good; Android mkshrc needs only some small robustness
fixes (mostly colon-related; enh says TMPDIR is good); I tested
this with “mksh -eu” and “mksh -eul” on Debian and ecce and with
read-only “/” and nothing else mounted on ecce, and it WFM
2015-04-11 18:08:56 +00:00
tg 0d72355038 “local x=$1” is supposed to not field-split and so 2015-03-14 05:23:18 +00:00
tg f893c7a347 implement “enable” (like GNU bash) to stop Harzilein from complaining
about mksh’s “rename” builtin
2015-03-08 23:50:00 +00:00
tg 8f53c68265 • protect POSIX builtins and utilities from aliases, e.g:
‣ : → \:
  ‣ alias → \alias
    ⇒ except in some internally used cases, where we use \builtin alias
  ‣ command . → \command .
• protect Korn Shell builtins from aliases and functions, e.g:
  ‣ typeset → \builtin typeset
    ⇒ also unravels the “local” alias used
  ‣ print → \builtin print
• protect internally-used things from aliases
  ‣ “let]” is not a valid function name
  ‣ “set” is POSIX so we don’t expect anyone to override it in a function
• use “command -v” instead of “whence -p” (“which”) in most
  places; thanks izabera from #ed on IRC for pointing out
  that “command -v” is POSIX – except, “whence -p” a̲l̲w̲a̲y̲s̲ looks
  for an executable and shows its full pathname; “command -v”
  also resolves to aliases, functions and builtins, so only use
  it where it makes any sense (both never output to stderr)
• make most of dot.mkshrc work in the face of such aliases
  ‣ “ulimit -c” is used; this is not POSIX, and not portable;
    maybe we should make ulimit accept-and-ignore the most
    common limits even if the OS doesn’t use them?
• update list of builtin aliases in the manpage
2015-03-08 22:54:36 +00:00
tg 59fcff27ae • fix bug spotted by geirha: typeset args are glob-prone
• ormaaj suggested adding gsf’s homepage (still no new ast-ksh)
2015-01-11 00:23:06 +00:00
tg d048818dfa • when using typeset to change the type of an array,
use arrname[*] to denote changing it of all array elements
• optimise a bit: group local invocations
2015-01-06 20:54:53 +00:00
tg 097ed42c83 https://android-review.googlesource.com/102253
• permit interrupts during a write(2) loop in the cat builtin, too,
  not just in the read(2) loop – fixes inability to kill a clogged
  output cat

• kill the cat when smores finish

TODO: revisit this ⓐ in more depth, ⓑ for other functions, such as
      “hd”, and ⓒ test on AOSP as well
2014-07-28 21:45:45 +00:00
tg 270a86f895 • use BAFH for hash ipv NZAAT
• prep for release
• fix minor nits in manpage and tests
2014-01-11 18:09:43 +00:00
tg 95a19997b8 avoid NZATMix returning false on its identity mapping (00000000h) 2014-01-05 22:17:57 +00:00
tg 0545eb1c45 • use Rijndæl MixColumn for arc4random_roundhash avalanching;
suggested in http://crypto.stackexchange.com/questions/12145
• add pure mksh™ implementation, too, while here (since it can
  replace NZAATFinish even though NZATMix is slower, both are
  bijective)
2014-01-02 22:51:01 +00:00
tg 75c00ebaae • don’t eat builtin cd errorlevel in function cd
• fix extglob in function cd_csh to match current error strings
2013-08-22 13:46:46 +00:00
tg 1d487d9163 by request of gecko2@ make “doch” keep stdin at slight lack of privacy 2013-08-10 13:43:50 +00:00
tg 35710c6461 disable utf8-mode for hd function (temporarily) 2013-07-25 14:02:02 +00:00
tg 1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +00:00
tg 54a698d564 pimp the hexdump function 'hd' for when there is none 2013-05-02 21:46:29 +00:00
tg c3b93834b0 lksh also reads $ENV so make sure it doesn’t try this one 2013-04-27 18:19:44 +00:00
tg 1a21176cac Tonnerre Lombard’s contribution:
[17:27:44] Tonnerre: csh: alias doch sudo \!-1 bash: alias doch='sudo $(history -p !-1)' zsh: alias doch='sudo $(fc -ln -1)'
[17:28:03] mirabilos: ?
[17:28:34] Tonnerre: Na ganz einfach:
[17:28:36] Tonnerre: % ls /root
[17:28:39] Tonnerre: ls: cannot open directory /root: Permission denied
[17:28:42] Tonnerre: % doch
[17:28:45] Tonnerre: [sudo] password for tonnerre:
[17:28:49] Tonnerre: anaconda-ks.cfg  cgminer-1.6.2-1.rf.src.rpm  rpmbuild  upgrade.log  upgrade.log.syslog
[17:28:53] Tonnerre: %

This is one of two mksh variants; the other uses a tmpfile:
alias doch='sudo mksh -c "${ fc -ln -1;}"'

Both quote correctly, unlike the above.

Maybe use $MKSH instead? (Quoted or unquoted? Hm. Probably quoted.)
Input on that welcome…
2013-04-05 15:39:52 +00:00
tg 8697048c2c set (but never export!) PS4 to something timestamped by default, as an example 2013-03-24 15:01:35 +00:00
tg 576b7f21b3 eval is evil
Proper quoting is hard
Bugs galore
2013-02-17 15:58:26 +00:00
tg 9bf0509829 provide a layer of locality to FUNSUBs; get rid of a fork for each PS1 thus 2013-02-10 23:30:47 +00:00
tg af39f3b7b0 do NOT close stdout or stderr, redirect to /dev/null instead
⇒ we did have issues with that, trust me…
2013-02-10 19:04:00 +00:00
tg 72c895c4a1 precmd is required to retain the errorlevel when ${ …;} is used 2013-01-21 15:06:24 +00:00
tg 0f3071a8b2 MKSH_DISABLE_EXPERIMENTAL is a NOP again; use ${ precmd;} in dot.mkshrc 2012-11-30 20:19:16 +00:00
tg bbc0702cdd make “set -o nounset” friendly (even though people who use THAT are at own fault, IMO!) 2012-10-30 21:04:56 +00:00