2009-08-27 18:52:12 +02:00
|
|
|
# $Id$
|
2011-12-31 02:07:19 +01:00
|
|
|
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.69 2011/12/31 01:07:19 tg Exp $
|
2009-05-16 18:59:42 +02:00
|
|
|
#-
|
2011-02-02 23:48:15 +01:00
|
|
|
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011
|
2009-05-16 18:59:42 +02:00
|
|
|
# Thorsten Glaser <tg@mirbsd.org>
|
|
|
|
#
|
|
|
|
# Provided that these terms and disclaimer and all copyright notices
|
|
|
|
# are retained or reproduced in an accompanying document, permission
|
|
|
|
# is granted to deal in this work without restriction, including un-
|
|
|
|
# limited rights to use, publicly perform, distribute, sell, modify,
|
|
|
|
# merge, give away, or sublicence.
|
|
|
|
#
|
|
|
|
# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
|
|
|
# the utmost extent permitted by applicable law, neither express nor
|
|
|
|
# implied; without malicious intent or gross negligence. In no event
|
|
|
|
# may a licensor, author or contributor be held liable for indirect,
|
|
|
|
# direct, other damage, loss, or other issues arising in any way out
|
|
|
|
# of dealing in the work, even if advised of the possibility of such
|
|
|
|
# damage or existence of a defect, except proven that it results out
|
|
|
|
# of said person's immediate fault when using the work as intended.
|
2007-09-24 22:30:04 +02:00
|
|
|
#-
|
2010-02-25 21:48:10 +01:00
|
|
|
# ${ENV:-~/.mkshrc}: mksh initialisation file for interactive shells
|
2007-09-24 22:30:04 +02:00
|
|
|
|
2007-05-19 18:33:10 +02:00
|
|
|
: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)}
|
|
|
|
[[ $HOSTNAME = @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-)
|
2008-05-15 17:24:11 +02:00
|
|
|
: ${HOSTNAME:=nil}; if (( USER_ID )); then PS1='$'; else PS1='#'; fi
|
2007-09-24 22:30:04 +02:00
|
|
|
function precmd {
|
2011-07-05 22:19:18 +02:00
|
|
|
local e=$?
|
2007-09-25 17:48:45 +02:00
|
|
|
|
2007-10-25 16:54:00 +02:00
|
|
|
(( e )) && print -n "$e|"
|
2007-09-24 22:30:04 +02:00
|
|
|
}
|
2011-08-27 20:06:52 +02:00
|
|
|
PS1=$'\001\r''$(precmd)${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \?
|
|
|
|
)}@${HOSTNAME%%.*}:$(local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || \
|
|
|
|
d=${d/#$p/~}; local m=${%d} n p=...; (( m > 0 )) || m=${#d}
|
|
|
|
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || \
|
|
|
|
p=; print -nr -- "$p$d") '"$PS1 "
|
2010-11-26 22:08:54 +01:00
|
|
|
: ${MKSH:=$(whence -p mksh)}; export EDITOR HOSTNAME MKSH TERM USER
|
2008-04-11 22:14:02 +02:00
|
|
|
alias ls=ls
|
|
|
|
unalias ls
|
|
|
|
alias l='ls -F'
|
2006-07-23 20:44:22 +02:00
|
|
|
alias la='l -a'
|
|
|
|
alias ll='l -l'
|
2008-03-03 19:44:32 +01:00
|
|
|
alias lo='l -alo'
|
2008-02-29 17:38:41 +01:00
|
|
|
whence -p rot13 >&- || alias rot13='tr \
|
|
|
|
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \
|
|
|
|
nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
|
2007-05-19 18:33:10 +02:00
|
|
|
whence -p hd >&- || function hd {
|
2007-04-17 22:00:37 +02:00
|
|
|
hexdump -e '"%08.8_ax " 8/1 "%02X " " - " 8/1 "%02X "' \
|
|
|
|
-e '" |" "%_p"' -e '"|\n"' "$@"
|
|
|
|
}
|
2006-07-23 20:44:22 +02:00
|
|
|
|
2007-09-24 22:30:04 +02:00
|
|
|
# Berkeley C shell compatible dirs, popd, and pushd functions
|
|
|
|
# Z shell compatible chpwd() hook, used to update DIRSTACK[0]
|
2008-05-17 20:27:57 +02:00
|
|
|
DIRSTACKBASE=$(realpath ~/. 2>&- || print -nr -- "$HOME")
|
2007-09-24 22:30:04 +02:00
|
|
|
set -A DIRSTACK
|
|
|
|
function chpwd {
|
2008-05-17 20:27:57 +02:00
|
|
|
DIRSTACK[0]=$(realpath . 2>&- || print -r -- "$PWD")
|
2008-05-17 00:22:11 +02:00
|
|
|
[[ $DIRSTACKBASE = ?(*/) ]] || \
|
2008-05-17 00:19:11 +02:00
|
|
|
DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
|
2007-09-24 22:30:04 +02:00
|
|
|
:
|
|
|
|
}
|
|
|
|
chpwd .
|
|
|
|
function cd {
|
|
|
|
builtin cd "$@"
|
|
|
|
chpwd "$@"
|
|
|
|
}
|
|
|
|
function cd_csh {
|
2011-07-05 22:19:18 +02:00
|
|
|
local d t=${1/#~/$DIRSTACKBASE}
|
2007-09-24 22:30:04 +02:00
|
|
|
|
|
|
|
if ! d=$(builtin cd "$t" 2>&1); then
|
|
|
|
print -u2 "${1}: ${d##*$t - }."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
cd "$t"
|
|
|
|
}
|
|
|
|
function dirs {
|
2011-07-05 22:19:18 +02:00
|
|
|
local d dwidth
|
2011-11-26 00:54:06 +01:00
|
|
|
local -i fl=0 fv=0 fn=0 cpos=0
|
2007-09-24 22:30:04 +02:00
|
|
|
|
|
|
|
while getopts ":lvn" d; do
|
|
|
|
case $d {
|
|
|
|
(l) fl=1 ;;
|
|
|
|
(v) fv=1 ;;
|
|
|
|
(n) fn=1 ;;
|
|
|
|
(*) print -u2 'Usage: dirs [-lvn].'
|
|
|
|
return 1 ;;
|
|
|
|
}
|
|
|
|
done
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
if (( $# > 0 )); then
|
|
|
|
print -u2 'Usage: dirs [-lvn].'
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if (( fv )); then
|
|
|
|
fv=0
|
|
|
|
while (( fv < ${#DIRSTACK[*]} )); do
|
|
|
|
d=${DIRSTACK[fv]}
|
2008-03-01 22:24:58 +01:00
|
|
|
(( fl )) && d=${d/#~/$DIRSTACKBASE}
|
2007-09-24 22:30:04 +02:00
|
|
|
print -r -- "$fv $d"
|
|
|
|
let fv++
|
|
|
|
done
|
|
|
|
else
|
|
|
|
fv=0
|
|
|
|
while (( fv < ${#DIRSTACK[*]} )); do
|
|
|
|
d=${DIRSTACK[fv]}
|
2008-03-01 22:24:58 +01:00
|
|
|
(( fl )) && d=${d/#~/$DIRSTACKBASE}
|
2010-07-11 15:54:37 +02:00
|
|
|
(( dwidth = (${%d} > 0 ? ${%d} : ${#d}) ))
|
|
|
|
if (( fn && (cpos += dwidth + 1) >= 79 && \
|
|
|
|
dwidth < 80 )); then
|
2007-09-24 22:30:04 +02:00
|
|
|
print
|
2010-07-11 15:54:37 +02:00
|
|
|
(( cpos = dwidth + 1 ))
|
2007-09-24 22:30:04 +02:00
|
|
|
fi
|
|
|
|
print -nr -- "$d "
|
|
|
|
let fv++
|
|
|
|
done
|
|
|
|
print
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
function popd {
|
2011-07-05 22:19:18 +02:00
|
|
|
local d fa
|
2011-11-26 00:54:06 +01:00
|
|
|
local -i n=1
|
2007-09-24 22:30:04 +02:00
|
|
|
|
|
|
|
while getopts ":0123456789lvn" d; do
|
|
|
|
case $d {
|
2011-11-26 00:58:04 +01:00
|
|
|
(l|v|n) fa+=" -$d" ;;
|
2007-09-24 22:30:04 +02:00
|
|
|
(+*) n=2
|
|
|
|
break ;;
|
|
|
|
(*) print -u2 'Usage: popd [-lvn] [+<n>].'
|
|
|
|
return 1 ;;
|
|
|
|
}
|
|
|
|
done
|
|
|
|
shift $((OPTIND - n))
|
|
|
|
n=0
|
|
|
|
if (( $# > 1 )); then
|
|
|
|
print -u2 popd: Too many arguments.
|
|
|
|
return 1
|
|
|
|
elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then
|
|
|
|
if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then
|
|
|
|
print -u2 popd: Directory stack not that deep.
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
elif [[ -n $1 ]]; then
|
|
|
|
print -u2 popd: Bad directory.
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if (( ${#DIRSTACK[*]} < 2 )); then
|
|
|
|
print -u2 popd: Directory stack empty.
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
unset DIRSTACK[n]
|
|
|
|
set -A DIRSTACK -- "${DIRSTACK[@]}"
|
|
|
|
cd_csh "${DIRSTACK[0]}" || return 1
|
|
|
|
dirs $fa
|
|
|
|
}
|
|
|
|
function pushd {
|
2011-07-05 22:19:18 +02:00
|
|
|
local d fa
|
2011-11-26 00:54:06 +01:00
|
|
|
local -i n=1
|
2007-09-24 22:30:04 +02:00
|
|
|
|
|
|
|
while getopts ":0123456789lvn" d; do
|
|
|
|
case $d {
|
2011-11-26 00:58:04 +01:00
|
|
|
(l|v|n) fa+=" -$d" ;;
|
2007-09-24 22:30:04 +02:00
|
|
|
(+*) n=2
|
|
|
|
break ;;
|
|
|
|
(*) print -u2 'Usage: pushd [-lvn] [<dir>|+<n>].'
|
|
|
|
return 1 ;;
|
|
|
|
}
|
|
|
|
done
|
|
|
|
shift $((OPTIND - n))
|
|
|
|
if (( $# == 0 )); then
|
|
|
|
if (( ${#DIRSTACK[*]} < 2 )); then
|
|
|
|
print -u2 pushd: No other directory.
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
d=${DIRSTACK[1]}
|
|
|
|
DIRSTACK[1]=${DIRSTACK[0]}
|
|
|
|
cd_csh "$d" || return 1
|
|
|
|
elif (( $# > 1 )); then
|
|
|
|
print -u2 pushd: Too many arguments.
|
|
|
|
return 1
|
|
|
|
elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then
|
|
|
|
if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then
|
|
|
|
print -u2 pushd: Directory stack not that deep.
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
while (( n-- )); do
|
|
|
|
d=${DIRSTACK[0]}
|
|
|
|
unset DIRSTACK[0]
|
|
|
|
set -A DIRSTACK -- "${DIRSTACK[@]}" "$d"
|
|
|
|
done
|
|
|
|
cd_csh "${DIRSTACK[0]}" || return 1
|
|
|
|
else
|
|
|
|
set -A DIRSTACK -- placeholder "${DIRSTACK[@]}"
|
|
|
|
cd_csh "$1" || return 1
|
|
|
|
fi
|
|
|
|
dirs $fa
|
|
|
|
}
|
|
|
|
|
2011-02-09 20:32:35 +01:00
|
|
|
# pager (not control character safe)
|
|
|
|
function smores {
|
2011-07-05 22:19:18 +02:00
|
|
|
local dummy line llen curlin=0
|
2011-02-09 20:32:35 +01:00
|
|
|
|
|
|
|
cat "$@" | while IFS= read -r line; do
|
|
|
|
llen=${%line}
|
|
|
|
(( llen == -1 )) && llen=${#line}
|
|
|
|
(( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
|
|
|
|
if (( (curlin += llen) >= LINES )); then
|
|
|
|
print -n -- '\033[7m--more--\033[0m'
|
|
|
|
read -u1 dummy
|
|
|
|
[[ $dummy = [Qq]* ]] && return 0
|
|
|
|
curlin=$llen
|
|
|
|
fi
|
|
|
|
print -r -- "$line"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2011-05-29 04:18:57 +02:00
|
|
|
# base64 encoder and decoder, RFC compliant, NUL safe
|
2009-05-31 19:17:33 +02:00
|
|
|
function Lb64decode {
|
2011-07-05 22:19:18 +02:00
|
|
|
[[ -o utf8-mode ]]; local u=$?
|
2009-05-31 19:17:33 +02:00
|
|
|
set +U
|
2011-07-05 22:19:18 +02:00
|
|
|
local c s="$*" t=
|
2009-05-31 19:17:33 +02:00
|
|
|
[[ -n $s ]] || { s=$(cat;print x); s=${s%x}; }
|
2011-11-26 00:58:04 +01:00
|
|
|
local -i i=0 j=0 n=${#s} p=0 v x
|
2011-07-05 22:19:18 +02:00
|
|
|
local -i16 o
|
2009-05-31 19:17:33 +02:00
|
|
|
|
|
|
|
while (( i < n )); do
|
|
|
|
c=${s:(i++):1}
|
|
|
|
case $c {
|
|
|
|
(=) break ;;
|
|
|
|
([A-Z]) (( v = 1#$c - 65 )) ;;
|
|
|
|
([a-z]) (( v = 1#$c - 71 )) ;;
|
|
|
|
([0-9]) (( v = 1#$c + 4 )) ;;
|
|
|
|
(+) v=62 ;;
|
|
|
|
(/) v=63 ;;
|
|
|
|
(*) continue ;;
|
|
|
|
}
|
|
|
|
(( x = (x << 6) | v ))
|
|
|
|
case $((p++)) {
|
|
|
|
(0) continue ;;
|
|
|
|
(1) (( o = (x >> 4) & 255 )) ;;
|
|
|
|
(2) (( o = (x >> 2) & 255 )) ;;
|
|
|
|
(3) (( o = x & 255 ))
|
|
|
|
p=0
|
|
|
|
;;
|
|
|
|
}
|
2011-11-26 00:58:04 +01:00
|
|
|
t+=\\x${o#16#}
|
|
|
|
(( ++j & 4095 )) && continue
|
|
|
|
print -n $t
|
|
|
|
t=
|
2009-05-31 19:17:33 +02:00
|
|
|
done
|
|
|
|
print -n $t
|
2009-12-12 23:27:14 +01:00
|
|
|
(( u )) || set -U
|
2009-05-31 19:17:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
set -A Lb64encode_code -- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
|
|
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + /
|
|
|
|
function Lb64encode {
|
2011-07-05 22:19:18 +02:00
|
|
|
[[ -o utf8-mode ]]; local u=$?
|
2009-05-31 19:17:33 +02:00
|
|
|
set +U
|
2011-07-05 22:19:18 +02:00
|
|
|
local c s t
|
2011-05-29 04:18:57 +02:00
|
|
|
if (( $# )); then
|
|
|
|
read -raN-1 s <<<"$*"
|
|
|
|
unset s[${#s[*]}-1]
|
|
|
|
else
|
|
|
|
read -raN-1 s
|
|
|
|
fi
|
2011-07-05 22:19:18 +02:00
|
|
|
local -i i=0 n=${#s[*]} j v
|
2009-05-31 19:17:33 +02:00
|
|
|
|
|
|
|
while (( i < n )); do
|
2011-05-29 04:18:57 +02:00
|
|
|
(( v = s[i++] << 16 ))
|
|
|
|
(( j = i < n ? s[i++] : 0 ))
|
2009-05-31 19:17:33 +02:00
|
|
|
(( v |= j << 8 ))
|
2011-05-29 04:18:57 +02:00
|
|
|
(( j = i < n ? s[i++] : 0 ))
|
2009-05-31 19:17:33 +02:00
|
|
|
(( v |= j ))
|
2011-11-26 00:58:04 +01:00
|
|
|
t+=${Lb64encode_code[v >> 18]}${Lb64encode_code[v >> 12 & 63]}
|
2009-05-31 19:17:33 +02:00
|
|
|
c=${Lb64encode_code[v >> 6 & 63]}
|
|
|
|
if (( i <= n )); then
|
2011-11-26 00:58:04 +01:00
|
|
|
t+=$c${Lb64encode_code[v & 63]}
|
2009-05-31 19:17:33 +02:00
|
|
|
elif (( i == n + 1 )); then
|
2011-11-26 00:58:04 +01:00
|
|
|
t+=$c=
|
2009-05-31 19:17:33 +02:00
|
|
|
else
|
2011-11-26 00:58:04 +01:00
|
|
|
t+===
|
2009-05-31 19:17:33 +02:00
|
|
|
fi
|
|
|
|
if (( ${#t} == 76 || i >= n )); then
|
|
|
|
print $t
|
|
|
|
t=
|
|
|
|
fi
|
|
|
|
done
|
2009-12-12 23:27:14 +01:00
|
|
|
(( u )) || set -U
|
2009-05-31 19:17:33 +02:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:22:02 +02:00
|
|
|
# mksh NUL counting, never zero
|
|
|
|
typeset -Z11 -Uui16 Lnzathash_v
|
|
|
|
function Lnzathash_add {
|
2011-07-05 22:19:18 +02:00
|
|
|
[[ -o utf8-mode ]]; local u=$?
|
2009-06-22 19:38:39 +02:00
|
|
|
set +U
|
2011-07-05 22:19:18 +02:00
|
|
|
local s
|
2011-05-29 04:18:57 +02:00
|
|
|
if (( $# )); then
|
|
|
|
read -raN-1 s <<<"$*"
|
|
|
|
unset s[${#s[*]}-1]
|
|
|
|
else
|
|
|
|
read -raN-1 s
|
|
|
|
fi
|
2011-07-05 22:19:18 +02:00
|
|
|
local -i i=0 n=${#s[*]}
|
2009-06-22 19:38:39 +02:00
|
|
|
|
|
|
|
while (( i < n )); do
|
2011-07-07 00:22:02 +02:00
|
|
|
((# Lnzathash_v = (Lnzathash_v + s[i++] + 1) * 1025 ))
|
|
|
|
((# Lnzathash_v ^= Lnzathash_v >> 6 ))
|
2009-06-22 19:38:39 +02:00
|
|
|
done
|
|
|
|
|
2009-12-12 23:27:14 +01:00
|
|
|
(( u )) || set -U
|
2009-06-22 19:38:39 +02:00
|
|
|
}
|
2011-07-07 00:22:02 +02:00
|
|
|
function Lnzaathash_end {
|
2011-07-18 02:35:46 +02:00
|
|
|
((# Lnzathash_v *= 1025 ))
|
|
|
|
((# Lnzathash_v ^= Lnzathash_v >> 6 ))
|
2011-07-07 00:22:02 +02:00
|
|
|
((# Lnzathash_v += Lnzathash_v << 3 ))
|
|
|
|
((# Lnzathash_v = (Lnzathash_v ^
|
|
|
|
(Lnzathash_v >> 11)) * 32769 ))
|
|
|
|
print ${Lnzathash_v#16#}
|
2009-06-22 19:38:39 +02:00
|
|
|
}
|
2011-07-07 00:22:02 +02:00
|
|
|
function Lnzaathash {
|
|
|
|
Lnzathash_v=0
|
|
|
|
Lnzathash_add "$@"
|
|
|
|
Lnzaathash_end
|
|
|
|
}
|
|
|
|
function Lnzathash {
|
|
|
|
Lnzathash_v=0
|
|
|
|
Lnzathash_add "$@"
|
2011-12-31 02:07:19 +01:00
|
|
|
Lnzathash_end
|
|
|
|
}
|
|
|
|
function Lnzathash_end {
|
2011-07-07 00:22:02 +02:00
|
|
|
if (( Lnzathash_v )); then
|
|
|
|
Lnzaathash_end
|
2011-05-29 04:18:57 +02:00
|
|
|
else
|
2011-07-07 00:22:02 +02:00
|
|
|
Lnzathash_v=1
|
|
|
|
print ${Lnzathash_v#16#}
|
2011-05-29 04:18:57 +02:00
|
|
|
fi
|
2010-01-25 15:29:34 +01:00
|
|
|
}
|
2009-08-27 18:29:21 +02:00
|
|
|
|
2006-08-14 22:32:44 +02:00
|
|
|
# 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
|
2007-04-17 22:04:08 +02:00
|
|
|
function Lstripcom {
|
• 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 04:04:28 +01:00
|
|
|
cat "$@" | { set -o noglob; while read _line; do
|
2006-07-23 20:44:22 +02:00
|
|
|
_line=${_line%%#*}
|
|
|
|
[[ -n $_line ]] && print -r -- $_line
|
• 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 04:04:28 +01:00
|
|
|
done; }
|
2006-07-23 20:44:22 +02:00
|
|
|
}
|
2007-03-04 07:20:48 +01:00
|
|
|
|
2011-07-04 01:26:47 +02:00
|
|
|
# give MidnightBSD's laffer1 a bit of csh feeling
|
|
|
|
function setenv {
|
|
|
|
eval export $1'="$2"'
|
|
|
|
}
|
|
|
|
|
2010-07-04 19:35:16 +02:00
|
|
|
: place customisations below this line
|
2009-11-03 18:58:44 +01:00
|
|
|
|
|
|
|
for p in ~/.etc/bin ~/bin; do
|
|
|
|
[[ -d $p/. ]] || continue
|
|
|
|
[[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
|
|
|
|
done
|
|
|
|
|
|
|
|
export SHELL=$MKSH MANWIDTH=80 LESSHISTFILE=-
|
|
|
|
alias cls='print -n \\033c'
|
|
|
|
|
|
|
|
#unset LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_IDENTIFICATION LC_MONETARY \
|
|
|
|
# LC_NAME LC_NUMERIC LC_TELEPHONE LC_TIME
|
|
|
|
#p=en_GB.UTF-8
|
2011-02-02 23:48:15 +01:00
|
|
|
#set -U
|
2009-11-03 18:58:44 +01:00
|
|
|
#export LANG=C LC_CTYPE=$p LC_MEASUREMENT=$p LC_MESSAGES=$p LC_PAPER=$p
|
|
|
|
|
|
|
|
unset p
|
|
|
|
|
2010-07-04 19:35:16 +02:00
|
|
|
: place customisations above this line
|