Commit Graph

23 Commits

Author SHA1 Message Date
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