Commit Graph

57 Commits

Author SHA1 Message Date
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
tg 6be5205b36 mksh:
* initialise the integers PPID, OPTIND, RANDOM, SECONDS, and TMOUT to base-10
* bring back PGRP as base-10 integer to the process group via getpgrp(2)
* initialise USER_ID as base-10 integer to the effective user id as retrieved
  from geteuid(2) = $(id -u)
* use $USER_ID in dot.mkshrc instead of spawning an id(1) process
  -> dot.mkshrc,v 1.34 now requires mksh R34
* convert more int to bool where appropriate
* remove dead code - getpgrp(2) cannot fail
* sync manual page to reality
* bump to mksh R34(beta) - feature freeze

XXX check if our_pgrp in jobs.c is still really needed, the setpgid call
XXX probably just makes us our own pgrp leader, and we might have to use
XXX and update kshpgrp accordingly - need feedback/help here but I think
XXX this simplification should be possible if I grok the code correctly.

etc/profile:
* adjust to $USER_ID changes in mksh (speed-up here, too)

mksh.hts:
* sync changelog
2008-05-15 15:24:11 +00:00
tg e57f5fc09b • be friendlier to AT&T ksh: use only signed (standard) integers
‣ now, a “ksh93” just requires ‘function precmd { :; }; set -o emacs’
    afterwards to get rid of the annoying error messages
  ‣ I could lose that with the following idiom:
    - PS1='$(precmd)…
    + PS1='$(typeset -i e=$?; typeset -f precmd >&- && { (return $e); precmd })…
    but it didn’t seem worthwhile to me
• remove explicit licence blah, normal ./copyright applies
2008-04-22 13:48:15 +00:00
tg 4ff0ca0f86 improve the use (parsing) of “set +o” output in the examples 2008-04-19 22:03:19 +00:00
tg 92eb2aee78 • make sure “ls” is no shell alias:
‣ first alias ls=ls to define it (so that unalias won’t fail)
  ‣ then unalias ls
• don’t hardcode /bin/ls path
2008-04-11 20:14:02 +00:00
tg 09318a472b no longer make the DIRSTACKBASE variable read-only – it makes too much
trouble when re-reading .mkshrc, and “we sell rope” after all
2008-03-03 20:22:37 +00:00
tg 047da7a0eb simplify 2008-03-03 18:44:32 +00:00
tg 947bc8e05b finally, all bugs fixed, adjust dot.mkshrc to use the subst code 2008-03-01 21:24:58 +00:00
tg 015e334ccf oops. forgot to commit:
• bump © year
• document better too
• optimise
2008-03-01 16:35:30 +00:00
tg 8d170a3d01 fix on Interix, where tr(1) is more weird than even Solaris’ XPG4 one…
just do not use ranges, no matter what.
2008-02-29 16:38:41 +00:00
tg 3e870cb1a5 handle slowlaris idiotic /usr/xpg4/bin/tr(1) 2008-02-29 11:48:32 +00:00
tg e56a49adb1 small optimisations 2007-10-25 14:54:00 +00:00
tg 60dfd05620 enable to use colour escapes framed with ^A by default 2007-10-02 01:03:12 +00:00
tg 1086ebe83f • reduce number of readlink(1) / realpath(3) calls by caching the result of
running it on “~/.” (must be a directory) in a global readonly variable
• if readlink fails, use some more or less sane values (no idea what csh(1)
  does in these cases, maybe some feedback here?)
• optimise, while here
2007-09-25 22:36:36 +00:00
tg 9533756d25 use precmd() to do the errorlevel-display dance, so that yofuh can disable
it more easily, and it got an actual use case
2007-09-25 15:48:45 +00:00
tg f632120cc2 by popular request, add
• dirs, pushd, popd like ports/shells/csh (Berkeley C shell)
• precmd, chpwd like ports/shells/zsh (Z shell)
and implement keeping ${DIRSTACK[0]} up to date via chpwd()
instead of doing it on entry of pushd and dirs (so that it
can be used directly)

this is slow compared to earlier, but people seem to want it
2007-09-24 20:30:04 +00:00
tg 7ddc3d788f disable annoying privacy invasion, fight the Überwachungsstaat 2007-09-03 09:25:05 +00:00
tg b9da9d4ea3 if the shell doesn't know the cwd, “builtin pwd” won't either 2007-07-26 13:37:21 +00:00
tg 3a563948ec accomodate stupid Slackware 11 (if you're a slack user, pity you) 2007-06-20 13:38:18 +00:00
tg a7ce246a37 if invoked as /bin/sh, -sh, sh.static, whatever, activate FPOSIX
this should help inferiour operating systems like Debian… (where
some of the devs, hi waldi@, don't consider stop() { } invalid…)
2007-06-15 22:00:00 +00:00
tg c54a614574 useful alias for embedded ones, speedup for all 2007-05-25 13:51:42 +00:00
tg 9e44be4713 oops, can't use single quotes inside of singly quoted string, of course… 2007-05-19 16:35:02 +00:00
tg 9e21d616bd • whence -p can take closing fd 2 instead of pointing it to /dev/null
• hostname and id should too, besides it's mostly for the shell error
  message of not finding them anyway…
• shorten
2007-05-19 16:33:10 +00:00
tg dc71f9b775 • remove an unneeded pair of double quotes
• convert another pair of 'em to “…”
2007-04-17 20:07:09 +00:00
tg b2d0d57468 change our coding style for shell:
we already do not 'function\nfoo\n{' for shell, like style(9) requires for
C programming, but 'function foo\n{' instead. however, we could treat the
function keyword as indentation initialiser and use 'function foo {' (on a
line for itself) – it looks different, unusual, but acceptable, and mksh's
own output (dumping with the “functions” builtin) does that too (although,
its indentation style sucks, but is legible enough)
2007-04-17 20:04:08 +00:00
tg 9cbff5af67 escape the quoting hell, use a function
tested on Interix
2007-04-17 20:00:37 +00:00
tg c79cacdfa5 • from a MirOS point of view:
place most stuff from /etc/profile in /etc/skel/.mkshrc; admins must make
  sure to copy this file to users' homes on upgrade (benefit: non-login but
  interactive shells also get all the goodies); fix some quoting; simplify,
  reformat, change comments
• from an mksh point of view:
  slight internal changes in dot.mkshrc; external commands are now prefixed
  with “ulimit -c 0”; $TERM is defined; improvement in determining the host
  name (e.g. on Debian if a FQDN is not given); declare locals as such both
  in $PS1 and outside; remove superfluous quoting, quote properly; simplify
  hd alias, add rot13 alias; place RCS ID at the bottom
2007-04-16 18:54:37 +00:00
tg 2edb96e663 add a 'true' at the end, to not start with an errorlevel >0 2007-03-04 06:20:48 +00:00