OSDN Git Service

Apparently not all our toolchains have -fstack-protector-strong yet.
[android-x86/external-mksh.git] / mkshrc
1 # Copyright (c) 2010, 2012, 2013, 2014
2 #       Thorsten Glaser <tg@mirbsd.org>
3 # This file is provided under the same terms as mksh.
4 #-
5 # Minimal /system/etc/mkshrc for Android
6 #
7 # Support: https://launchpad.net/mksh
8
9 : ${HOME:=/data}
10 : ${HOSTNAME:=$(getprop ro.product.device)}
11 : ${HOSTNAME:=android}
12 : ${MKSH:=/system/bin/sh}
13 : ${SHELL:=$MKSH}
14 : ${TERM:=xterm}
15 : ${TMPDIR:=/data/local/tmp}
16 : ${USER:=$(id -un)}
17 export HOME HOSTNAME MKSH SHELL TERM TMPDIR USER
18
19 if (( USER_ID )); then PS1='$'; else PS1='#'; fi
20 PS4='[$EPOCHREALTIME] '; PS1='${|
21         local e=$?
22
23         (( e )) && REPLY+="$e|"
24
25         return $e
26 }$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
27
28 function hd {
29         local -Uui16 -Z11 pos=0
30         local -Uui16 -Z5 hv=2147483647
31         local dasc line i
32
33         cat "$@" | { set +U; if read -arN -1 line; then
34                 typeset -i1 'line[*]'
35                 i=0
36                 while (( i < ${#line[*]} )); do
37                         hv=${line[i++]}
38                         if (( (pos & 15) == 0 )); then
39                                 (( pos )) && print -r -- "$dasc|"
40                                 print -n "${pos#16#}  "
41                                 dasc=' |'
42                         fi
43                         print -n "${hv#16#} "
44                         if (( (hv < 32) || (hv > 126) )); then
45                                 dasc+=.
46                         else
47                                 dasc+=${line[i-1]#1#}
48                         fi
49                         (( (pos++ & 15) == 7 )) && print -n -- '- '
50                 done
51                 while (( pos & 15 )); do
52                         print -n '   '
53                         (( (pos++ & 15) == 7 )) && print -n -- '- '
54                 done
55                 (( hv == 2147483647 )) || print -r -- "$dasc|"
56         fi; }
57 }
58
59 function setenv {
60         eval export "\"$1\""'="$2"'
61 }
62
63 for p in ~/bin; do
64         [[ -d $p/. ]] || continue
65         [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
66 done
67
68 unset p
69
70 : place customisations above this line