Commit Graph

44 Commits

Author SHA1 Message Date
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
tg 83c2ee87f4 • remove strcasestr.c, use home-grown implementation¹, call it stricmp,
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
  that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
  only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
  to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version

¹) side effect from creating API-correct cstrchr, cstrstr, etc.
   uses goto so it must be better ☻

tested on mirbsd-current via both Makefile and Build.sh
2007-03-04 03:04:28 +00:00
tg 6661a2b408 optimise away, this had not let me sleep; still the same output
shell quoting mystery ;)
2007-02-17 06:34:46 +00:00
tg 26adf9d62d fix superfluous spaces appearing twice at the line continuation
points and expanding to larger than 80c, major oops, cought on fwrt
2007-02-17 06:04:48 +00:00
tg 8a59ee0311 * mention additions go at the bottom (e.g. 'source' scripts), in case
they fail (due to nonexistence), so that the rest is still executed
* export $MKSH (users can set SHELL=$MKSH here, but I'm conservative)
2007-01-04 23:40:50 +00:00
tg 30f6ebb2a3 * add the 'hd' alias for hexdump from etc_profile
* optimise
2006-08-28 01:34:47 +00:00
tg 1c9a925139 rewrite stripcom/Lstripcom function, making use of the 'last command
of a pipeline is executed in a subshell' trick, don't use co-process
(because that's verbose twice in an interactive shell profile), move
the noglob block into the while and rid the redundant +o and local.
2006-08-14 20:32:44 +00:00
tg f1e8f970c4 * get dot.mkshrc sample from Debian mksh-27.4-2
* sync dot.mkshrc sample with FreeWRT r383
* add some stuff from src/etc/profile and contrib/samples/etc_profile
* sync the latter two with reality and shorten
* teach the user in the mksh installation instructions to install the sample

NB: the sample is also covered by the MirOS licence
2006-07-23 18:44:22 +00:00