-alias ll="ls -lAFho"
-local p="ps -aSdxwwouser=USR -ogroup=GRP -opid,nice=N \
- -o%cpu,%mem,tt,stat,start=START -oetime,command | ${PAGER:-more} -Se"
+alias e="${EDITOR:-vi}" # TODO: make sure vi is there or use safe default
+if [[ "$OSTYPE" =~ '^(free|net)bsd' ]] {
+ alias ll="ls -lAFho"
+} else {
+ alias ll="ls -lAFh"
+}
+## ps
+local p=
+if which pstree >/dev/null 2>&1 && ! check-busybox pstree; then
+ # use pstree, but NOT busybox pstree because it kinda sucks
+ p="pstree -wg3"
+elif [[ "$OSTYPE" =~ '^freebsd' ]]; then
+ p="ps -aSdfxwwouser=USR -ogroup=GRP -opid,nice=NI \
+ -o%cpu,%mem,tty,stat,start=START -oetime,command"
+elif check-busybox ps; then
+ # busybox compatible
+ p="ps -eouser='USR ' -ogroup='GRP ' \
+ -opid=' PID' -onice=' NI' -ovsz=' MEM' \
+ -otty,stat,etime,comm"
+else
+ # XXX: untested, posix
+ # TODO: support gnu ps
+ p="ps -eouser=USR -ogroup=GRP -opid,nice=NI \
+ -opcpu=CPU -ovsz=MEM -otty,stat,etime,comm"
+fi
+if [[ "$(basename "$PAGER")" = "less" ]] {
+ p="$p | less -SE"
+} else {
+ p="$p | \"${PAGER:-more}\""
+}