• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Revision96f009c218ff8aa9c63ce2d95c740b839a7af3f2 (tree)
Zeit2011-06-20 04:08:48
AutorThorsten Glaser <tg@mirb...>
CommiterThorsten Glaser

Log Message

update mkshrc in sync with upstream dot.mkshrc sample file

• add a pager, called “more” here (“smores” upstream)

especially useful since AOSP has neither cat nor a pager

• no longer export PS1 (problem spotted by Frank Terbeck)

Change-Id: I69491de5ba5c9f39497f0736bd76abb113ba29d1

Ändern Zusammenfassung

Diff

--- a/mksh/mkshrc
+++ b/mksh/mkshrc
@@ -1,4 +1,4 @@
1-# Copyright (c) 2010
1+# Copyright (c) 2010, 2011
22 # Thorsten Glaser <t.glaser@tarent.de>
33 # This file is provided under the same terms as mksh.
44 #-
@@ -13,12 +13,29 @@ function precmd {
1313 (( e )) && print -n "$e|"
1414 }
1515 PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
16-export HOME HOSTNAME MKSH PS1 SHELL TERM USER
16+export HOME HOSTNAME MKSH SHELL TERM USER
1717 alias l='ls'
1818 alias la='l -a'
1919 alias ll='l -l'
2020 alias lo='l -a -l'
2121
22+function more {
23+ typeset dummy line llen curlin=0
24+
25+ cat "$@" | while IFS= read -r line; do
26+ llen=${%line}
27+ (( llen == -1 )) && llen=${#line}
28+ (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
29+ if (( (curlin += llen) >= LINES )); then
30+ print -n -- '\033[7m--more--\033[0m'
31+ read -u1 dummy
32+ [[ $dummy = [Qq]* ]] && return 0
33+ curlin=$llen
34+ fi
35+ print -r -- "$line"
36+ done
37+}
38+
2239 for p in ~/.bin; do
2340 [[ -d $p/. ]] || continue
2441 [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH