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

/etc/profile: prevent memory leak, 64M data max
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 26 13:50:52 2008 +0000 (2008-07-26)
parents 9fffc4211cd4
children 714fc8b16dbd
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
21 # Screen display for X and encoding for GTK+ apps.
22 #
23 [ -n "$DISPLAY" ] || DISPLAY=:0.0
24 G_FILENAME_ENCODING=iso8859-1
26 # ldd fake
27 #
28 which ldd > /dev/null || alias ldd='/lib/ld*.so --list'
30 # man fake
31 #
32 if [ ! -x /usr/bin/man ]; then
34 man()
35 {
36 local i
37 local SECTION
38 local MSG
39 local TOPIC
40 local MAN_SECTION
41 case "$1" in
42 ''|-*)
43 cat <<EOT
44 Usage: man [section] command
45 EOT
46 return;;
47 esac
48 SECTION=all
49 MAN_SECTION='*'
50 MSG=""
51 if [ -n "$2" ]; then
52 SECTION=$1
53 MAN_SECTION=$1
54 MSG=" in section $SECTION"
55 shift
56 fi
57 TOPIC=$1
58 if [ -x /usr/bin/retawq -a -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then
59 retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M
60 return
61 fi
62 for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do
63 if [ -f $i/raw-$TOPIC.* ]; then
64 i=$(ls $i/raw-$TOPIC.*)
65 case "$i" in
66 *gz) (zcat $i || unlzma -c $i 2> /dev/null) | less -M;;
67 *) less -M $i;;
68 esac
69 return
70 fi
71 if [ -x /usr/bin/retawq -a -f $i/$TOPIC.html ]; then
72 retawq --dump=file://$i/$TOPIC.html | less -M
73 return
74 fi
75 done
76 (wget -O - "http://mirror.slitaz.org/man/$SECTION/$TOPIC.html" || \
77 wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION") 2> /dev/null | \
78 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\" }" | \
79 sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M
80 }
82 fi
85 # Export all variables defined above and set mask.
86 #
87 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
88 umask 022
90 # Locale and timezone settings.
91 #
92 if [ -s "/etc/locale.conf" ]; then
93 . /etc/locale.conf
94 export LANG LC_ALL
95 fi
96 if [ -s "/etc/TZ" ]; then
97 TZ=`cat /etc/TZ`
98 export TZ
99 fi