Commit Graph

84 Commits

Author SHA1 Message Date
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
tg bb5e56d4c4 remove ${ foo;} from mksh again due to buffering issues jilles found 2012-08-17 18:34:25 +00:00
tg 9b7b7f742e implement ksh93 feature ${ foo;} 2012-07-30 21:37:17 +00:00
tg 25f413bf7d first part of LP: #909818; ${name@#} will later be changed to ${name@#expr} where expr is the IV ipv 0 (eval.c:377ff) 2011-12-31 01:07:19 +00:00
tg 0d2244da81 use += and do some more mitigation of the alloc problem first 2011-11-25 23:58:04 +00:00
tg 5c1108c5fa actually… the error paths didn’t se-unset noglob! after looking at the
code, until further proof I believe noglob is not even needed ⇒ drop it
2011-11-25 23:54:06 +00:00
tg 5ac24244fd == inside [[ is not nice, and parsing $(set +o) isn’t either,
since we don’t just have [[ -o ]] now, but can use standard $- here
2011-11-25 23:43:59 +00:00
tg 577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg 6ce68e906f now that I got Hash.cs compiled and run, I’m amazed; make NZAAT (and NZAT!) all green with a small tweak; bit distribution and χ2 look OK as well 2011-07-18 00:35:46 +00:00
tg 3ef67e3296 replace uses of OAAT hash in all its variants by NZAT (mksh internal) or NZAAT (all others) 2011-07-06 22:22:02 +00:00
tg fe2c0221b3 replace typeset with local, as style(9) now mandates
(keep globals for a while, until it’s widespread, though)

since we don’t export PS1 any longer, no need to stay AT&T ksh compatible
2011-07-05 20:19:18 +00:00
tg 02b76603f8 new function for dot.mkshrc:
23:19⎜<laffer1:#midnightbsd> oddly enough the only cshism i like is setting environment variables at this point.
2011-07-03 23:26:47 +00:00
tg 2cfc3e5c3d mksh R40 Release Candidate 1
Testsuite:
• add new need-pass: {yes|no} attribute, default yes
• exit with 1 if a need-pass test failed unexpectedly
  idea by Kacper Kornet <draenog@pld-linux.org>
• mark utf8bom-2 as need-pass: no
Infrstructure:
• add housekeeping function for making a tty raw
• switch functions with unused results to void
• struct op: u.charflag contains last char of ;; in TPAT
• var.c:arraysearch is now a global function
Language:
• add ;& (fall through) and ;| (examine next) delimiters
  in addition to ;; (end case) as zsh extensions, because
  POSIX standardised on ;& already
• add -A (read into array), -N (read exactly n bytes),
  -n (read up to n bytes), -t (timeout) flags for read
  from ksh93
• allow read -N -1 or -n -1 to slurp the entire input
• add -a (read into array the input characters) extension
  specific to mksh to read, idea by David Korn
• add -e (exit with error if PWD was not set correctly
  after a physical cd) to cd builtin, mandated by next
  POSIX, and change error codes accordingly
Rewrites:
• full rewrite of read builtin and its manpage section
• add regression tetss for most of the new functionality
• duplicate hexdump demo tests for use of read -a
• use read -raN-1 in dot.mkshrc to get NUL safe base64,
  DJB cdb hash and Jenkins one-at-a-time hash functions
2011-05-29 02:18:57 +00:00
tg 4e626ecc30 add smores, a more(1)-like pager 2011-02-09 19:32:35 +00:00
tg 1c4aab3a3e when setting a UTF-8 locale, also set -o utf8-mode
since we might start on e.g. GNU/Linux with a system-wide C locale
2011-02-02 22:48:15 +00:00
tg beba20ea56 since dot.mkshrc is sourced by interactive shells anyway, and exporting
PS1 may hurt other shells, do not export it any more

reported by and fix suggestion / affected variables by Frank Terbeck
2010-11-26 21:08:54 +00:00
tg 0a5d6bc71b use string width, not length, if we have it 2010-07-11 13:54:37 +00:00
tg f878310b58 fix spelling 2010-07-04 17:35:16 +00:00
tg 0d484ffa65 some OSes pre-define $ENV; let this be another hint to their users 2010-02-25 20:48:10 +00:00
tg bbb4a1a70f add Loaathash1 (iv=0x100 ipv 0) 2010-01-25 14:29:34 +00:00
tg 01823e0e11 use [[ -o … ]] instead of [[ $- = *U* ]] manipulation 2009-12-12 22:27:14 +00:00
tg 6e9d7f33e8 like a pathfinder, one good commit a day:
add most of the mksh wtf edition dot.mkshrc patch, some commented
out; optimise some other cases (e.g. don't reset MKSH if set, don't
export already exported variables, etc.)
2009-11-03 17:58:44 +00:00
tg 9008fe34a2 unalias which, to allow which -a sh, etc. 2009-11-02 18:47:02 +00:00
tg 345030a578 we need more RCS IDs! 2009-08-27 16:52:12 +00:00
tg b5b5d905b0 various fixes and optimisations:
• ensure unsigned arithmetics is used in the cdb hash
• make the hash functions print their result again
• now we can use the Lb64{en,de}code trick of using stdin if "$*"==""
• optimise the one-at-a-time code for shell
2009-08-27 16:40:08 +00:00
tg 4c1a99da7c implement Jenkins’ one-at-a-time hash, which has better avalanche
behaviour than DJB’s CDB hash (good if using more than one byte)
and probably no funnels

the CDB hash is good for short (5-6 char) ASCII keys though
2009-08-27 16:29:21 +00:00
tg fb6d8cd895 this is Korn Shell, not C – less ops are always faster than many fast ops 2009-08-27 16:03:52 +00:00
tg fd0ddd5902 add a DJB cdb hash implementation in mksh, which, for speed, uses a
global variable ipv print’ing the result for reparse. conveniently,
it’s already typeset just right (unsigned hex integer, zero padded)
2009-06-22 17:38:39 +00:00
tg 261cabad23 fix $@ vs $* mix-up 2009-06-22 17:27:22 +00:00
tg 804fe16118 add base64 decoder and encoder in mksh 2009-05-31 17:17:33 +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 43de9f8dff shorten 2009-04-05 12:42:34 +00:00
tg 177b1b4cf9 always set COLUMNS and LINES; make use of the fact in dot.mkshrc 2008-12-29 21:34:22 +00:00
tg 553ff601b7 optimise: embed ^A and ^M inside the default PS1 string 2008-12-13 17:09:45 +00:00
tg 5206ddcc65 much simplify and shorten default $PS1 (uses even more magick now) 2008-11-07 20:07:10 +00:00
tg b41a72ac2e add new builtin “realpath” calling realpath(3) on its argument, skipping
over “--” for compatibility to Debian realpath(1) and possibly busybox’

“sounds handy” replaced@TNF
2008-05-17 18:27:57 +00:00
tg 4e4ede2442 fix for $HOME with trailing slash (do not expand then either… we could just
strip it, but that might have other problems, better is to use realpath(2),
e.g. via readlink(1), for normalisation, or have the sysop fix it)

XXX make realpath a builtin?
2008-05-16 22:22:11 +00:00
tg 8cf7c94908 if $HOME is / or empty, bash-style tilde replacement yielded funny results 2008-05-16 22:19:11 +00:00