: etsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;;
:
: "  @(#)$Id: SetP,v 1.3 2018/12/15 22:28:21 jneitzel Exp $  "
:
: "  The author of this file, J.A. Neitzel <jan (at) etsh (dot) nl>,  "
: "  hereby grants it to the public domain.                           "
:

:
: "  Set $P to string & append `% ' or `# ' as appropriate for !root or  "
: "  root users, giving in effect, `string% ' or `string# '.  Notice     "
: "  that the specified string can be unspecified or empty.  In such     "
: "  a case, the resulting command prompt will be the same as the        "
: "  shell's default command prompt.  When it's longer than 0 though,    "
: "  this simple script can become quite useful, especially when         "
: "  you combine it with $h/.etsh.prompt as a preprocessor.              "
:
: "  usage: source [/path/to/]SetP [string]  "
: "     or:                                  "
: "  usage: .      [/path/to/]SetP [string]  "
:

if $# -eq 0 -o $# -eq 1 goto OK
	fd2 -e echo 'usage: source [/path/to/]SetP [string]'
	fd2 -e echo '   or:'
	fd2 -e echo 'usage: .      [/path/to/]SetP [string]' ; false ; exit

: OK
	set O "$1"

	if "$k" -eq 0 -a "$u" == root goto Root
		set P "$O% "
		goto Jump
	: Root
		set P "$O# "
		: fallthrough
	: Jump

	unset O
: zero status
