diff --git a/Makefile b/Makefile index 61c3196..d6ed849 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.35 2007/03/04 04:36:45 tg Exp $ +# $MirOS: src/bin/mksh/Makefile,v 1.36 2007/04/16 18:54:37 tg Exp $ #- # use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff @@ -48,4 +48,8 @@ cleandir: clean-extra clean-extra: .PHONY -rm -rf build-dir regress-dir +distribution: + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${CONFGRP} -m 0644 \ + ${.CURDIR}/dot.mkshrc ${DESTDIR}/etc/skel/.mkshrc + .include diff --git a/dot.mkshrc b/dot.mkshrc index d959b7d..52fea24 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,30 +1,34 @@ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.8 2007/03/04 06:20:48 tg Exp $ - -: ${EDITOR:=/bin/ed} ${HOSTNAME:=$(hostname -s 2>/dev/null || hostname)} -PS1='$(((rv=$?)) && print $rv\|)${USER:=$(id -un)}@${HOSTNAME:=nil}:$( - local pfx=~ wd=${PWD:-$(pwd)} +: ${EDITOR:=/bin/ed} ${TERM:=vt100} +[[ ${HOSTNAME:=$(ulimit -c 0; hostname -s 2>/dev/null)} = \ + @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0; hostname 2>/dev/null) +if [[ $(ulimit -c 0; id -u 2>/dev/null) -eq 0 ]]; then + PS1='# ' +else + PS1='$ ' +fi; PS1='$(integer rv=$?; ((rv)) && print -n $rv\|)${USER:=$(ulimit -c 0; \ + id -un 2>/dev/null || print -n nobody)}@${HOSTNAME:=nil}:$( + local pfx=~ wd=${PWD:-$(builtin pwd)}; integer n=${COLUMNS:-80}/3 [[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx} - pfx=; let n="( (n = ${COLUMNS:-80} / 3) < 7 ? 7 : n)" + pfx=; let n="n < 7 ? 7 : n" while (( (${#pfx} + ${#wd}) > n )); do if [[ $wd = */* ]]; then pfx=.../ - wd="${wd#*/}" + wd=${wd#*/} else pfx=... - wd="${wd#?????}" + wd=${wd#?????} fi done - print -r -- "$pfx$wd")'" $(if (( $(id -u) )); then - print \$; else print \#; fi) " -export EDITOR HOSTNAME MKSH=$(whence -p mksh) PS1 USER + print -nr -- "$pfx$wd") '$PS1 +export EDITOR HOSTNAME MKSH="$(whence -p mksh)" PS1 TERM USER alias l='/bin/ls -F' alias la='l -a' alias ll='l -l' alias lo='la -lo' -[ -x /usr/bin/hd ] || eval alias hd="'hexdump -e '\\''\"%08.8_ax \" 8/1" \ - '"%02X " " - " 8/1 "%02X "'"'\\'' -e '\\''"'" |" "%_p"'"'\\''" \ - "-e '\\''"'"|\n"'"'\\'' '" +whence -p rot13 >/dev/null || alias rot13='tr [A-Za-z] [N-ZA-Mn-za-m]' +whence -p hd >/dev/null || alias hd="hexdump -e '"'"%08.8_ax " 8/1 '\ +'"%02X " " - " 8/1 "%02X "'"' -e '\" |\" \"%_p\"' -e '\"|\\n\"'" # strip comments (and leading/trailing whitespace if IFS is set) from # any file(s) given as argument, or stdin if none, and spew to stdout @@ -36,6 +40,6 @@ function Lstripcom done; } } -# Your shell code goes below! +# place customisations between this line and the ": RCSID" line below -: Your shell code goes above! +: $MirOS: src/bin/mksh/dot.mkshrc,v 1.9 2007/04/16 18:54:37 tg Exp $