slitaz-base-files view rootfs/etc/profile @ rev 50

/etc/profile: prevent memory leak for data, stack, memory, vmemory
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 26 16:47:23 2008 +0000 (2008-07-26)
parents 4b9afd78edd7
children 28400795fab8
line source
1 # /etc/profile: system-wide .profile file for the Bourne shells
3 PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
4 LD_LIBRARY_PATH="/usr/lib:/lib"
6 # Prompt format for Ash (Bash use /etc/bashrc).
7 #
8 if [ "`id -u`" -eq 0 ]; then
9 # Light green and blue colored prompt.
10 #PS1='\e[1;31m\u@\h\e[0m:\e[1;34m\w\e[0m\# '
11 PS1='\u@\h:\w\# '
12 else
13 # Light green and blue colored prompt.
14 PS1='\e[1;32m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
15 #PS1='\u@\h:\w\$ '
16 fi
18 # Max 64M for programs (prevent memory leak crashs)
19 ulimit -d 65536
20 ulimit -s 65536
21 ulimit -m 65536
22 ulimit -v 65536
24 # Screen display for X and encoding for GTK+ apps.
25 #
26 [ -n "$DISPLAY" ] || DISPLAY=:0.0
27 G_FILENAME_ENCODING=iso8859-1
29 # ldd fake
30 #
31 which ldd > /dev/null || alias ldd='/lib/ld*.so --list'
33 # man fake
34 #
35 if [ ! -x /usr/bin/man ]; then
37 man()
38 {
39 local i
40 local SECTION
41 local MSG
42 local TOPIC
43 local MAN_SECTION
44 case "$1" in
45 ''|-*)
46 cat <<EOT
47 Usage: man [section] command
48 EOT
49 return;;
50 esac
51 SECTION=all
52 MAN_SECTION='*'
53 MSG=""
54 if [ -n "$2" ]; then
55 SECTION=$1
56 MAN_SECTION=$1
57 MSG=" in section $SECTION"
58 shift
59 fi
60 TOPIC=$1
61 if [ -x /usr/bin/retawq -a -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then
62 retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M
63 return
64 fi
65 for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do
66 if [ -f $i/raw-$TOPIC.* ]; then
67 i=$(ls $i/raw-$TOPIC.*)
68 case "$i" in
69 *gz) (zcat $i || unlzma -c $i 2> /dev/null) | less -M;;
70 *) less -M $i;;
71 esac
72 return
73 fi
74 if [ -x /usr/bin/retawq -a -f $i/$TOPIC.html ]; then
75 retawq --dump=file://$i/$TOPIC.html | less -M
76 return
77 fi
78 done
79 (wget -O - "http://mirror.slitaz.org/man/$SECTION/$TOPIC.html" || \
80 wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION") 2> /dev/null | \
81 awk "BEGIN { s=0; n=0 } /<PRE>/ { s=1 } { if (s) { print; n++} } /<\/PRE>/ { s=0 } END { if (n == 0) print \"No manual entry for $TOPIC$MSG\" }" | \
82 sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M
83 }
85 fi
88 # Export all variables defined above and set mask.
89 #
90 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
91 umask 022
93 # Locale and timezone settings.
94 #
95 if [ -s "/etc/locale.conf" ]; then
96 . /etc/locale.conf
97 export LANG LC_ALL
98 fi
99 if [ -s "/etc/TZ" ]; then
100 TZ=`cat /etc/TZ`
101 export TZ
102 fi