diff --git a/Makefile b/Makefile index c1ed92ec..4feb3fca 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,21 @@ -all: ponysaytruncater manpages ponythinkcompletion - +all: ponysaytruncater manpages infomanual ponythinkcompletion 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 + 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" - ttyponies: mkdir -p ttyponies for pony in $$(ls --color=no ponies/); do \ @@ -27,6 +27,18 @@ ttyponies: fi \ done +pdfmanual: + texi2pdf "manuals/ponysay.texinfo" + if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi + if [[ -f "ponysay.cp" ]]; then unlink "ponysay.cp" ; fi + if [[ -f "ponysay.cps" ]]; then unlink "ponysay.cps"; fi + if [[ -f "ponysay.fn" ]]; then unlink "ponysay.fn" ; fi + if [[ -f "ponysay.ky" ]]; then unlink "ponysay.ky" ; fi + if [[ -f "ponysay.log" ]]; then unlink "ponysay.log"; fi + if [[ -f "ponysay.pg" ]]; then unlink "ponysay.pg" ; fi + if [[ -f "ponysay.toc" ]]; then unlink "ponysay.toc"; fi + if [[ -f "ponysay.tp" ]]; then unlink "ponysay.tp" ; fi + if [[ -f "ponysay.vr" ]]; then unlink "ponysay.vr" ; fi install: all mkdir -p "$(DESTDIR)/usr/share/ponysay/" @@ -42,6 +54,7 @@ install: all 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" @@ -66,6 +79,12 @@ install: all install "manuals/manpage.es.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponysay.6.gz" ln -sf "ponysay.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz" + mkdir -p "$(DESTDIR)/usr/share/info" + install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponysay.info.gz" + install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponythink.info.gz" + 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" + @echo -e '\n\n'\ '/--------------------------------------------------\\\n'\ '| ___ |\n'\ @@ -84,13 +103,13 @@ install: all '\\--------------------------------------------------/' @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" @@ -103,13 +122,14 @@ uninstall: unlink "$(DESTDIR)/usr/share/man/man6/ponythink.6.gz" unlink "$(DESTDIR)/usr/share/man/es/man6/ponysay.6.gz" 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" clean: rm -f "ponysaytruncater" - rm "completion/bash-completion-think.sh" - rm "completion/fish-completion-think.fish" - rm "completion/zsh-completion-think.zsh" - rm "manuals/manpage.6.gz" - rm "manuals/manpage.es.6.gz" - + rm -f "completion/bash-completion-think.sh" + rm -f "completion/fish-completion-think.fish" + rm -f "completion/zsh-completion-think.zsh" + rm -f "manuals/manpage.6.gz" + rm -f "manuals/manpage.es.6.gz" + rm -f "ponysay.info.gz" diff --git a/README b/README index 49891e10..c04f3c2c 100644 --- a/README +++ b/README @@ -25,9 +25,9 @@ Required runtime dependencies cowsay : this is a wrapper for cowsay - coreutils : the main script [file: ponysay] uses stty, cut, ls, cat, sort, readlink, head and tail + coreutils : the main script [file: ponysay] uses stty, cut, ls, cat, sort, readlink, pwd, head and tail - sed : used to remove .pony from pony named when running `ponysay -l` and `ponysay -L` + sed : used to remove .pony from pony names when running `ponysay -l` and `ponysay -L` perl : required to run `ponysay -l` and `ponysay -L` @@ -49,19 +49,19 @@ Package building dependencies make : required to run the make script - coreutils : make script uses install unlink rm ln mkdir cp + coreutils : make script uses install, unlink, rm, ln, mkdir and cp Dependencies for pony providers =============================== - make : required to run `make -B ttyponies` + make : required to run `make -B ttyponies` coreutils : ln and readlink are used in the ttyponies subscript bash : used in the ttyponies subscript - util-say : used by `make ttyponies` to builder ttyponies from xterm ponies + util-say : used by `make ttyponies` to build ttyponies from xterm ponies -- Available for Arch:ers in AUR as util-say-git (https://aur.archlinux.org/packages.php?ID=60241) -- and on github at https://github.com/maandree/util-say @@ -77,7 +77,7 @@ Installation on GNU/Linux (or other Unix implementations) In the terminal, `cd` into the ponysay directory and execute `make && make install`. This will install ponysay into the $PREFIX (/usr by default, meaning you may need to - run `make install` as root, e.g by running `sudo make install`.) + run `make install` as root, e.g. by running `sudo make install`.) In order to use ponysay, run: ponysay "I am just the cutest pony!" Or if you have a specific pony in your mind: ponysay -f pinkie "Partay!~" @@ -119,10 +119,10 @@ Installing ponyquotes4ponysay will enable My Little Pony quotes with associated It is available at: https://github.com/maandree/ponyquotes4ponysay https://aur.archlinux.org/packages.php?ID=60988 -Run `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. -Add one or more argument after `-q` to sepcify a set of ponies from which one will be selected randomly. +Running `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. +Add one or more argument after `-q` to sepecify a set of ponies from which one will be selected randomly. -When running `ponysay -l` or `ponysay -L` the ponies which have quotes will be printed bold or bright (depending on terminal +When running `ponysay -l` or `ponysay -L` the ponies which have quotes will be printed bold or bright (depending on terminal). Ponies in TTY (Linux VT) @@ -166,7 +166,7 @@ Providing ponies ================ Most pony images are browser ponies or desktop ponies, - browser ponies is a fork of desktop ponies, implementing it in JavaScript. + browser ponies is a port of desktop ponies, implementing it in JavaScript. Browser ponies: https://github.com/panzi/Browser-Ponies Desktop ponies: http://desktop-pony-team.deviantart.com/ @@ -194,7 +194,7 @@ Providing ponies When a pony is added please also add a ttypony version, but if you don't please state so in the pull request so we do not miss the create it; the simplest way to - do this is to run `make -B ttyponies` after adding the ponies to ponies/, + do this is to run `make -B ttyponies` after adding the ponies to ponies/. Running `make -B ttyponies` will build (or rebuild) all ttyponies with a pony present in ponies/, and creates all needed symlinks. diff --git a/README.md b/README.md index bc9bf7a2..68d6a54b 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,14 @@ Or if you have a specific pony in your mind: Run `info ponysay`, `man 6 ponysay` or `ponysay -h` for more information. A Spanish manual is available: `man -L es 6 ponysay`. +#### Arch Linux +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 @@ -49,7 +57,7 @@ Now every time you open a terminal a pony should give your fortune Installing [ponyquotes4ponysay](https://github.com/maandree/ponyquotes4ponysay) will enable My Little Pony quotes with associated pony. -Run `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. Add one or more argument after `-q` to sepcify a +Running `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. Add one or more argument after `-q` to sepecify a set of ponies from which one will be selected randomly. When running `ponysay -l` or `ponysay -L` the ponies which have quotes will be printed bold or bright (depending on terminal). @@ -80,9 +88,9 @@ Dependencies `cowsay`: this is a wrapper for cowsay -`coreutils`: the main script uses stty, cut, ls, cat, sort, readlink, head and tail +`coreutils`: the main script uses stty, cut, ls, cat, sort, readlink, pwd, head and tail -`sed`: used to remove .pony from pony named when running `ponysay -l` and `ponysay -l` +`sed`: used to remove .pony from pony names when running `ponysay -l` and `ponysay -l` `perl`: required to run `ponysay -l` and `ponysay -L` diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index 8d3c9111..802cbf27 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -1,24 +1,23 @@ - -# Completions for ponysay & ponythink +# Completions for ponysay # https://github.com/erkin/ponysay/ # # Author: Elis Axelsson if test $TERM = "linux" - set -g systempath "/usr/share/ponysay/ttyponies/" - set -g homepath "~/.local/share/ponysay/ttyponies/" + set -g systempath /usr/share/ponysay/ttyponies/ + set -g homepath ~/.local/share/ponysay/ttyponies/ else - set -g systempath "/usr/share/ponysay/ponies/" - set -g homepath "~/.local/share/ponysay/ponies/" + set -g systempath /usr/share/ponysay/ponies/ + set -g homepath ~/.local/share/ponysay/ponies/ end if test -d $systempath - set -g systemponies (ls --color=no $systempath | sed 's/\.pony//') + set -g systemponies (ls --color=no $systempath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' ) end if test -d $homepath - set -g homeponies (ls --color=no $homepath | sed 's/\.pony//') + set -g homeponies (ls --color=no $homepath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' ) end diff --git a/manuals/manpage.6 b/manuals/manpage.6 index daa221e0..07f88c95 100644 --- a/manuals/manpage.6 +++ b/manuals/manpage.6 @@ -74,7 +74,7 @@ of how many blank lines you want. Naturally this takes effect if the output is n than the screen. .TP .B PONYSAY_FULL_WIDTH -You can export \fIPONYSAY_FULL_WIDTH\fP with the value \fIno\fP, \fIn\fP or \fI0\fP, if you +You can export \fIPONYSAY_FULL_WIDTH\fP with the value \fIyes\fP, \fIy\fP or \fI1\fP, if you do not want the output to be truncated on the width to fit the terminal. .TP .B PONYSAY_TRUNCATE_HEIGHT diff --git a/manuals/manpage.es.6 b/manuals/manpage.es.6 index 6e14d116..59e0ead9 100644 --- a/manuals/manpage.es.6 +++ b/manuals/manpage.es.6 @@ -77,7 +77,7 @@ el valor de cuantas líneas blancas desea. Naturalmente esto solo tomará efecto larga que la pantalla. .TP .B PONYSAY_FULL_WIDTH -Puede exportar \fIPONYSAY_FULL_WIDTH\fP con el valor \fIno\fP, \fIn\fP o \fI0\fP, si usted +Puede exportar \fIPONYSAY_FULL_WIDTH\fP con el valor \fIyes\fP, \fIy\fP o \fI1\fP, si usted no desea que la salida sea truncada para que calce en la terminal. .TP .B PONYSAY_TRUNCATE_HEIGHT diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index d25cfdf5..2f9eb7e2 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -21,8 +21,8 @@ Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license is included in the section entitled ``GNU -Free Documentation License''. +Texts. A copy of the license is included in the section entitled +``GNU Free Documentation License''. @end quotation @end copying @@ -36,7 +36,7 @@ Free Documentation License''. @title Ponysay @subtitle A cowsay wrapper for ponies. @subtitle Covers ponysay version @value{VERSION}. -@author by Mattias Andrée +@author by Mattias Andrée (maandree) @page @vskip 0pt plus 1filll @@ -49,15 +49,24 @@ Free Documentation License''. @menu * Overview:: Brief overview of @command{ponysay}. * Invoking ponysay:: How to run @command{ponysay}. +* Advanced usage:: Advanced usage of @command{ponysay}. * Environment:: Environment variables. -@c Extensions * Limitations:: Limitations. * Problems and requests:: Reports and requests. +* Dependencies:: Dependencies. +* Installing:: Installing. +* Extensions:: Extensions. +* Inner workings:: Inner workings. +* Contributing:: Contributing. +* Ponysay constributors:: Ponysay constributors. +* Ponysay license:: Ponysay license. * GNU Free Documentation License:: Copying and sharing this manual. * Concept index:: Concept index. @end menu + + @node Overview @chapter Overview @cindex overview @@ -70,6 +79,8 @@ is printed on standard output. @command{ponythink} is to @command{ponysay} as @command{cowthink} is to @command{cowsay}. + + @node Invoking ponysay @chapter Invoking @command{ponysay} @cindex invoking @@ -138,6 +149,88 @@ If you want to use @command{ponysay} without arguments and enter the message by hand, you can run @code{cat | ponysay}. + +@node Advanced usage +@chapter Advanced usage of @command{ponysay}. +@cindex advanced usage + +@menu +* Fortune cookies:: Displaying with fortune cookies. +* Ponification:: Ponify your fortune cookies. +* Running on TTY:: Running on TTY (Linux VT). +* Running on screen:: Running on @command{screen}. +@end menu + + +@node Fortune cookies +@section Fortune cookies +@cindex fortune +@cindex on startup + +If you have @command{fortune} installed -- this program may be named +@command{fortune-mod} in your GNU/Linux distributions package reposity -- +you can run @code{fortune | ponysay} to get a random pony reading a +random fortune cookie. + +By adding @code{fortune | ponysay} to the end [easiest way] of your +@code{~/.bashrc} -- or equivalent for your shell if use do not use GNU Bash +(standard shell for most distributions now adays) -- you will get the +effect described in the previous paragraph every time you open a terminal. + + +@node Ponification +@section Ponification +@cindex ponification +@cindex ponypipe + +You can ponify text (i.e. replaces words search as ``everyone'' with ``everypony'') +by using @code{fortune | ponypipe} instead of using @command{fortune}. +@command{ponypipe} can be downloaded from @url{https://github.com/maandree/ponypipe}. +Alternatively use can use @command{pinkie} (or @command{pinkiepie}), which can +be downloaded from @url{https://github.com/maandree/pinkie-pie}, which is just +@code{fortune | ponypipe}. +There is also a large sed script, similar to @command{ponypipe}: @url{http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/} + + +@node Running on TTY +@section Running on TTY +@cindex tty +@cindex linux vt + +If you use TTY and have a custom colour palette, you should also add to your +@code{~/.bashrc}, before @code{fortune | ponysay}: +@example +[[ "$TERM" = "linux" ]] && + function ponysay + @{ exec ponysay "$@@" + #RESET PALETTE HERE + @} +@end example + + +@node Running on screen +@section Running on @command{screen} +@cindex screen + +@command{screen} will adapt ASNI colour escape sequencies to your terminal's +capabilities. This means that is your terminal reports itself as @code{xterm} +in @code{$TERM} it ponies will lose colours; they will only use the lower 16 +colours instread of the top 240 colours. By default, almost all X terminal, +including @command{xterm} and @command{mate-terminal} reports themself as +@code{xterm} in @code{$TERM}, and some reports their actual name in @code{$COLORTERM}. +So before openning @command{screen} you use set @code{$TERM} to @code{xterm-256color}, +if you are using a terminal with support for @code{xterm}'s 256 colours; this +can be done by adding to your @code{~/.bashrc}: +@example +[[ "$TERM" = "xterm" ]] && + function screen + @{ export TERM="xterm-256color" + exec screen "$@@" + @} +@end example + + + @node Environment @chapter Environment variables @cindex environment variables @@ -148,6 +241,7 @@ by hand, you can run @code{cat | ponysay}. @table @option @item PONYSAY_BOTTOM @cindex PONYSAY_BOTTOM +@cindex tty Under TTY (Linux VT), if the output is larger the the screen's height, only the beginning is printed, leaving two blank lines. If you want the buttom to be printed rather the the beginning you can export @code{PONYSAY_BOTTOM} @@ -155,6 +249,7 @@ with the value @code{yes}, @code{y} or @code{1}. @item PONYSAY_SHELL_LINES @cindex PONYSAY_SHELL_LINES +@cindex tty Under TTY (Linux VT), if the output is larger the the screen's height, two lines are left blank. If you want more, or less, blank lines you can export @code{PONYSAY_SHELL_LINES} with the value of how many blank lines you want. @@ -163,8 +258,8 @@ screen. @item PONYSAY_FULL_WIDTH @cindex PONYSAY_FULL_WIDTH -You can export @code{PONYSAY_FULL_WIDTH} with the value @code{no}, @code{n} -or @code{0}, if you do not want the output to be truncated on the width to +You can export @code{PONYSAY_FULL_WIDTH} with the value @code{yes}, @code{y} +or @code{1}, if you do not want the output to be truncated on the width to fit the terminal. @item PONYSAY_TRUNCATE_HEIGHT @@ -172,34 +267,87 @@ fit the terminal. Export @code{PONYSAY_TRUNCATE_HEIGHT} with the value @code{yes}, @code{y} or @code{1}, if you want to truncate the output on the height even if you are not running @command{ponysay} under TTY. + +@item PONYSAY_COWSAY +@item PONYSAY_COWTHINK +@cindex PONYSAY_COWSAY +@cindex PONYSAY_COWTINK +@cindex custom cowsay +@cindex replace cowsay +If you want to use another program than @command{cowsay} (the first +@command{cowsay} found in @code{$PATH}), you can export @code{PONYSAY_COWSAY} +with the value of that program. If, and only if, @code{PONYSAY_COWSAY} does +not have any value, @command{cowsay} is patch with @code{use utf8;} to the +beginning. The @code{use utf8;} patch is introduced to make it easier to +customise cowsay. + +@code{PONYSAY_COWTHINK} will be used instead of @code{PONYSAY_COWSAY} if +you run @command{ponythink}. @end table + @node Limitations @chapter Limitations @cindex limitations @menu * Terminals:: Limitations on terminals. -@c Cowsay +* Cowsay:: Limitations on cowsay. @end menu + @node Terminals @section Terminals - +@cindex kms +@cindex kernel mode settings +@cindex 9term +@cindex putty Ponysay works perfectly on @command{xterm}, @command{xterm} like terminals including @command{putty}, settings may however need to be customised for Unicode Character Set (UCS) support, but less well, depending on font, on VTE based terminals including @command{mate-terminal}. -On Linux's native terminal Linux VT (or TTY) it works less well, and not good at all -with Kernal Mode Settings (KMS) support. See @url{https://github.com/erkin/ponysay/issues/1} -for more information. +On Linux's native terminal Linux VT (TTY) it works less well, and not good at all with +Kernal Mode Settings (KMS) support. See @url{https://github.com/erkin/ponysay/issues/1} +for more information. @command{ponysay} clears the screen before printing to TTY, this +is because if your graphics driver supports KMS, the colours will be messed by when the +ponies position moves on the screen, this is also reason why the output is truncated on +the height in TTY by default. -Due to extreme limitations in @command{9term} @command{ponysay} will never be able -to run on it. +Due to extreme limitations in @command{9term} @command{ponysay} will never be able to +run on it. + +Most terminals have support for 256 colours, we do however only use the top 240 colours; +this is because the lower 16 colours are usally, in contrast to the top 240, customised. +We assume that the top 240 colours have their standard values. In TTY with KMS support +we dot have any actual (except for @math{2^{24}} + full transparency.) + + +@node Cowsay +@section Cowsay + +When @command{cowsay} determines the length of a word it measures in number of bytes +(in UTF-8), therefore non-ASCII words will malformat the balloon with the message. + +Further, @command{cowsay} does not recognise ANSI escape sequences, therefore, using +colours and text styling in messages will also malformat the balloon with the message. + +@command{cowsay} does not support balloon, including the link between the message and +the pony, customisation, other than using @command{cowthink}. However you can modify +@command{cowsay} (written perl, so you can edit the installed files) to make the balloon +look different, maybe using box drawing characters. + +@command{cowsay} does support setting the minimum size of the balloon, both directions +on the balloon–pony links. or any other placement of the balloon than at the top to +the left. + +@cindex figlet +@cindex tiolet +@command{cowsay}'s word wrapping handles single line breaks as normal blankspaces, +this messes up messaged created with programs seach as @command{figlet} and @command{TOIlet}. @@ -208,9 +356,10 @@ to run on it. @menu * Problems:: Reporting bugs. -* Requests:: Requestig ponies. +* Requests:: Requesting ponies. @end menu + @node Problems @section Reporting bugs @cindex bugs @@ -221,8 +370,9 @@ present, please report it at @url{https://github.com/erkin/ponysay/issues}. Please be as descriptive as possible, as it will help us verify it solve it faster. + @node Requests -@section Requestig ponies +@section Requesting ponies @cindex pony requests If you want I specific pony added, ask us at @url{https://github.com/erkin/ponysay/issues} @@ -230,6 +380,336 @@ and we will add it. To speed the up the process, if possible, supply good pictures. Full visibly, transparent background, and pixelated are the properties that makes a picture good. + + +@node Dependencies +@chapter Dependencies +@cindex dependencies +@cindex optional dependencies + +@menu +* Required runtime dependencies:: Required runtime dependencies. +* Optional runtime dependencies:: Optional runtime dependencies. +* Package building dependencies:: Package building dependencies. +* Dependencies for pony providers:: Dependencies for pony providers. +@end menu + + +@node Required runtime dependencies +@section Required runtime dependencies + +@table @option +@item bash +Required for the main script [file: @command{ponysay}]. +@item cowsay +This is a wrapper for @command{cowsay}. +@item coreutils +The main script [file: @command{ponysay}] uses @command{stty}, @command{cut}, +@command{ls}, @command{cat}, @command{sort}, @command{readlink}, @command{pwd}, +@command{head} and @command{tail}. +@item sed +Used to remove @code{.pony} from pony names when running @command{ponysay -l} +and @command{ponysay -L}. +@item perl +Required to run @command{ponysay -l} and @command{ponysay -L}. +@end table + +@node Optional runtime dependencies +@section Optional runtime dependencies +@cindex extensions +@cindex optional dependencies +@cindex ponyquotes4ponysay + +@table @option +@item ponyquotes4ponysay +For support of My Little Pony quotes with associated pony: the @code{-q} option. +It can be downloaded at @url{https://github.com/maandree/ponyquotes4ponysay}. +@end table + + +@node Package building dependencies +@section Package building dependencies + +@table @option +@item gcc +Used for compiling @command{ponysaytruncater.c}. +@item gzip +Used for compressing manpages. +@item make +Required to run the make script. +@item coreutils +The make script uses @command{install}, @command{unlink}, @command{rm}, @command{ln}, +@command{mkdir} and @command{cp}. +@end table + + +@node Dependencies for pony providers +@section Dependencies for pony providers +@cindex contributing + +@table @option +@item make +Required to run @command{make -B ttyponies`}. +@item coreutils +@command{ln} and @command{readlink} are used in the @command{ttyponies} subscript. +@item bash +Used in the ttyponies subscript. +@item util-say +Used by @command{make ttyponies} to build ttyponies from xterm ponies. +It can be downloaded at @url{https://github.com/maandree/util-say}. +@end table + + + +@node Installing +@chapter Installing +@cindex installing +@cindex make + +Before installing @command{ponysay}, make sure your system have the packages listed under +@ref{Required runtime dependencies} and @ref{Package building dependencies} installed. + +Tarballs can be downloaded at @url{https://github.com/erkin/ponysay/tarball/master} +for bleeding edge, or from @url{https://github.com/erkin/ponysay/tags} for releases. + +If you have @command{git} you @command{clone} the project URL +@url{https://github.com/erkin/ponysay.git}. + +In the terminal,@command{cd} into the ponysay directory and execute +@command{make && make install}. This will install @command{ponysay} into the +@code{/usr}, meaning you may need to run @command{make install} as root, +e.g. by running @command{sudo make install}. + +Now you will be to use ponysay, run: @command{ponysay "I am just the cutest pony!"}, +or if have a specific pony in your mind: @command{ponysay -f pinkie "Partay!~"}. + +@command{ponysay} comes with a manpage in section 6, @command{man 6 ponysay} +(or just @command{man ponysay}). The man page is also available in Spanish: +@command{man -L es 6 ponysay}. + + + +@node Extensions +@chapter Extensions +@cindex extensions +@cindex optional dependencies + +Ponysay does not support extensions, per se, but rather have optional features that +are enabled when other packages are installed. + +@menu +* ponyquotes4ponysay:: ponyquotes4ponysay +@end menu + +@node ponyquotes4ponysay +@section ponyquotes4ponysay +@cindex ponyquotes4ponysay + +@command{ponyquotes4ponysay} is a package that adds support for MLP:FiM quotes that are +displayed with the associated ponies. See @ref{Invoking ponysay} for more information. +@command{ponyquotes4ponysay} can be downloaded at +@url{https://github.com/maandree/ponyquotes4ponysay}. + + + +@node Inner workings +@chapter Inner workings +@cindex inner workings +@cindex hacking + +@menu +* Pony anatomy:: Anatomy of pony files. +* Truncation:: Output truncation. +* Languages:: Selection of languages. +@end menu + + +@node Pony anatomy +@section Pony anatomy +@cindex pony anatomy +@cindex anatomy of pony files + +The pony files are cow files used by @command{cowsay}, they are partial Perl-scripts +that assign a value to a scalar variable named @code{$the_cow}. The files use a +predefined scalar named variable named @code{$thoughts}, these are used to create +a link between the message and the pony. The message (and the balloon) it self is +printed by @command{cowsay} and is not definied in the pony files. + +The pony images consists of white space, lower half blocks [U+2584], upper half +blocks [U+2580] and ANSI colour sequences (CSI m), and, in TTY, colour value change +sequences (OSI P). + + +@node Truncation +@section Truncation +@cindex truncation +@cindex output trunction +@cindex kms +@cindex kernel mode settings + +Ponysay supports three type of output truncations, cutting away overflow on the right +and truncation the height by either keeping the bottom or keeping the top. By default +the latest is enabled under TTY, cutting away overflow on the right is always enabled +by default. + +Truncating the height in TTY is required under Kernel Mode Settings (KMS) support to +keep the colours from being messed up ad the ponies is moved in the screen during +print; this done either by piping to @command{head} (keeps the top) or by piping to +@command{tail} (keeps the bottom.) @command{head} and @command{tail} takes as argument +the number of lines to keep at most. + +The size of the terminal, measured in characters, is fetched from @command{stty size}, +which returns @code{HEIGHT WIDTH}, and @command{cut} it the used to get either the +height or the width. This required on GNU Coreutils; earlier @command{tput rows} and +@command{tput cols} were used, this however required, the only de facto standard, +package @command{ncurses}, some shells have environment variables for this. + +For truncation the width, we have a custom program, named @command{ponysaytruncater}, +that is installed to @code{/usr/lib/ponysay/truncater}. It recognised UTF-8 ANSI escape +sequences, including OSI P and CSI m, which is essential for the truncation to be correct. +It also expands tabs to every eigth coloumn and resets the background colour when needed, +and writes ANSI escape sequences that are on the left side of the truncation. The truncater +stops CSI sequences on the first ASCII letter (@code{[a-zA-Z]}), but also stops escape +sequences after the first character after the initial escape if it is not either [ (CSI) +or ] (OSI). For support UTF-8, to handles all bytes that do not match @code{10xxxxxx} as +beginning of a character. + + +@node Languages +@section Languages +@cindex languages +@cindex script languages +@cindex programming languages + +Ponysay is written primarily in GNU Bash shell script (POSIX compliant); the truncater +is however written in C, because it is simple, fast, does not pose addition dependencies, +and is easy to do byte hacking in. + +Sometimes shell is too slow, in these cases [that exist today] Perl is used; Perl +is already required by cowsay, is similar to shell, but also supports hash tables. +[maandree: I actually learned Perl just for this.] + + + +@node Contributing +@chapter Contributing +@cindex contributing + +@menu +* Providing ponies:: Providing ponies +@end menu + +@node Providing ponies +@section Providing ponies +@cindex create pony file + +Most pony images are browser ponies or desktop ponies, browser ponies is a port of +desktop ponies, implementing it in JavaScript. Browser ponies are available at +@url{https://github.com/panzi/Browser-Ponies}. Desktop ponies are available at +@url{http://desktop-pony-team.deviantart.com/}. + +There is also a collection of ponies that are not yet pixelated in a Java reimplementation: +@url{https://github.com/maandree/unisay/tree/develop/dev/newponies} + +There is a checklist named @code{"pony-checklist"} at the top level of the project +directory. You can use the check which ponies are added and which are not. +@* + +New ponies can be created from regular images by using util-say, which is available +at @url{https://github.com/maandree/util-say}. +@command{img2xterm} (@url{https://github.com/rossy2401/img2xterm}) was used earlier, +but util-say tries do optimise the images in some aspects: as good as possible for +low capability terminals, tries to place the pony–balloon link, displayed as good as +possible when marked in the terminal (somewhat compromised by the first aspect,) and +same width on all rows. + +Using util-say: +@example +img2ponysay -2 -- SOURCE_IMAGE > PONY_FILE + +PONY_FILE should end with .pony and be localed in ponies/ + +Omit -2 if the source image does not use double pixel size. + +For more information see: +@url{https://github.com/maandree/util-say/wiki/img2ponysay} +@end example + +@* +@cindex ttypony +When a pony is added please also add a ttypony version, i.e. the pony files used in TTY, +but if you don't please state so in the pull request so we do not miss the create it; +the simplest way to do this is to run @command{make -B ttyponies} after adding the ponies +to @code{ponies/}, running @command{make -B ttyponies} will build (or rebuild) all +ttyponies with a pony present in @code{ponies/}, and creates all needed symlinks. + +To be able to run @command{make -B ttyponies} you must have the packages listed under +@ref{Dependencies for pony providers}. + + + + +@node Ponysay constributors +@appendix Ponysay constributors + +Active developers of ponysay: +@itemize @bullet +@item Erkin Batu Altunbaş +@item Mattias Andrée +@item Sven-Hendrik Haase +@item Pablo Lezaeta +@item Jan Alexander Steffens +@end itemize +@* +Patchers and other contributors of ponysay: +@itemize @bullet +@item Elis Axelsson +@item Duane Bekaert +@item Kyah Rindlisbacher +@item James Ross-Gowan +@item Louis Taylor +@item Jannis +@end itemize + + +@node Ponysay license +@appendix Ponysay license + +Ponysay is Free Software (yet not Open Source) and in licensed under the terms +of Do What The Fuck You Want To Public Licese (WTFPL) version 2. + +You have the four essential freedoms: +@itemize @bullet +@item +The freedom to run the program, for any purpose (freedom 0). +@item +The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. +@item +The freedom to redistribute copies so you can help your neighbour (freedom 2). +@item +The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. +@end itemize + +@* + +@center DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +@center Version 2, December 2004 + +Copyright @copyright{} 2012 Erkin Batu Altunbaş + +@quotation +Everyone is permitted to copy and distribute verbatim or modified +copies of this license document, and changing it is allowed as long +as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. You just DO WHAT THE FUCK YOU WANT TO. +@end quotation + + + @node GNU Free Documentation License @appendix GNU Free Documentation License @include fdl.texinfo @@ -238,5 +718,6 @@ properties that makes a picture good. @appendix Concept index @printindex cp + @bye diff --git a/ponies/amethyststar.pony b/ponies/amethyststar.pony new file mode 120000 index 00000000..196d4162 --- /dev/null +++ b/ponies/amethyststar.pony @@ -0,0 +1 @@ +./sparkler.pony \ No newline at end of file diff --git a/ponies/berrypinch.pony b/ponies/berrypinch.pony new file mode 120000 index 00000000..0e631992 --- /dev/null +++ b/ponies/berrypinch.pony @@ -0,0 +1 @@ +./ruby.pony \ No newline at end of file diff --git a/ponies/blossomforth.pony b/ponies/blossomforth.pony new file mode 100644 index 00000000..e2696ecd --- /dev/null +++ b/ponies/blossomforth.pony @@ -0,0 +1,26 @@ +$the_cow =< /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 + echo -e "\\e[01mponyfiles located in $1:\\e[21m" + files=$(ls --color=no $1 | sed -e 's/\.pony$//' | sort) + + args="" + + for file in $files; do + target=$(readlink $1"/"$file".pony") + + if [[ $target = "" ]]; then + target=$file + else + target=$(echo $target | sed -e 's/^\.\///g' -e 's/\.pony$//g') + fi + + args=$(echo $args $file $target) + done + + scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` + + perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qlist } linklist() { - _linklist $SYSTEMPONIES - if [[ -d $HOMEPONIES ]]; then - _linklist $HOMEPONIES - fi + _linklist $SYSTEMPONIES + + if [[ -d $HOMEPONIES ]]; then + _linklist $HOMEPONIES + fi } usage() { - version - cat </dev/null || cat + # Ponies use UTF-8 drawing characters. Prevent a Perl warning. + export PERL_UNICODE=S + + if [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ]; then + echo -ne '\e[H\e[2J' fi - } - - if [ "$PONYSAY_SHELL_LINES" = "" ]; then - PONYSAY_SHELL_LINES=2 - fi - function htrunchead - { - head --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) - } - function htrunctail - { - tail --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) - } - - if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then - if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then - perl <(cat <(echo -e '#!/usr/bin/perl\nuse utf8;') $(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [[ -f $c ]]; then echo $c; break; fi done)) -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunctail - else - perl <(cat <(echo -e '#!/usr/bin/perl\nuse utf8;') $(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [[ -f $c ]]; then echo $c; break; fi done)) -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunchead + + function wtrunc { + if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then + cat + else + WIDTH=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` + $truncatercmd $WIDTH 2>/dev/null || cat + fi + } + + if [ "$PONYSAY_SHELL_LINES" = "" ]; then + PONYSAY_SHELL_LINES=2 + fi + + function htrunchead { + head --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) + } + + function htrunctail { + tail --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES )) + } + + if [[ $customcmd = 0 ]]; then + function cowcmd { + pcmd='#!/usr/bin/perl\nuse utf8;' + 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 > "/tmp/ponythink" + perl '/tmp/ponythink' "$@" + rm '/tmp/ponythink' + else + perl <(cat <(echo -e $pcmd) $ccmd) "$@" + fi + } + else + function cowcmd { + echo "custom $cmd" + $cmd "$@" + } + fi + + if [[ "$kmscmd" = "" ]]; then + function runcmd { + cowcmd -f "$pony" "$@" + } + else + function runcmd { + cowcmd -f <($kmscmd "$pony") "$@" + } + fi + + if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then + if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then + runcmd "${wrap:+-W$wrap}" | wtrunc | htrunctail + else + runcmd "${wrap:+-W$wrap}" | wtrunc | htrunchead + fi + else + runcmd "${wrap:+-W$wrap}" | wtrunc fi - else - perl <(cat <(echo -e '#!/usr/bin/perl\nuse utf8;') $(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [[ -f $c ]]; then echo $c; break; fi done)) -f "$pony" "${wrap:+-W$wrap}" | wtrunc - fi } ponies=() opts="f:W:Llhv" if [[ $haspq ]]; then - opts=$opts"q" + opts=$opts"q" fi + usepq=0 -while getopts $opts OPT -do - case ${OPT} in - v) version; exit ;; - h) usage; exit ;; - f) ponies+=( "$OPTARG" ) ;; - l) list; exit ;; - L) linklist; exit ;; - W) wrap="$OPTARG" ;; - q) usepq=1 ;; - \?) usage >&2; exit 1 ;; - esac +while getopts $opts OPT; do + case ${OPT} in + v) version; exit ;; + h) usage; exit ;; + f) ponies+=($(echo $OPTARG | sed -e 's/ //g')) ;; + l) list; exit ;; + L) linklist; exit ;; + W) wrap="$OPTARG" ;; + q) usepq=1 ;; + \?) usage >&2; exit 1 ;; + esac done shift $((OPTIND - 1)) if [[ $usepq = 1 ]]; then - if [[ -f './pq4ps' ]]; then - function q - { ./pq4ps $@ - } - elif [[ -f '/usr/bin/pq4ps' ]]; then - function q - { /usr/bin/pq4ps $@ - } - fi - $0 ${wrap:+-W$wrap} $(q "$*") - exit + if [[ -f './pq4ps' ]]; then + function q { + ./pq4ps $@ + } + elif [[ -f '/usr/bin/pq4ps' ]]; then + function q { + /usr/bin/pq4ps $@ + } + fi + [[ "$TERM" = "-linux-" ]] && TERM="linux" + $0 ${wrap:+-W$wrap} $(q "$*") + exit fi hash $cmd &>/dev/null; if [ $? -ne 0 ]; then - cat >&2 <&2 <&2 "All the ponies are missing! Call the Princess!" - exit 1 - fi - - # Choose a random pony - pony="${ponies[$RANDOM%${#ponies[@]}]}" + # Pony not a file? Search for it + + ponies=() + [[ -d $SYSTEMPONIES ]] && ponies+=( "$SYSTEMPONIES"/$pony.pony ) + [[ -d $HOMEPONIES ]] && ponies+=( "$HOMEPONIES"/$pony.pony ) + + if (( ${#ponies} < 1 )); then + echo >&2 "All the ponies are missing! Call the Princess!" + exit 1 + fi + + # Choose a random pony + pony="${ponies[$RANDOM%${#ponies[@]}]}" fi if [[ -n "$*" ]]; then - # Handle a message given via arguments - say <<<"$*" + # Handle a message given via arguments + say <<<"$*" else - say + say fi + diff --git a/ponysay.pdf b/ponysay.pdf new file mode 100644 index 00000000..8dd2096c Binary files /dev/null and b/ponysay.pdf differ diff --git a/ponysaylinklist.pl b/ponysaylinklist.pl new file mode 100755 index 00000000..ec6ff9b1 --- /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 7a093768..401d83ba 100755 --- a/ponysaylist.pl +++ b/ponysaylist.pl @@ -15,6 +15,10 @@ $maxw = 1; foreach $arg (@ARGV) { + # Format names from ponyies names + $arg =~ s/([a-z])([A-Z])/\1 \2/; + #$arg =~ s/_(.*)/\t(\1)/; ## Incompatible with `ponysay -L` + if ($first == 1) { $first = 0; $scrw = $arg; diff --git a/ponysaytruncater.c b/ponysaytruncater.c index 58f3d912..d7034064 100644 --- a/ponysaytruncater.c +++ b/ponysaytruncater.c @@ -15,7 +15,7 @@ #define STDIN 0 /* The number of columns on the current line */ -static int x = 0; +static int col = 0; /* Escape sequence state */ static int esc = 0; @@ -30,7 +30,7 @@ int toInt(String string); /* Mane method! * The only argument, in addition to the executed file, * should be the width of the terminal which you get by - * adding `tput cols || echo 0` as and argument. + * adding `tput cols || echo 0` as an argument. * * @param argc The number of startup arguments * @param argv The startup arguments, the first is the file itself @@ -61,13 +61,13 @@ void main(int argc, String* argv) void write(char b, int width) { int i; - char nx; + char tabstop; if (esc == 0) { if (b == '\n') { - if (x >= width) + if (col >= width) { /* Reset background colour */ write('\e', width); @@ -76,13 +76,13 @@ void write(char b, int width) write('9', width); write('m', width); } - x = -1; + col = -1; } else if (b == '\t') { /* Tab to next pos ≡₈ 0 */ - nx = 8 - (x & 7); - for (i = 0; i < nx; i++) + tabstop = 8 - (col & 7); + for (i = 0; i < tabstop; i++) write(' ', width); return; /* (!) */ } @@ -92,7 +92,7 @@ void write(char b, int width) else if (esc == 1) { if (b == '[') esc = 2; /* CSI: CSI ends with a letter, m is for colour */ - else if (b == ']') esc = 3; /* OSI: OSI P is for palett editing in Linux VT */ + else if (b == ']') esc = 3; /* OSI: OSI P is for palette editing in Linux VT */ else esc = 10; /* Nothing to see here, move along */ } else if (esc == 2) @@ -118,14 +118,14 @@ void write(char b, int width) within bounds ∨ ∨ escape sequence ∨ ∨ last with printed ∧ not first byte in character */ - (x < width) || + (col < width) || (esc != 0) || (ok && ((b & 0xC0) == 0x80))) { printf("%c", b); if ((esc == 0) && ((b & 0xC0) != 0x80)) /* Count up columns of not in escape sequnce and */ - x++; /* the byte is not the first byte in the character */ + col++; /* the byte is not the first byte in the character */ ok = true; } else diff --git a/ttyponies/amethyststar.pony b/ttyponies/amethyststar.pony new file mode 120000 index 00000000..196d4162 --- /dev/null +++ b/ttyponies/amethyststar.pony @@ -0,0 +1 @@ +./sparkler.pony \ No newline at end of file diff --git a/ttyponies/berrypinch.pony b/ttyponies/berrypinch.pony new file mode 120000 index 00000000..0e631992 --- /dev/null +++ b/ttyponies/berrypinch.pony @@ -0,0 +1 @@ +./ruby.pony \ No newline at end of file diff --git a/ttyponies/blossomforth.pony b/ttyponies/blossomforth.pony new file mode 100644 index 00000000..919bca2c --- /dev/null +++ b/ttyponies/blossomforth.pony @@ -0,0 +1,27 @@ +$the_cow =<