# env
# Written in 2019-2023 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.

EDITOR=ed
PAGER=less
VISUAL=ed
export EDITOR PAGER VISUAL

GPG_TTY=$(tty)
export GPG_TTY

SEKRIT_GPG_ID=sekrit_key
export SEKRIT_GPG_ID

alias cp="cp -i"
alias l="ls -F"
alias la="ls -aF"
alias ll="ls -lF"
alias mv="mv -i"
alias p="$PAGER"

if command -v nvi >/dev/null; then
	alias vi=nvi
fi

if [ -d ~/local/man ] && [ -x /usr/bin/man ]; then
	alias man="/usr/bin/man -m ~/local/man"
fi

if [ -d ~/local/libdata/perl5/site_perl ]; then
	PERL5LIB=~/local/libdata/perl5/site_perl
	export PERL5LIB
fi

if [ -x /sbin/sysctl ] && /sbin/sysctl -n hw.ncpuonline >/dev/null 2>&1; then
	alias ncpu="/sbin/sysctl -n hw.ncpuonline"
fi

PS1=

case $SHELL in
/bin/mksh)
	PS1=$PS1'${HOSTNAME:=$(hostname -s)}\$ '
	;;
*)
	PS1=$PS1'\h\$ '
	;;
esac
export PS1

case $(uname -s) in
OpenBSD)
	# Seems it's just set in /etc/rc and isn't inherited by the shell.
	stty status "^T"
	;;
Linux)
	stty erase "^?"
	;;
esac

if command -v nncp-call >/dev/null; then
	NNCPCFG=~/.config/nncp
	export NNCPCFG
fi

if command -v calendar >/dev/null && [ -f ~/.calendar/calendar ]; then
	calendar
fi

if [ -r ~/.shrc.local ]; then
	. ~/.shrc.local
fi

set -o emacs
