aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Lezaeta <prflr88@gmail.com>2012-07-23 16:33:06 -0400
committerPablo Lezaeta <prflr88@gmail.com>2012-07-23 16:33:06 -0400
commit0097a6134b0d7697a37928633bb5c7cfef0df9ff (patch)
treeded2d7f9fdda22ba077d27339f7c3bf2601d6cb1
parentcc1ff7fa58be547cb0714cba5e78ad72f95bd273 (diff)
parent267dfe92e97f637f15b5860314a73683b046b252 (diff)
downloadponysay-0097a6134b0d7697a37928633bb5c7cfef0df9ff.tar.gz
ponysay-0097a6134b0d7697a37928633bb5c7cfef0df9ff.tar.bz2
ponysay-0097a6134b0d7697a37928633bb5c7cfef0df9ff.zip
Merge remote-tracking branch 'upstream/master'
-rw-r--r--.gitmodules3
-rw-r--r--Makefile21
-rw-r--r--README.md2
m---------ponyquotes4ponysay0
-rwxr-xr-xponysay95
-rwxr-xr-xponysaylinklist.pl72
-rwxr-xr-xponysaylist.pl2
7 files changed, 107 insertions, 88 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..1560352
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "ponyquotes4ponysay"]
+ path = ponyquotes4ponysay
+ url = git://github.com/maandree/ponyquotes4ponysay.git
diff --git a/Makefile b/Makefile
index 490c782..32be888 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,24 @@
-all: ponysaytruncater manpages infomanual ponythinkcompletion
-
+all: ponysaytruncater manpages infomanual ponythinkcompletion submodules
ponysaytruncater:
gcc -o "ponysaytruncater" "ponysaytruncater.c"
-
manpages:
gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz"
gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz"
-
infomanual:
makeinfo "manuals/ponysay.texinfo"
gzip -9 "ponysay.info"
-
ponythinkcompletion:
sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh"
sed -e 's/ponysay/ponythink/g' <"completion/fish-completion.fish" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/fish-completion-think.fish"
sed -e 's/ponysay/ponythink/g' <"completion/zsh-completion.zsh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/zsh-completion-think.zsh"
+submodules:
+ git submodule update
+ (cd "ponyquotes4ponysay/"; make -B)
ttyponies:
mkdir -p ttyponies
@@ -32,7 +31,6 @@ ttyponies:
fi \
done
-
pdfmanual:
texi2pdf "manuals/ponysay.texinfo"
if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi
@@ -46,8 +44,7 @@ pdfmanual:
if [[ -f "ponysay.tp" ]]; then unlink "ponysay.tp" ; fi
if [[ -f "ponysay.vr" ]]; then unlink "ponysay.vr" ; fi
-
-install:
+install: all
mkdir -p "$(DESTDIR)/usr/share/ponysay/"
mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies"
mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies"
@@ -61,6 +58,7 @@ install:
mkdir -p "$(DESTDIR)/usr/lib/ponysay/"
install -s "ponysaytruncater" "$(DESTDIR)/usr/lib/ponysay/truncater"
install "ponysaylist.pl" "$(DESTDIR)/usr/lib/ponysay/list.pl"
+ install "ponysaylinklist.pl" "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/"
install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
@@ -91,6 +89,8 @@ install:
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponythink.info.gz"
+ (cd "ponyquotes4ponysay/"; make DESTDIR="$(DESTDIR)" install)
+
@echo -e '\n\n'\
'/--------------------------------------------------\\\n'\
'| ___ |\n'\
@@ -109,13 +109,13 @@ install:
'\\--------------------------------------------------/'
@echo '' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n'
-
uninstall:
rm -fr "$(DESTDIR)/usr/share/ponysay/ponies"
rm -fr "$(DESTDIR)/usr/share/ponysay/ttyponies"
unlink "$(DESTDIR)/usr/bin/ponysay"
unlink "$(DESTDIR)/usr/bin/ponythink"
unlink "$(DESTDIR)/usr/lib/ponysay/list.pl"
+ unlink "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
unlink "$(DESTDIR)/usr/lib/ponysay/truncater"
unlink "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
@@ -130,7 +130,7 @@ uninstall:
unlink "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz"
unlink "$(DESTDIR)/usr/share/info/ponysay.info.gz"
unlink "$(DESTDIR)/usr/share/info/ponythink.info.gz"
-
+ (cd "ponyquotes4ponysay/"; make DESTDIR="$(DESTDIR)" uninstall)
clean:
rm -f "ponysaytruncater"
@@ -140,3 +140,4 @@ clean:
rm -f "manuals/manpage.6.gz"
rm -f "manuals/manpage.es.6.gz"
rm -f "ponysay.info.gz"
+ (cd "ponyquotes4ponysay/"; make clean)
diff --git a/README.md b/README.md
index c0b33dd..68d6a54 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,8 @@ The package is in the official repositories as `community/ponysay`.
#### Gentoo Linux
There is a package for Gentoo, to make installation and keeping it up to date easy. You can find it in [this overlay](/etu/aidstu-overlay). The package is named `games-misc/ponysay`.
+#### Debian GNU/Linux and Ubuntu
+The DEB file can be found [here](http://roryholland.co.uk/misc.html#ponysay) and the PPA can be found [here](https://launchpad.net/~blazemore/+archive/ponysay).
### Pony fortune on terminal startup
diff --git a/ponyquotes4ponysay b/ponyquotes4ponysay
new file mode 160000
+Subproject 8147d45117b25ae584a789af5630bdf1ff62ef7
diff --git a/ponysay b/ponysay
index 1c7ff4e..b5d823c 100755
--- a/ponysay
+++ b/ponysay
@@ -1,19 +1,23 @@
#!/usr/bin/env bash
version=1.1
-SYSTEMPONIES="/usr/share/ponysay/ponies"
-HOMEPONIES="${HOME}/.local/share/ponysay/ponies"
SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash script directory
pony="*"
wrap=""
+SYSTEMPONIES="$(dirname $SCRIPTDIR)/share/ponysay"
+HOMEPONIES="${HOME}/.local/share/ponysay"
+
kmscmd=""
[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
[[ ! "$kmscmd" = "" ]] && TERM="-linux-"
if [ "$TERM" = "linux" ]; then
- SYSTEMPONIES="/usr/share/ponysay/ttyponies"
- HOMEPONIES="${HOME}/.local/share/ponysay/ttyponies"
+ SYSTEMPONIES="$SYSTEMPONIES/ttyponies"
+ HOMEPONIES="$HOMEPONIES/ttyponies"
+else
+ SYSTEMPONIES="$SYSTEMPONIES/ponies"
+ HOMEPONIES="$HOMEPONIES/ponies"
fi
if [[ "$PONYSAY_COWSAY" = "" ]]; then
@@ -39,7 +43,11 @@ version() {
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
listcmd="${SCRIPTDIR}/../lib/ponysay/list.pl"
+linklistcmd="${SCRIPTDIR}/../lib/ponysay/linklist.pl"
truncatercmd="${SCRIPTDIR}/../lib/ponysay/truncater"
+[[ -f "./ponysaylist.pl" ]] && listcmd="./ponysaylist.pl"
+[[ -f "./ponysaylinklist.pl" ]] && linklistcmd="./ponysaylinklist.pl"
+[[ -f "./ponysaytruncater" ]] && truncatercmd="./ponysaytruncater"
haspq=1
if [[ -f './pq4ps-list' ]]; then
@@ -87,75 +95,7 @@ _linklist() {
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
- perl '/dev/stdin' $(echo $args) <<EOF | sed -e 's/ /_/g' > '/dev/shm/.ponysay~'
-#!/usr/bin/perl
-
-#Author: Mattias Andrée (maandree@kth.se)
-
-%hash = ();
-\$argc = @ARGV;
-
-\$i = 0;
-while (\$i < \$argc)
-{
- \$source = \$ARGV[\$i];
- \$i += 1;
- \$target = \$ARGV[\$i];
- \$i += 1;
- if (\$source eq \$target)
- {
- \$hash{\$source} = [ () ];
- }
-}
-
-\$i = 0;
-while (\$i < \$argc)
-{
- \$source = \$ARGV[\$i];
- \$i += 1;
- \$target = \$ARGV[\$i];
- \$i += 1;
- unless (\$source eq \$target)
- {
- push @{ \$hash{\$target} }, \$source;
- }
-}
-
-\$i = 0;
-while (\$i < \$argc)
-{
- \$source = \$ARGV[\$i];
- \$i += 1;
- \$target = \$ARGV[\$i];
- \$i += 1;
- if (\$source eq \$target)
- {
- @list = @{ \$hash{\$source} };
- \$first = 1;
- print \$source;
- foreach \$link (@list)
- {
- if (\$first eq 1)
- {
- print " (".\$link;
- \$first = 0;
- }
- else
- {
- print " ".\$link;
- }
- }
- if (\$first eq 0)
- {
- print ")";
- }
- print "\n";
- }
-}
-EOF
-
- perl $listcmd $scrw $(cat "/dev/shm/.ponysay~") | sed -e 's/_/ /g' | qlist
- rm '/dev/shm/.ponysay~'
+ perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qlist
}
linklist() {
@@ -206,7 +146,7 @@ say() {
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
export PERL_UNICODE=S
- if [ "$TERM" = "linux" ]; then
+ if [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ]; then
echo -ne '\e[H\e[2J'
fi
@@ -237,9 +177,9 @@ say() {
ccmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
if [[ ${0} == *ponythink ]]; then
- cat <(echo -e $pcmd) $ccmd > "/dev/shm/.ponythink"
- perl '/dev/shm/.ponythink' "$@"
- rm '/dev/shm/.ponythink'
+ cat <(echo -e $pcmd) $ccmd > "/tmp/ponythink"
+ perl '/tmp/ponythink' "$@"
+ rm '/tmp/ponythink'
else
perl <(cat <(echo -e $pcmd) $ccmd) "$@"
fi
@@ -304,6 +244,7 @@ if [[ $usepq = 1 ]]; then
/usr/bin/pq4ps $@
}
fi
+ [[ "$TERM" = "-linux-" ]] && TERM="linux"
$0 ${wrap:+-W$wrap} $(q "$*")
exit
fi
diff --git a/ponysaylinklist.pl b/ponysaylinklist.pl
new file mode 100755
index 0000000..ec6ff9b
--- /dev/null
+++ b/ponysaylinklist.pl
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+# ponysaylist
+# Prints a list of ponies in columns
+#
+# Licensed under WTFPL
+# See COPYING for details
+
+# Author: Mattias Andrée, maandree@kth.se
+
+
+%hash = ();
+$argc = @ARGV;
+
+$i = 0;
+while ($i < $argc)
+{
+ $source = $ARGV[$i];
+ $i += 1;
+ $target = $ARGV[$i];
+ $i += 1;
+ if ($source eq $target)
+ {
+ $hash{$source} = [ () ];
+ }
+}
+
+$i = 0;
+while ($i < $argc)
+{
+ $source = $ARGV[$i];
+ $i += 1;
+ $target = $ARGV[$i];
+ $i += 1;
+ unless ($source eq $target)
+ {
+ push @{ $hash{$target} }, $source;
+ }
+}
+
+$i = 0;
+while ($i < $argc)
+{
+ $source = $ARGV[$i];
+ $i += 1;
+ $target = $ARGV[$i];
+ $i += 1;
+ if ($source eq $target)
+ {
+ @list = @{ $hash{$source} };
+ $first = 1;
+ print $source;
+ foreach $link (@list)
+ {
+ if ($first eq 1)
+ {
+ print " (".$link;
+ $first = 0;
+ }
+ else
+ {
+ print " ".$link;
+ }
+ }
+ if ($first eq 0)
+ {
+ print ")";
+ }
+ print "\n";
+ }
+}
+
diff --git a/ponysaylist.pl b/ponysaylist.pl
index 72c0a92..401d83b 100755
--- a/ponysaylist.pl
+++ b/ponysaylist.pl
@@ -17,7 +17,7 @@ foreach $arg (@ARGV)
{
# Format names from ponyies names
$arg =~ s/([a-z])([A-Z])/\1 \2/;
- $arg =~ s/_(.*)/\t(\1)/;
+ #$arg =~ s/_(.*)/\t(\1)/; ## Incompatible with `ponysay -L`
if ($first == 1)
{ $first = 0;