: $h/.@OBN@rc - " Modify to taste. "
:
: "  The author of this file, J.A. Neitzel <jan (at) etsh (dot) io>,  "
: "  hereby grants it to the public domain.                           "
:
: "  From:  https://etsh.io/rc_files  "
:

: fd2 -e echo "debug: Executing `"$h/.@OBN@rc"' now..."

:
: " Make getopt(3) in the fd2 utility behave the same on  "
: " GNU/Linux systems as it does on *BSD & other systems. "
:
: setenv	POSIXLY_CORRECT	''

setenv	EDITOR		/usr/local/bin/vim
setenv	VISUAL		/usr/local/bin/vim
setenv	PAGER		'less -is'
setenv	LESS		-M
setenv	EXECSHELL	@BINDIR@/@OBN@
setenv	LC_ALL		C

printenv TERM | grep '^vt220$' >/dev/null
if $? -eq 0 goto Continue
    printenv TERM | grep '^vt100$' >/dev/null
    if $? = 0 goto Continue

	: " Set LC_ALL and so forth according to LANG. "
	unset L
	printenv LANG | grep '^es_MX' >/dev/null
	if $? -eq 0 goto L-Jump
		set L en_US
		goto L-Break
	: L-Jump
		set L es_MX
		: fallthrough
	: L-Break
	: " ready; set LC_ALL and so forth below... "

	:
	: " The terminal I normally use is rxvt-unicode (urxvt),  "
	: " but I also use others on occasion.  Normally, they're "
	: " UTF-8 capable, but that's not always true.            "
	:
	setenv	LC_ALL		$L.UTF-8
	setenv	LESSCHARSET	utf-8
	printf	"%b"		'\033]701;'$L'.UTF-8\007' >/dev/tty
	unset L
	: fallthrough

: Continue - " Continue as normal. "

	source	SetV
	source	SetTandCTTY
	setenv	TTY	$t
	( stty altwerase imaxbel -oxtabs ; stty status '^T' ) <-
	xtitle

	:
	: " Set some useful aliases.                           "
	: " If you want an alias to ignore arguments, doing a: "
	:
	:	alias foo ' echo foo bar baz ; : '
	:
	: " or "
	:
	:	alias foo 'echo foo bar baz;:'
	:
	: " ... "
	: " or similar (for example) is a simple way to do so. "
	: " The terminating ` ; : ' or `;:' (in effect) turns  "
	: " alias arguments into a no-op.                      "
	:
	alias	aliases	'(alias;:)'
	alias	glob	'echo'
	alias	h	history
	alias	hcount	"setenv LC_ALL C;awk '{print \$1;}'<$h/.etsh.history|sort|uniq -c|sort -k1 -rn|head -25;:"
	alias	isset	'set'
	alias	jobs	'fd2 -e echo "@OBN@: not a job-control shell";false'
	alias	lf	'ls -F'
	alias	li	'ls -i'
	alias	ll	'ls -AlF'
	alias	loadavg	"uname -n|sed 's/\([^.]*\).*/\1/'|tr -d \\n;echo -n ': ';uptime|sed 's/^.*user[s,][ ,] *//';:"
	alias	lynx	'setenv LC_ALL C;exec lynx'
	alias	manpath	'echo $m;:'
	printenv TERM | grep '^vt220$' >/dev/null
	if $? -eq 0 goto IsVT220
		alias	n	'echo "日本語 Nihongo";:'
		alias	nihongo	'source nihongo'
		: fallthrough
	: IsVT220
	alias	now	"date '+%A, %Y-%m-%d, %T %Z';:"
	alias	ocpwd	'cd -;pwd;cd -;pwd'
	alias	opwd	'cd -;pwd'
	alias	path	'echo $p;:'
	alias	pparm	'echo $0: $#: $*;:'
	alias	psmem	'ps -Ovsz,rss -m'
	alias	sensors	'sysctl hw.sensors;:'
	alias	tshi	'trap "" 1 2 3 13 14 15 18 21 22;tsh -c xtitle;(trap - 1 2 3 13 14 15;tsh);xtitle;:'
	alias	s	'echo $?;:'
	alias	status	's'
	alias	sysinfo	"echo -n '==== ';uname -n|tr -d \\n;echo ' ====';echo;uname -srm;echo;now;echo;uptime;:"
	alias	topc	'top -C;:'
	alias	unl	'uptime;now;loadavg;:'
	alias	V	'@OBN@ -V ;:'
	alias	VV	'@OBN@ -VV;:'
	( alias logout ) | wc -c | tr -d ' \t' | grep '^0$' >/dev/null
	if $? != 0 goto Jump
		alias	logout	'fd2 -e echo "Not an @OBN@ login shell - Type an EOT (^D) instead";false'
		alias	rmod	'if X$d != X -a -d "$d" -a ! -h "$d" rm -rf "$d";:'
		: fallthrough
	: Jump
		: nothing
