Merge branch 'master' of vampire:etc/profile
[profile] / dot / rcrc
1 ### rc profile
2
3 ###--------------------------------------------------------------------------
4 ### Prompt machinery.
5
6 host = `hostname
7
8 if (~ $TERM linux* screen* xterm* vt100* eterm*) {
9 bold = `{tput bold} unbold = `{tput sgr0}
10 } else {
11 bold = '' unbold = ''
12 }
13
14 if (~ `{id -u} 0) {
15 left = `{iconv -f utf8 -t //translit <<< «}
16 right = `{iconv -f utf8 -t //translit <<< »}
17 } else {
18 u = `{id -un}
19 if (~ $u mdw mwooding) {
20 u = '' left = '[' right = ']'
21 } else {
22 u = $u^@ left = '{' right = '}'
23 }
24 if (~ $__mdw_tty `tty) {
25 left = '<' right = '>'
26 } else {
27 __mdw_tty = `tty
28 }
29 }
30
31 if (~ $#SSH_CLIENT 0 && ! ~ $__mdw_sechost $host) {
32 sec_l = '(' sec_r = ')'
33 }
34
35 fn prompt {
36 cwd = `pwd
37 if (~ $cwd $home $home/*) {
38 cwd = `{sed 's:^' ^ $home ^':~:' <<< $cwd}
39 }
40 prompt = ($bold$left$sec_l$u$host$sec_r^' '^$cwd$right$unbold '')
41 }