aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-05-07 16:07:39 +0200
committerMattias Andrée <maandree@operamail.com>2012-05-07 16:07:39 +0200
commit76112f7bc5ea64612c397e7f0aba139517640851 (patch)
tree4a30d08b70d6b68a6da00fa6371cf90d75a7c842 /ponysay
parente71522c0b83196c449c87c7ce5bc52a543d86fb4 (diff)
downloadponysay-76112f7bc5ea64612c397e7f0aba139517640851.tar.gz
ponysay-76112f7bc5ea64612c397e7f0aba139517640851.tar.bz2
ponysay-76112f7bc5ea64612c397e7f0aba139517640851.zip
TTY support!!
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay11
1 files changed, 10 insertions, 1 deletions
diff --git a/ponysay b/ponysay
index 6febfdb..bb4d269 100755
--- a/ponysay
+++ b/ponysay
@@ -6,6 +6,11 @@ HOMEPONIES="${HOME}/.ponies"
pony="*"
wrap=
+if [ "$TERM" = "linux" ]; then
+ SYSTEMPONIES=/usr/share/ttyponies
+ HOMEPONIES="${HOME}/.ttyponies"
+fi
+
cmd=cowsay
[[ ${0} == *ponythink ]] && cmd=cowthink
@@ -43,7 +48,11 @@ EOF
say() {
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
export PERL_UNICODE=S
-
+
+ if [ "$TERM" = "linux" ]; then
+ echo -ne '\ec'
+ fi
+
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | (ponysaytruncater `tput cols || echo 0` 2>/dev/null || ./ponysaytruncater `tput cols || echo 0` 2>/dev/null || cat)
}